Learn C# .Net MCQs
Prepare C# .Net MCQs (Multiple choice Questions) for exam and job interviews.
What is the output of Console.WriteLine(Math.Max(10, 20));?
1) 20
2) 10
3) Error
4) None of the above
Answer : 20
Which of the following is used to sort a list in C#?
1) Sort()
2) Arrange()
3) Order()
4) None of the above
Answer : Sort()
Which of the following is true about constructors in C#?
1) They are called when an object is created.
2) They are called when a method is invoked.
3) They can return a value.
4) None of the above
Answer : They are called when an object is created.
What is the output of Console.WriteLine(10 == 10);?
1) true
2) false
3) Error
4) None of the above
Answer : true
Which of the following is used to convert a string to uppercase in C#?
1) ToUpper()
2) Upper()
3) ToUpperCase()
4) None of the above
Answer : ToUpper()
Which of the following is used to initialize a dictionary in C#?
1) new Dictionary()
2) create Dictionary()
3) init Dictionary()
4) None of the above
Answer : new Dictionary()
What is the output of Console.WriteLine(Math.Ceiling(4.1));?
1) 5
2) 4
3) Error
4) None of the above
Answer : 5
Which of the following is true about the "virtual" keyword in C#?
1) It allows method overriding.
2) It is used for constructors.
3) It allows multiple inheritances.
4) None of the above
Answer : It allows method overriding.
What is the output of Console.WriteLine(100 % 7);?
1) 2
2) 3
3) 0
4) None of the above
Answer : 2
Which of the following is used to declare a constant in C#?
1) const
2) readonly
3) static
4) None of the above
Answer : const