Learn C# .Net MCQs

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

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

1) Constructor

2) Method

3) Property

4) None of the above

Answer : Constructor

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

1) Thread

2) Task

3) BackgroundWorker

4) All of the above

Answer : All of the above

What is the output of Console.WriteLine(10 % 3);?

1) 1

2) 3

3) 0

4) Error

Answer : 1

Which of the following is the correct way to declare a nullable type in C#?

1) int? num

2) nullable int num

3) int num = null

4) None of the above

Answer : int? num

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 multiple methods with the same name.

3) It only applies to constructors.

4) None of the above

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

Which of the following is used to check if a value is null in C#?

1) == null

2) Equals(null)

3) isNull()

4) None of the above

Answer : == null

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

1) 2

2) 3

3) 1

4) Error

Answer : 2

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

1) try-catch

2) catch-finally

3) try-finally

4) None of the above

Answer : try-catch

Which of the following is used to define an interface in C#?

1) interface

2) struct

3) class

4) None of the above

Answer : interface

Which of the following is used to declare an abstract method in C#?

1) abstract

2) virtual

3) override

4) None of the above

Answer : abstract