Learn C# .Net MCQs
Prepare C# .Net MCQs (Multiple choice Questions) for exam and job interviews.
What does the "override" keyword do in C#?
1) It creates a new method.
2) None of the above
3) It allows a method to override a base class method.
4) It prevents a method from being inherited.
Answer : It allows a method to override a base class method.
Which of the following is a built-in data type in C#?
1) StringBuilder
2) List
3) None of the above
4) string
Answer : string
What is the output of Console.WriteLine(3 + 4 * 2);?
1) Error
2) 11
3) 10
4) None of the above
Answer : 11
Which of the following is used to handle file operations in C#?
1) System.Files
2) None of the above
3) FileHandler
4) System.IO
Answer : System.IO
What is the output of Console.WriteLine("A" == "A");?
1) false
2) Error
3) None of the above
4) true
Answer : true
Which of the following is used to define an interface in C#?
1) None of the above
2) implements
3) abstract
4) interface
Answer : interface
Which of the following is used to convert a string to an integer in C#?
1) StringToInt()
2) Convert.ToInt()
3) int.Parse()
4) None of the above
Answer : int.Parse()
Which of the following is a method of the Console class in C#?
1) Output()
2) WriteLine()
3) Display()
4) None of the above
Answer : WriteLine()
What is the output of Console.WriteLine(Math.Sqrt(16));?
1) Error
2) 4
3) 16
4) None of the above
Answer : 4
Which of the following is a valid way to declare a tuple in C#?
1) None of the above
2) var tuple = new Tuple(1, "text");
3) var tuple = Tuple.Create(1, "text");
4) var tuple = (1, "text");
Answer : var tuple = (1, "text");