C# Programming - MCQ Practice Questions
C# (.NET) MCQs — OOP, collections, LINQ & exception handling.
290 questions | 100% Free
A web application needs to store a user preference that persists across multiple browser sessions. Which state management technique is most appropriate?
What is the correct order of Page Lifecycle events in ASP.NET Web Forms?
In ASP.NET Core, what is the purpose of the appsettings.json file?
An e-commerce application needs to handle concurrent user requests efficiently. Which ASP.NET Core feature is most suitable?
What is Entity Framework in ASP.NET context?
In ASP.NET Core, which method is used to register services in the dependency injection container?
What does MVC stand for in ASP.NET MVC?
A developer needs to create a RESTful API that returns JSON data. Which ASP.NET approach is most suitable?
What is the primary purpose of encapsulation in OOP?
Which keyword is used to create a class that cannot be instantiated in C#?
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?
What is the difference between 'sealed' and 'abstract' keywords in C#?
A vehicle management system requires different vehicle types (Car, Bike, Truck) to calculate toll fees differently. Which feature should be used?
In C#, what is the correct syntax to implement multiple interfaces in a class?
Which of the following statements about virtual methods in C# is TRUE?
A restaurant ordering system needs to ensure each order has a unique ID generated automatically. Which design pattern and feature should be used?
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();
In an inventory management system, a Product class has a Price property. Which approach best ensures price cannot be negative?
Which of the following is NOT a pillar of OOP in C#?
A student management system implements IComparable<Student> to sort students. Which method must be implemented?