.NET Core  

.NET Core & C# Full-Stack Advanced MCQ Pack

Section 1 — C# Advanced Concepts

1. What is the difference between IEnumerable and IQueryable?

A) Both are the same
B) IEnumerable = Linq-to-Objects, IQueryable = Linq-to-SQL ✅
C) IQueryable returns List
D) IEnumerable requires EF Core

2. What keyword prevents method override?

A) static
B) private
C) sealed ✅
D) internal

3. async without await results in

A) Compile error
B) Runtime crash
C) Warning ✅
D) Perfect execution

4. ref vs out keyword difference?

A) ref must be initialized ✅
B) out must be initialized
C) both same
D) none

5. Which is correct for Record type?

A) Mutable class
B) Immutable + value equality ✅
C) Struct type
D) Only for EF

Section 2 — .NET Core & DI

6. Which DI lifetime creates an object ONCE per request?

A) Transient
B) Scoped ✅
C) Singleton
D) Thread

7. Middleware must call:

A) next();
B) Execute();
C) await _next(context); ✅
D) Run();

8. app.UseRouting() must be before:

A) UseEndpoints ✅
B) UseStaticFiles
C) UseCors
D) UseDeveloperException

Section 3 — ASP.NET MVC

9. ViewBag stored as?

A) Session
B) Temp data
C) Dynamic ViewData ✅
D) Cookie

10. MVC order?

A) View→Model→Controller
B) Model→Controller→View ✅
C) Controller→View→Model
D) Route→View→Model

11. Which returns partial view?

A) View()
B) PartialView() ✅
C) Json()
D) RedirectToAction()

Section 4 — Web API

12. Best return type for REST API?

A) string
B) JSON object
C) IActionResult ✅
D) void

13. HTTP 201 means:

A) OK
B) Created ✅
C) No Content
D) Failed

14. For authorization use:

A) [Authorize]
B) [AllowAnonymous]
C) [HttpPost]
D) [ValidateUser]

Section 5 — Entity Framework Core

15. DbSet represents?

A) Single record
B) Table ✅
C) API endpoint
D) Stored procedure

16. Lazy loading requires?

A) Virtual navigation properties ✅
B) Static context
C) No tracking
D) Manual mapping

17. Migration command?

A) dotnet migrate
B) add-migration ✅
C) scaffold-db
D) update-db ✅ (for apply)

Section 6 — SQL for .NET Devs

18. ACID means?

A) Accurate – Correct – Identity – Data
B) Atom – Change – Isolation – Delete
C) Atomicity – Consistency – Isolation – Durability ✅
D) All Cross-Isolation Data

19. Prevent duplicate rows?

A) HAVING
B) PRIMARY KEY ✅
C) JOIN
D) ORDER BY

Section 7 — System Design + Architecture

20. CQRS stands for:

A) Command Query Response Sync
B) Command Query Responsibility Segregation ✅
C) Cloud Query Response Service
D) Core Query Request System

21. SOLID — S stands for?

A) Smart coding
B) Single Responsibility ✅
C) Static class
D) System rule

22. API Gateway does?

A) Hosts DB
B) Authentication & routing ✅
C) Deploy website
D) Cache tables

Section 8 — Cloud & Microservices

23. Container orchestrator?

A) IIS
B) Kubernetes ✅
C) Git
D) Terraform

24. Stateless microservice stores data?

A) Local disk
B) Cache only
C) External DB ✅
D) Registry