Learn C# .Net MCQs
Prepare C# .Net MCQs (Multiple choice Questions) for exam and job interviews.
What is the output of Console.WriteLine(10 != 10);?
1) true
2) false
3) Error
4) None of the above
Answer : false
Which of the following is a value type in C#?
1) string
2) int
3) object
4) None of the above
Answer : int
What is the output of Console.WriteLine(5 + 2 * 3);?
1) 11
2) 21
3) 13
4) None of the above
Answer : 11
Which of the following is a correct way to declare a tuple in C#?
1) var tuple = (1, "two");
2) var tuple = new Tuple(1, "two");
3) var tuple = (1; "two");
4) None of the above
Answer : var tuple = (1, "two");
Which of the following statements about structs is true?
1) They are reference types.
2) They can have a default constructor.
3) They are stored on the heap.
4) None of the above
Answer : None of the above
What is the output of Console.WriteLine("abc".ToUpper());?
1) ABC
2) abc
3) Error
4) None of the above
Answer : ABC
Which of the following is used to define a custom exception in C#?
1) public class MyException : Exception {}
2) class MyException : Exception {}
3) MyException : Exception {}
4) None of the above
Answer : public class MyException : Exception {}
What is the output of Console.WriteLine("Hello".StartsWith("H"));?
1) true
2) false
3) Error
4) None of the above
Answer : true
Which of the following is the correct way to call a base class constructor in C#?
1) base();
2) base();
3) this();
4) None of the above
Answer : base();
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