iGET

C# Programming - MCQ Practice Questions

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

290 questions | 100% Free

Q.181Hard

A web application needs to store a user preference that persists across multiple browser sessions. Which state management technique is most appropriate?

Q.182Hard

What is the correct order of Page Lifecycle events in ASP.NET Web Forms?

Q.183Easy

In ASP.NET Core, what is the purpose of the appsettings.json file?

Q.184Hard

An e-commerce application needs to handle concurrent user requests efficiently. Which ASP.NET Core feature is most suitable?

Q.185Medium

What is Entity Framework in ASP.NET context?

Q.186Hard

In ASP.NET Core, which method is used to register services in the dependency injection container?

Q.187Easy

What does MVC stand for in ASP.NET MVC?

Q.188Hard

A developer needs to create a RESTful API that returns JSON data. Which ASP.NET approach is most suitable?

Q.189Easy

What is the primary purpose of encapsulation in OOP?

Q.190Easy

Which keyword is used to create a class that cannot be instantiated in C#?

Q.191Medium

In a library management system, multiple types of items (Book, Magazine, DVD) share common properties like ID and Title. Which OOP principle should be applied here?

Q.192Medium

What is the difference between 'sealed' and 'abstract' keywords in C#?

Q.193Medium

A vehicle management system requires different vehicle types (Car, Bike, Truck) to calculate toll fees differently. Which feature should be used?

Q.194Easy

In C#, what is the correct syntax to implement multiple interfaces in a class?

Q.195Medium

Which of the following statements about virtual methods in C# is TRUE?

Q.196Medium

A restaurant ordering system needs to ensure each order has a unique ID generated automatically. Which design pattern and feature should be used?

Q.197Medium

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

Q.198Medium

In an inventory management system, a Product class has a Price property. Which approach best ensures price cannot be negative?

Q.199Easy

Which of the following is NOT a pillar of OOP in C#?

Q.200Medium

A student management system implements IComparable<Student> to sort students. Which method must be implemented?