Home Subjects C# Programming ASP.NET Basics

C# Programming
ASP.NET Basics

C# and .NET for campus placement

5 Q 4 Topics Take Mock Test
Advertisement
Difficulty: All Easy Medium Hard 1–5 of 5
Topics in C# Programming
Q.1 Hard ASP.NET Basics
A developer needs to create a RESTful API that returns JSON data. Which ASP.NET approach is most suitable?
A ASP.NET Core Web API with [ApiController]
B ASP.NET Web Forms with controls
C Classic ASP with VBScript
D ASP.NET MVC Views only
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.

Test
Q.2 Hard ASP.NET Basics
In ASP.NET Core, which method is used to register services in the dependency injection container?
A services.AddScoped(), services.AddSingleton(), services.AddTransient()
B services.Register()
C services.Inject()
D services.Configure()
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.

Test
Q.3 Hard ASP.NET Basics
An e-commerce application needs to handle concurrent user requests efficiently. Which ASP.NET Core feature is most suitable?
A Async/Await with Task-based operations
B Synchronous request processing
C Single-threaded execution
D Blocking I/O operations
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.

Test
Q.4 Hard ASP.NET Basics
What is the correct order of Page Lifecycle events in ASP.NET Web Forms?
A Init → Load → EventHandling → Render → Unload
B Load → Init → EventHandling → Render → Unload
C Init → Load → Render → EventHandling → Unload
D Load → Init → Render → EventHandling → Unload
Correct Answer:  A. Init → Load → EventHandling → Render → Unload
EXPLANATION

ASP.NET Web Forms lifecycle: Init → Load → Event Handling (ViewState restored) → Render → Unload.

Test
Q.5 Hard ASP.NET Basics
A web application needs to store a user preference that persists across multiple browser sessions. Which state management technique is most appropriate?
A Database with user ID
B ViewState
C Session State
D Application State
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.

Test
IGET
IGET AI
Online · Exam prep assistant
Hi! 👋 I'm your iget AI assistant.

Ask me anything about exam prep, MCQ solutions, study tips, or strategies! 🎯
UPSC strategy SSC CGL syllabus Improve aptitude NEET Biology tips