iGET

C# Programming - MCQ Practice Questions

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

290 questions | 100% Free

Q.1Medium

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.2Medium

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

Q.3Medium

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

Q.4Medium

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

Q.5Medium

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

Q.6Medium

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

Q.7Medium

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

Q.8Medium

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

Q.9Medium

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

Q.10Medium

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

Q.11Medium

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

Q.12Medium

What will be the behavior if a base class method is not marked as 'virtual' and a derived class attempts to override it?

Q.13Medium

Which statement about record types in C# 9+ is correct?

Q.14Medium

In C#, what is the correct way to implement explicit interface implementation?

Q.15Medium

In C#, what is the relationship between composition and inheritance in OOP design?

Q.16Medium

In C# 11, which feature enables you to define constraints on generic type parameters at compile-time?

Q.17Medium

What does the 'virtual' keyword enable in C#?

Q.18Medium

Consider a BankAccount class with private balance field. How should external classes access this field safely?

Q.19Medium

A developer creates a class Library and another class Book. The Library class contains multiple Book objects. What is this relationship called?

Q.20Medium

In C# 9+, which feature allows you to create immutable reference types?