Learn C# .Net MCQs
Prepare C# .Net MCQs (Multiple choice Questions) for exam and job interviews.
What is the output of Console.WriteLine(15 & 7);?
1) 5
2) 15
3) 7
4) None of the above
Answer : 7
Which of the following is used to prevent a class from being inherited in C#?
1) sealed
2) abstract
3) static
4) None of the above
Answer : sealed
What is the output of Console.WriteLine(15 >> 1);?
1) 7
2) 15
3) 8
4) None of the above
Answer : 7
Which of the following is true about a constructor in C#?
1) It is called when an object is created.
2) It can have parameters.
3) Both 1 and 2
4) None of the above
Answer : Both 1 and 2
What is the output of Console.WriteLine(20 << 2);?
1) 80
2) 40
3) 20
4) None of the above
Answer : 80
Which of the following is used to check if an object is of a certain type in C#?
1) is
2) typeof
3) as
4) None of the above
Answer : is
Which of the following is used to convert an object to a string in C#?
1) ToString()
2) Parse()
3) Convert()
4) None of the above
Answer : ToString()
What is the output of Console.WriteLine(5 % 2);?
1) 1
2) 2
3) 0
4) None of the above
Answer : 1
Which keyword is used to define a constant in C#?
1) const
2) readonly
3) final
4) static
Answer : const
Which of the following is used to compare two objects in C#?
1) Equals()
2) Compare()
3) CompareTo()
4) None of the above
Answer : Equals()