Learn C# .Net MCQs

Prepare C# .Net MCQs (Multiple choice Questions) for exam and job interviews.

Which of the following is true about method overriding in C#?

1) It allows a derived class to provide a specific implementation.

2) It allows methods to have different names.

3) It only applies to abstract classes.

4) None of the above

Answer : It allows a derived class to provide a specific implementation.

What is the output of Console.WriteLine("Hello".IndexOf("o"));?

1) 4

2) 3

3) 5

4) Error

Answer : 4

Which of the following is used to initialize an array in C#?

1) new

2) create

3) init

4) None of the above

Answer : new

Which of the following is true about properties in C#?

1) They provide access to fields.

2) They hide fields.

3) They are the same as methods.

4) None of the above

Answer : They provide access to fields.

What is the output of Console.WriteLine(15 % 4);?

1) 3

2) 4

3) 5

4) Error

Answer : 3

Which of the following is used to handle errors in C#?

1) try-catch

2) handle-error

3) catch-finally

4) None of the above

Answer : try-catch

Which of the following is used to handle events in C#?

1) delegate

2) function

3) event

4) None of the above

Answer : delegate

What is the output of Console.WriteLine(25 > 10);?

1) true

2) false

3) Error

4) None of the above

Answer : true

Which of the following is true about the "virtual" keyword in C#?

1) It allows method overriding.

2) It allows multiple inheritances.

3) It is used only for constructors.

4) None of the above

Answer : It allows method overriding.

What is the output of Console.WriteLine("C#".ToUpper());?

1) C#

2) Csharp

3) CSHARP

4) None of the above

Answer : CSHARP