Learn C# .Net MCQs
Prepare C# .Net MCQs (Multiple choice Questions) for exam and job interviews.
What is the purpose of the "override" keyword in C#?
1) To override a method in a base class.
2) To define an abstract method.
3) To prevent method overriding.
4) None of the above
Answer : To override a method in a base class.
What is the output of Console.WriteLine("abc".ToUpper());?
1) ABC
2) abc
3) Abc
4) None of the above
Answer : ABC
Which of the following is used to define a constructor in C#?
1) void MyClass()
2) MyClass()
3) MyClass constructor()
4) None of the above
Answer : MyClass()
What is the output of Console.WriteLine(10 / 3);?
1) 3
2) 3.33
3) Error
4) None of the above
Answer : 3
Which of the following is a C# reference type?
1) int
2) bool
3) string
4) None of the above
Answer : string
What is the output of Console.WriteLine(5 == 5 ? "Yes" : "No");?
1) Yes
2) No
3) Error
4) None of the above
Answer : Yes
Which of the following is used to define a constant in C#?
1) const
2) static
3) readonly
4) None of the above
Answer : const
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 a method in the Math class in C#?
1) Pow()
2) Sqrt()
3) Round()
4) All of the above
Answer : All of the above
What is the output of Console.WriteLine(5 - 2 + 3);?
1) 6
2) 5
3) 10
4) None of the above
Answer : 6