Learn C# .Net MCQs

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

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

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

1) interface

2) struct

3) class

4) None of the above

Answer : interface

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 define a sealed class in C#?

1) sealed

2) final

3) closed

4) None of the above

Answer : sealed

What is the output of Console.WriteLine(Math.Floor(3.8));?

1) 3

2) 4

3) Error

4) None of the above

Answer : 3

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

1) private

2) public

3) protected

4) internal

Answer : private

What is the output of Console.WriteLine("Hello".StartsWith("He"));?

1) true

2) false

3) Error

4) None of the above

Answer : true

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

1) enum

2) enumeration

3) list

4) None of the above

Answer : enum

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

1) It makes the method or field belong to the class.

2) It makes the method or field belong to an instance.

3) It is only used for fields.

4) None of the above

Answer : It makes the method or field belong to the class.

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

1) 3

2) 3.33

3) Error

4) None of the above

Answer : 3