Learn C# .Net MCQs
Prepare C# .Net MCQs (Multiple choice Questions) for exam and job interviews.
Which of the following is a feature of an abstract class in C#?
1) It can contain abstract methods.
2) It cannot be instantiated.
3) It can contain constructors.
4) All of the above
Answer : All of the above
What is the output of Console.WriteLine("10".Equals(10));?
1) true
2) false
3) Error
4) None of the above
Answer : false
Which of the following can be used to implement multiple inheritance in C#?
1) Interfaces
2) Abstract classes
3) Class inheritance
4) None of the above
Answer : Interfaces
What is the output of Console.WriteLine(Math.Pow(2, 3));?
1) 8
2) 6
3) Error
4) None of the above
Answer : 8
Which of the following is the correct way to handle exceptions in C#?
1) try { } catch { }
2) try { } finally { }
3) try { } catch (Exception e) { }
4) All of the above
Answer : All of the above
What is the output of Console.WriteLine("A".CompareTo("B"));?
1) -1
2) 0
3) 1
4) Error
Answer : -1
Which of the following is used to create a singleton class in C#?
1) private static instance
2) private constructor
3) static method
4) All of the above
Answer : All of the above
What is the output of Console.WriteLine("abc".Length);?
1) 3
2) 2
3) Error
4) None of the above
Answer : 3
Which of the following can be used to implement a custom attribute in C#?
1) [AttributeUsage(AttributeTargets.Class)]
2) [CustomAttribute()]
3) new CustomAttribute()
4) None of the above
Answer : [AttributeUsage(AttributeTargets.Class)]
What is the output of Console.WriteLine(5 + "5");?
1) 55
2) 10
3) Error
4) None of the above
Answer : 55