A web application needs to store a user preference that persists across multiple browser sessions. Which state management technique is most appropriate?
Answer: A
For persistent data across multiple sessions, database storage is the best approach. Session State is temporary and Application State is server-wide.
Q.182Hard
What is the correct order of Page Lifecycle events in ASP.NET Web Forms?
Answer: A
ASP.NET Web Forms lifecycle: Init → Load → Event Handling (ViewState restored) → Render → Unload.
Q.183Easy
In ASP.NET Core, what is the purpose of the appsettings.json file?
Answer: A
appsettings.json stores application configuration like connection strings, logging levels, and custom settings.
Q.184Hard
An e-commerce application needs to handle concurrent user requests efficiently. Which ASP.NET Core feature is most suitable?
Answer: A
Async/Await enables non-blocking I/O operations, allowing ASP.NET Core to handle more concurrent requests efficiently.
Q.185Medium
What is Entity Framework in ASP.NET context?
Answer: A
Entity Framework is Microsoft's ORM that allows developers to work with databases using .NET objects instead of raw SQL.
Advertisement
Q.186Hard
In ASP.NET Core, which method is used to register services in the dependency injection container?
Answer: A
AddScoped, AddSingleton, and AddTransient are methods to register services with different lifetimes in ASP.NET Core DI.
Q.187Easy
What does MVC stand for in ASP.NET MVC?
Answer: A
MVC (Model-View-Controller) is an architectural pattern separating data (Model), presentation (View), and business logic (Controller).
Q.188Hard
A developer needs to create a RESTful API that returns JSON data. Which ASP.NET approach is most suitable?
Answer: A
ASP.NET Core Web API with [ApiController] attribute is the modern approach for building RESTful APIs that return JSON.
Q.189Easy
What is the primary purpose of encapsulation in OOP?
Answer: B
Encapsulation bundles data and methods together, hiding internal implementation and controlling access through public interfaces, improving maintainability and security.
Q.190Easy
Which keyword is used to create a class that cannot be instantiated in C#?
Answer: B
The 'abstract' keyword prevents instantiation of a class and forces derived classes to implement abstract members, establishing a contract for subclasses.
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?
Answer: B
Inheritance allows creating a base class (LibraryItem) with common properties, and derived classes can inherit these properties, reducing code duplication.
Q.192Medium
What is the difference between 'sealed' and 'abstract' keywords in C#?
Answer: A
sealed prevents a class from being inherited, while abstract requires derived classes to implement its abstract members. They serve opposite purposes.
Q.193Medium
A vehicle management system requires different vehicle types (Car, Bike, Truck) to calculate toll fees differently. Which feature should be used?
Answer: C
Polymorphism through inheritance allows each vehicle type to override the toll calculation method with its own implementation, enabling different behavior for each type.
Q.194Easy
In C#, what is the correct syntax to implement multiple interfaces in a class?
Answer: A
C# uses colon (:) to implement interfaces, and multiple interfaces are separated by commas. The 'implements' keyword is used in Java, not C#.
Q.195Medium
Which of the following statements about virtual methods in C# is TRUE?
Answer: B
Virtual methods are designed to be overridden by derived classes, enabling polymorphic behavior and runtime method resolution.
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?
Answer: A
Static variables are shared across all instances and can be used to generate unique IDs automatically without modifying external data.
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();
Answer: B
Due to polymorphism, the overridden method in Dog class is called at runtime, printing 'Bark' even though the reference type is Animal.
Q.198Medium
In an inventory management system, a Product class has a Price property. Which approach best ensures price cannot be negative?
Answer: B
Properties with private backing fields allow validation in setters, ensuring data integrity by preventing invalid values like negative prices.
Q.199Easy
Which of the following is NOT a pillar of OOP in C#?
Answer: D
The four pillars of OOP are Inheritance, Polymorphism, Encapsulation, and Abstraction. Compilation is a language feature, not an OOP principle.
Q.200Medium
A student management system implements IComparable<Student> to sort students. Which method must be implemented?
Answer: B
IComparable<T> interface requires implementation of CompareTo method to define comparison logic between objects of the same type.