iGET

C# Programming - MCQ Practice Questions

C# (.NET) MCQs — OOP, collections, LINQ & exception handling.

290 questions | 100% Free

Q.1Easy

In C#, what is the default access modifier for class members?

Q.2Easy

Which keyword is used to create a derived class in C#?

Q.3Medium

What will be the output of the following code? class A { public virtual void Show() { Console.WriteLine("A"); } } class B : A { public override void Show() { Console.WriteLine("B"); } } A obj = new B(); obj.Show();

Q.4Medium

What is the difference between 'new' keyword and 'override' keyword in C#?

Q.5Medium

In C#, which interface is used to implement custom iteration logic?

Q.6Easy

In C#, can a class inherit from multiple classes?

Q.7Hard

What is the output of the following? class A { public void Test() { Console.WriteLine("A"); } } class B : A { public new void Test() { Console.WriteLine("B"); } } A a = new B(); a.Test();

Q.8Medium

Which of the following is true about properties in C#?

Q.9Medium

What is the purpose of the 'sealed' keyword in C#?

Q.10Hard

Consider the following code. What will be the output? interface I1 { void Show(); } interface I2 { void Show(); } class C : I1, I2 { public void Show() { Console.WriteLine("C"); } } C obj = new C(); obj.Show();

Q.11Medium

In C#, what is the difference between a class and a struct?

Q.12Hard

What will happen if you try to override a non-virtual method?

Q.13Medium

Which of the following represents proper use of constructor chaining in C#?

Q.14Hard

What is the output of the following code? class Base { public virtual void Method() { Console.WriteLine("Base"); } } class Derived : Base { public override void Method() { base.Method(); Console.WriteLine("Derived"); } } Derived d = new Derived(); d.Method();

Q.15Medium

In C# 2024-25, which feature allows defining read-only properties with automatic backing fields?

Q.16Medium

In C# 11, which feature allows you to define required members in a class?

Q.17Medium

What is the output when you access a property marked with 'init' accessor after object initialization in C#?

Q.18Easy

Which of the following correctly demonstrates an abstract class with an abstract method in C#?

Q.19Hard

In C#, what happens when you apply the 'static' modifier to a method inside an interface (C# 11+)?

Q.20Medium

What is the primary difference between method overloading and method overriding in C#?