Govt. Exams
Entrance Exams
Advertisement
Topics in C# Programming
A developer needs to create a RESTful API that returns JSON data. Which ASP.NET approach is most suitable?
Correct Answer:
A. ASP.NET Core Web API with [ApiController]
EXPLANATION
ASP.NET Core Web API with [ApiController] attribute is the modern approach for building RESTful APIs that return JSON.
In ASP.NET Core, which method is used to register services in the dependency injection container?
Correct Answer:
A. services.AddScoped(), services.AddSingleton(), services.AddTransient()
EXPLANATION
AddScoped, AddSingleton, and AddTransient are methods to register services with different lifetimes in ASP.NET Core DI.
An e-commerce application needs to handle concurrent user requests efficiently. Which ASP.NET Core feature is most suitable?
Correct Answer:
A. Async/Await with Task-based operations
EXPLANATION
Async/Await enables non-blocking I/O operations, allowing ASP.NET Core to handle more concurrent requests efficiently.
What is the correct order of Page Lifecycle events in ASP.NET Web Forms?
Correct Answer:
A. Init → Load → EventHandling → Render → Unload
EXPLANATION
ASP.NET Web Forms lifecycle: Init → Load → Event Handling (ViewState restored) → Render → Unload.
A web application needs to store a user preference that persists across multiple browser sessions. Which state management technique is most appropriate?
Correct Answer:
A. Database with user ID
EXPLANATION
For persistent data across multiple sessions, database storage is the best approach. Session State is temporary and Application State is server-wide.