Learn C# .Net MCQs

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

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

1) try-catch

2) throw

3) finally

4) All of the above

Answer : All of the above

What is the output of Console.WriteLine(3 * 2 - 1);?

1) 5

2) 6

3) Error

4) None of the above

Answer : 5

Which of the following is an invalid variable name in C#?

1) myVariable

2) my-variable

3) my_variable

4) None of the above

Answer : my-variable

What is the output of Console.WriteLine("Hello" + " World!");?

1) Hello World!

2) HelloWorld!

3) Error

4) None of the above

Answer : Hello World!

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

1) ArrayList

2) List<T>

3) Dictionary<TKey, TValue>

4) Set<T>

Answer : Set<T>

What is the output of Console.WriteLine(1 + 2 + 3 + "4");?

1) 1234

2) 10

3) Error

4) None of the above

Answer : 1234

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

1) interface

2) abstract

3) class

4) None of the above

Answer : interface

What is the output of Console.WriteLine(10 > 5 && 5 < 10);?

1) true

2) false

3) Error

4) None of the above

Answer : true

Which of the following is a valid way to declare a multi-dimensional array in C#?

1) int[,] arr;

2) int[][] arr;

3) Both a and b

4) None of the above

Answer : Both a and b

What is the output of Console.WriteLine("5" + 5.0);?

1) 55.0

2) 10

3) Error

4) None of the above

Answer : 55.0