Learn C# .Net MCQs

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

Which of the following is used to specify that a method cannot be overridden?

1) sealed

2) static

3) final

4) None of the above

Answer : sealed

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

1) 3

2) 3.33

3) Error

4) None of the above

Answer : 3

What keyword is used to declare a constant in C#?

1) const

2) readonly

3) static

4) final

Answer : const

Which of the following is used to represent a single character in C#?

1) char

2) string

3) int

4) bool

Answer : char

What is the output of Console.WriteLine(7 + 2 * 3);?

1) 13

2) 16

3) 8

4) Error

Answer : 13

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

1) Dictionary<int, string> dict = new Dictionary<int, string>();

2) var dict = new Dictionary();

3) Dictionary<int> dict;

4) None of the above

Answer : Dictionary<int, string> dict = new Dictionary<int, string>();

What is the default value of a boolean variable in C#?

1) true

2) false

3) null

4) 0

Answer : false

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

1) string

2) int

3) List<T>

4) None of the above

Answer : int

What is the output of Console.WriteLine(5 * 2 / 2);?

1) 5

2) 10

3) 2

4) Error

Answer : 5

What is the purpose of the "override" keyword in C#?

1) To define a base class

2) To override a base class method

3) To define a constructor

4) None of the above

Answer : To override a base class method