Learn C# .Net MCQs
Prepare C# .Net MCQs (Multiple choice Questions) for exam and job interviews.
What is the output of Console.WriteLine(2 + "2");?
1) 22
2) 4
3) Error
4) None of the above
Answer : 22
Which of the following is NOT a looping structure in C#?
1) for
2) foreach
3) do-while
4) if
Answer : if
What is the output of Console.WriteLine("1" == 1);?
1) true
2) false
3) Error
4) None of the above
Answer : false
Which of the following is used to define a generic class in C#?
1) class MyClass<T> { }
2) class MyClass { T }
3) class MyClass<T>() { }
4) None of the above
Answer : class MyClass<T> { }
What is the output of Console.WriteLine("A" == "a");?
1) true
2) false
3) Error
4) None of the above
Answer : false
What does the "override" keyword do in C#?
1) It hides the base class method
2) It creates a new method
3) It changes the access level
4) It modifies a method in the base class
Answer : It modifies a method in the base class
Which of the following can be used to convert a string to an integer in C#?
1) Convert.ToInt32()
2) int.Parse()
3) Both a and b
4) None of the above
Answer : Both a and b
What is the output of Console.WriteLine(5 != 5);?
1) true
2) false
3) Error
4) None of the above
Answer : false
Which of the following is used to catch exceptions in C#?
1) catch
2) try
3) finally
4) All of the above
Answer : All of the above
Which of the following is a reference type in C#?
1) int
2) double
3) string
4) char
Answer : string