iGET

C# Programming - MCQ Practice Questions

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

290 questions | 100% Free

Q.61Medium

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

Q.62Medium

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

Q.63Medium

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

Q.64Medium

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

Q.65Medium

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

Q.66Medium

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

Q.67Medium

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

Q.68Medium

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

Q.69Medium

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

Q.70Medium

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

Q.71Medium

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

Q.72Medium

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

Q.73Medium

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

Q.74Medium

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

Q.75Medium

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

Q.76Medium

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

Q.77Medium

What is the output of the following code? class Animal { public virtual void Sound() { Console.WriteLine("Generic Sound"); } } class Dog : Animal { public override void Sound() { Console.WriteLine("Bark"); } } Dog dog = new Dog(); dog.Sound();

Q.78Medium

An abstract class Shape has an abstract method CalculateArea(). Which statement is true?

Q.79Medium

In C#, what is the difference between 'is' and 'as' operators?

Q.80Medium

In C# 13+ (projected features), nullable reference types help prevent which type of error?