Learn C# .Net MCQs

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

What is the output of Console.WriteLine("Hello"[0]);?

1) Error

2) H

3) None of the above

4) Hello

Answer : H

Which of the following is a feature of OOP in C#?

1) Compilation

2) Execution

3) None of the above

4) Encapsulation

Answer : Encapsulation

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

1) Error

2) 6

3) 33

4) None of the above

Answer : 33

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

1) None of the above

2) get, set;

3) property;

4) get; set;

Answer : get; set;

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

1) false

2) true

3) Error

4) None of the above

Answer : true

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

1) Thread.Close()

2) Thread.Stop()

3) None of the above

4) Thread.Abort()

Answer : Thread.Abort()

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

1) It prevents a class from being instantiated.

2) None of the above

3) It allows only public methods.

4) It prevents a class from being inherited.

Answer : It prevents a class from being inherited.

What is the output of Console.WriteLine(20 <= 20);?

1) true

2) false

3) Error

4) None of the above

Answer : true

Which of the following is used to initialize an array in C#?

1) None of the above

2) new[]

3) create[]

4) init[]

Answer : new[]

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

1) 1

2) Error

3) None of the above

4) 3

Answer : 1