Learn C# .Net MCQs

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

What is the output of Console.WriteLine(3 != 3);?

1) True

2) False

3) Error

4) None of the above

Answer : False

Which of the following is used to implement a single line comment in C#?

1) //

2) /*

3) #

4) None of the above

Answer : //

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

1) 33

2) Error

3) 6

4) None of the above

Answer : 33

What is the output of Console.WriteLine(Math.Max(5, 10));?

1) 5

2) 10

3) 15

4) None of the above

Answer : 10

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

1) Thread.Start()

2) Thread.Begin()

3) Thread.New()

4) None of the above

Answer : Thread.Start()

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

1) 3

2) 3.333

3) Error

4) None of the above

Answer : 3.333

What is the correct way to declare a nullable type in C#?

1) int?

2) nullable int

3) int!

4) None of the above

Answer : int?

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

1) 5

2) Error

3) Hello

4) None of the above

Answer : 5

Which of the following is a type of loop in C#?

1) for

2) while

3) do-while

4) All of the above

Answer : All of the above

What does the "default" keyword do in C#?

1) Assigns default values to variables.

2) None of the above

3) Declares a method as default.

4) Defines default values for a type.

Answer : Defines default values for a type.