Learn C# .Net MCQs

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

Which of the following is NOT a value type in C#?

1) int

2) double

3) class

4) bool

Answer : class

Which keyword is used to refer to the current instance of a class in C#?

1) this

2) self

3) current

4) None of the above

Answer : this

Which of the following is true about a static constructor in C#?

1) It is called once per class.

2) It can be overloaded.

3) It can have parameters.

4) None of the above

Answer : It is called once per class.

Which of the following is the correct way to create a new thread in C#?

1) Thread t = new Thread(new ThreadStart(MyMethod));

2) Thread t = Thread.Create(MyMethod);

3) Thread t = new MyMethod();

4) None of the above

Answer : Thread t = new Thread(new ThreadStart(MyMethod));

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

1) 2

2) 3

3) 10

4) 0

Answer : 2

Which of the following is used to convert a string to an integer in C#?

1) int.Parse()

2) Convert.ToInt32()

3) Both 1 and 2

4) None of the above

Answer : Both 1 and 2

Which of the following access modifiers makes a member accessible only within its own class in C#?

1) private

2) protected

3) internal

4) public

Answer : private

Which of the following is true about an abstract class in C#?

1) It cannot be instantiated.

2) It can have abstract methods.

3) Both 1 and 2

4) None of the above

Answer : Both 1 and 2

Which of the following is the correct way to declare an interface in C#?

1) public interface IMyInterface {}

2) interface IMyInterface() {}

3) interface IMyInterface : class {}

4) None of the above

Answer : public interface IMyInterface {}

What is the output of Console.WriteLine(20 >> 2);?

1) 5

2) 10

3) 20

4) 40

Answer : 5