Learn C# .Net MCQs
Prepare C# .Net MCQs (Multiple choice Questions) for exam and job interviews.
What is the output of Console.WriteLine(10.0 % 3);?
1) 1
2) 1.0
3) 3
4) Error
Answer : 1
Which of the following keywords is used to create a subclass in C#?
1) extends
2) inherits
3) base
4) None of the above
Answer : None of the above
What is the output of Console.WriteLine("A" + "B");?
1) AB
2) A B
3) Error
4) None of the above
Answer : AB
Which of the following is a valid way to declare a nullable type in C#?
1) int? num;
2) nullable int num;
3) int num = null;
4) None of the above
Answer : int? num;
What is the output of Console.WriteLine(3 + 2 * 4);?
1) 11
2) 14
3) 10
4) Error
Answer : 11
Which of the following is used to define a private field in a class in C#?
1) private int field;
2) int field;
3) protected int field;
4) None of the above
Answer : private int field;
What is the output of Console.WriteLine("5" + 2 * 3);?
1) 53
2) 11
3) Error
4) None of the above
Answer : 53
Which of the following is a reference type in C#?
1) int
2) float
3) string
4) char
Answer : string
What is the output of Console.WriteLine(3.0 / 2);?
1) 1.5
2) 1
3) Error
4) None of the above
Answer : 1.5
Which of the following is NOT a valid access modifier in C#?
1) internal
2) protected
3) private
4) default
Answer : default