All interview guides

ASP.NET Core Interview Questions and Answers

24 questions that come up in ASP.NET Core technical interviews, each with the answer and an explanation of why it is right.

Test yourself — 90 question bank

1. What is Entity Framework Core?

Intermediate

Answer: ORM for data access with object-to-database mapping

Entity Framework Core is an ORM (Object-Relational Mapper) that enables .NET developers to work with databases using .NET objects.

2. What is ASP.NET Core?

Beginner

Answer: Cross-platform, high-performance framework for building web apps

ASP.NET Core is a cross-platform, open-source framework for building modern web applications and APIs. It runs on Windows, Linux, and macOS.

3. What is SignalR?

Advanced

Answer: Real-time communication library for web sockets

SignalR enables real-time, bi-directional communication. Uses WebSockets when available, falls back to other transports. Use for chat, notifications, dashboards.

4. What is DbContext?

Intermediate

Answer: Session with database enabling queries and saves

DbContext represents a session with the database. It allows querying and saving data. Configure entity mappings and database connection.

5. What is the difference between ASP.NET and ASP.NET Core?

Beginner

Answer: ASP.NET Core is cross-platform and modular

ASP.NET Core is cross-platform (Windows, Linux, macOS), modular, open-source, and high-performance. ASP.NET Framework is Windows-only and monolithic.

6. What is gRPC?

Advanced

Answer: High-performance RPC framework using HTTP/2

gRPC is high-performance RPC framework using HTTP/2 and Protocol Buffers. Faster than REST. Use for microservice communication.

7. What is a migration?

Intermediate

Answer: Version control for database schema changes

Migrations provide version control for database schema. Create with Add-Migration, apply with Update-Database. Tracks schema changes over time.

8. What is MVC in ASP.NET Core?

Beginner

Answer: Model-View-Controller architectural pattern

MVC (Model-View-Controller) separates application into three components: Models (data), Views (UI), Controllers (logic). Promotes separation of concerns.

9. What is Blazor?

Advanced

Answer: Framework for building interactive web UIs with C#

Blazor builds interactive web UIs using C# instead of JavaScript. Blazor Server (server-side) or Blazor WebAssembly (client-side). Shares code with backend.

10. What is a Controller?

Beginner

Answer: Handles requests and returns responses

Controllers handle incoming HTTP requests, process them (often interacting with models), and return responses (usually views or data).

11. What is validation in ASP.NET Core?

Intermediate

Answer: Ensures data meets requirements before processing

Validation ensures data meets requirements. Use data annotations ([Required], [StringLength]) or FluentValidation. Automatic with model binding.

12. What is distributed caching?

Advanced

Answer: Caching shared across multiple servers

Distributed caching shares cache across multiple servers. Use Redis or SQL Server. Essential for load-balanced applications. Configure with IDistributedCache.

13. What is a View?

Beginner

Answer: Presentation layer rendering HTML

Views are responsible for presenting data to users. They contain HTML markup with embedded Razor syntax for dynamic content.

14. What is memory caching?

Advanced

Answer: In-memory caching for single server performance

Memory caching stores data in server memory. Fast but not shared across servers. Use IMemoryCache. Good for single-server or data that can differ.

15. What is ModelState?

Intermediate

Answer: Dictionary containing validation errors and values

ModelState contains model binding values and validation errors. Check ModelState.IsValid before processing. Display errors with validation tag helpers.

16. What is response compression?

Advanced

Answer: Compresses responses to reduce bandwidth

Response compression compresses HTTP responses (gzip, brotli). Reduces bandwidth, improves load times. Configure with AddResponseCompression().

17. What is authentication?

Intermediate

Answer: Verifying user identity

Authentication verifies who the user is. ASP.NET Core supports various schemes: Cookies, JWT, OAuth2, OpenID Connect, Windows, Certificate.

18. What is Razor syntax?

Beginner

Answer: Markup syntax combining C# and HTML

Razor is a markup syntax for embedding C# code into HTML. Uses @ symbol to transition between HTML and C#. Example: @Model.Name.

19. What is authorization?

Intermediate

Answer: Determines what authenticated user can access

Authorization determines what an authenticated user can do. Use [Authorize] attribute, policies, role-based or claims-based authorization.

20. What is rate limiting?

Advanced

Answer: Limits request rate to prevent abuse

Rate limiting restricts number of requests per time period. Prevents abuse, DDoS. Use AspNetCoreRateLimit package or built-in (.NET 7+).

21. What is the repository pattern?

Advanced

Answer: Abstracts data access layer for testability

Repository pattern abstracts data access layer. Provides interface for data operations. Improves testability and decouples business logic from data access.

22. What is the [Authorize] attribute?

Intermediate

Answer: Restricts access to authenticated users

[Authorize] restricts access to authenticated users. Apply to controllers or actions. Can specify roles or policies: [Authorize(Roles = "Admin")].

23. What is Razor Pages?

Beginner

Answer: Page-focused framework alternative to MVC

Razor Pages is a page-focused framework that makes building web UI easier and more productive. Simpler than MVC for page-based scenarios.

24. What is the unit of work pattern?

Advanced

Answer: Maintains list of objects and coordinates persistence

Unit of Work maintains list of affected objects and coordinates writing changes as one transaction. Often used with Repository pattern.

Ready to test yourself?

The full ASP.NET Core bank has 90 questions across 3 difficulty levels — timed, shuffled, and scored.

Take the ASP.NET Core quiz