Learn C# .Net MCQs
Prepare C# .Net MCQs (Multiple choice Questions) for exam and job interviews.
What is the output of Console.WriteLine(0 == null);?
1) true
2) false
3) Error
4) None of the above
Answer : false
Which of the following is not a valid type of collection in C#?
1) List
2) Queue
3) Stack
4) ArrayList<int>
Answer : ArrayList<int>
What is the output of Console.WriteLine(10 / 3);?
1) 3
2) 3.333
3) 4
4) Error
Answer : 3
Which of the following is a value type in C#?
1) string
2) int
3) ArrayList
4) None of the above
Answer : int
What does the "override" keyword do in C#?
1) Defines a method that is inherited from a base class.
2) Defines a new method.
3) Prevents method overriding.
4) None of the above
Answer : Defines a method that is inherited from a base class.
Which of the following is true about the "ref" keyword in C#?
1) It allows passing parameters by reference.
2) It is used for read-only parameters.
3) It cannot be used with structs.
4) None of the above
Answer : It allows passing parameters by reference.
What is the output of Console.WriteLine(5 + "5");?
1) 55
2) 10
3) Error
4) None of the above
Answer : 55
Which of the following correctly initializes a list in C#?
1) List<int> myList = new List<int>();
2) List myList = new List();
3) ArrayList<int> myList = new ArrayList<int>();
4) None of the above
Answer : List<int> myList = new List<int>();
What is the output of Console.WriteLine("Hello" == "Hello");?
1) true
2) false
3) Error
4) None of the above
Answer : true
Which of the following statements is correct for a C# property?
1) public int MyProperty { get; set; }
2) int MyProperty = 0;
3) public int MyProperty();
4) None of the above
Answer : public int MyProperty { get; set; }