Top 100 .NET Developer Interview Questions and Answers

The core .NET interview questions grouped by category — C#, OOP, the CLR, ASP.NET MVC, ASP.NET Core, Web API, Entity Framework, SQL Server and scenario questions — each with a real answer, not just a link.

51 questionsFree · Updated for 2026

This is Prismita's flagship collection: the questions that come up again and again in .NET developer interviews, grouped the way an interview actually flows — language first, then the runtime, then the web stack, then data, then scenarios. Every entry has a short answer here and links to the full explanation with a code example and the interviewer's likely follow-up questions.

It is a curated set that grows over time rather than a padded list of 100 near-duplicate links. Work top to bottom to prepare broadly, or jump to the section you are weakest on.

C# language

10 questions
01What is C#?

C# is a modern, statically typed, object-oriented (and increasingly functional) programming language from Microsoft. It compiles to Intermediate Language (IL) that runs on the .NET runtime (the CLR), which…

Read detailed answer
02What is the difference between a value type and a reference type?

A value type (struct, enum, int, bool, DateTime) holds its data directly; assigning or passing it copies the value. A reference type (class, interface, array, delegate, string) holds a reference to an object…

Read detailed answer
03What is boxing and unboxing in C#?

Boxing is wrapping a value type in an object (or interface) reference so it can live on the heap — it happens implicitly when you assign an int to an object. Unboxing is the explicit cast back to the value…

Read detailed answer
04What is the difference between an abstract class and an interface?

An abstract class is a base class you can't instantiate; it can hold state (fields), constructors, and a mix of implemented and abstract members, and a class can inherit only one. An interface is a contract —…

Read detailed answer
05What are delegates in C#?

A delegate is a type-safe reference to a method — effectively a function pointer with a signature. You can store methods in delegate variables, pass them as arguments, and invoke them later. Func<>, Action<>…

Read detailed answer
06What is LINQ in C#?

LINQ (Language-Integrated Query) is a uniform way to query data — in-memory collections, databases, XML, JSON — using C# operators like Where, Select, OrderBy, GroupBy and Join, in either method syntax or…

Read detailed answer
07What is the difference between IEnumerable and IQueryable?

IEnumerable<T> represents an in-memory sequence; LINQ operators run as compiled delegates and iterate objects client-side. IQueryable<T> represents a query against a remote provider (e.g. a database); LINQ…

Read detailed answer
08How do async and await work in C#?

async/await let you write non-blocking asynchronous code that reads sequentially. await on an incomplete Task returns control to the caller and registers a continuation; when the awaited operation finishes,…

Read detailed answer
09What is the difference between ref and out parameters?

Both pass an argument by reference so the method can modify the caller's variable. ref requires the variable to be initialised before the call and the method may read it. out does not require initialisation…

Read detailed answer
10What is the difference between string and StringBuilder?

string is immutable — every concatenation or modification allocates a new string object. StringBuilder is a mutable buffer; appends modify it in place (growing an internal array as needed). Use StringBuilder…

Read detailed answer

.NET runtime & CLR

3 questions
11What is the CLR (Common Language Runtime)?

The CLR is the execution engine for .NET. It loads assemblies, JIT-compiles Intermediate Language (IL) to native machine code, enforces type safety, manages memory with the garbage collector, and provides…

Read detailed answer
12What is the difference between managed and unmanaged code?

Managed code runs under the CLR, which handles memory, type safety and exceptions — normal C#/.NET code. Unmanaged code runs directly on the OS with no CLR services — C/C++ libraries, COM components, OS…

Read detailed answer
13How does garbage collection work in .NET?

The .NET GC is a generational, mark-and-compact collector. New objects go in Gen 0; objects that survive a collection are promoted to Gen 1, then Gen 2. Most collections are small, fast Gen 0 sweeps. The GC…

Read detailed answer

ASP.NET MVC

7 questions
14What is ASP.NET MVC?

ASP.NET MVC is a web framework that implements the Model-View-Controller pattern. A controller handles the request, works with the model (the data and business logic), and returns a view (the HTML). It gives…

Read detailed answer
15Explain the ASP.NET MVC request life cycle.

The request is matched by routing to a controller and action, the controller factory creates the controller, the action invoker runs authorization and action filters, performs model binding and validation,…

Read detailed answer
16What is routing in ASP.NET MVC?

Routing is the system that maps an incoming URL to a controller action, and (in reverse) generates URLs for a given action. You define routes either by convention (a pattern like {controller}/{action}/{id?})…

Read detailed answer
17What is ActionResult in ASP.NET MVC?

ActionResult is the base type for what a controller action returns. It represents a deferred command — “render this view”, “return this JSON”, “redirect there”, “send a 404” — that the framework executes…

Read detailed answer
18What is the difference between ViewBag, ViewData and TempData?

ViewData is a string-keyed dictionary (ViewDataDictionary) for passing data from a controller to its view, valid for the current request only. ViewBag is a dynamic wrapper over the same dictionary — nicer…

Read detailed answer
19What is a strongly typed view in ASP.NET MVC?

A strongly typed view declares the model type it expects with @model at the top. Inside, Model is that type, so you get IntelliSense, compile-time checking and strongly typed HTML/tag helpers like…

Read detailed answer
20How does model validation work in ASP.NET MVC?

You annotate the model with validation attributes ([Required], [StringLength], [Range], [EmailAddress]…). During model binding the framework runs those rules and records failures in ModelState. Your action…

Read detailed answer

ASP.NET Core

8 questions
21What is ASP.NET Core?

ASP.NET Core is a free, open-source, cross-platform framework for building web apps, APIs and real-time services on .NET. It is a ground-up rewrite of ASP.NET that runs on Windows, Linux and macOS, is modular…

Read detailed answer
22What is the difference between ASP.NET MVC and ASP.NET Core?

ASP.NET MVC 5 runs only on the Windows .NET Framework, is hosted in IIS through System.Web, and needs third-party libraries for dependency injection. ASP.NET Core is cross-platform, self-hosted through…

Read detailed answer
23What is middleware in ASP.NET Core?

Middleware is a component that sits in the request pipeline. Each piece of middleware receives the HttpContext, can do work before and after the rest of the pipeline, and then either calls next() to pass the…

Read detailed answer
24Explain the ASP.NET Core request pipeline.

A request enters through Kestrel, is handed to the middleware pipeline as an HttpContext, and passes through each middleware in registration order — exception handling, HTTPS redirection, static files,…

Read detailed answer
25What is Kestrel in ASP.NET Core?

Kestrel is the default, cross-platform web server built into ASP.NET Core. It is a fast, lightweight HTTP server that listens for requests and hands them to your app's middleware pipeline. In production it is…

Read detailed answer
26What is Dependency Injection in ASP.NET Core?

Dependency Injection (DI) is a design technique where a class receives the objects it depends on from the outside — usually through its constructor — instead of creating them itself. ASP.NET Core has a…

Read detailed answer
27What are service lifetimes in ASP.NET Core?

A service lifetime controls how long the container keeps and reuses an instance. There are three: Transient — a new instance every time it is requested; Scoped — one instance per request (per DI scope);…

Read detailed answer
28What is the difference between Transient, Scoped and Singleton?

Transient: new instance on every injection — most short-lived. Scoped: one instance per request, shared within that request. Singleton: one instance for the app's entire lifetime, shared by every request and…

Read detailed answer

Web API

5 questions
29What is a RESTful API?

A RESTful API models the system as resources identified by URLs, manipulated with standard HTTP verbs (GET, POST, PUT, PATCH, DELETE), returning appropriate status codes and representations (usually JSON). It…

Read detailed answer
30What is the difference between GET, POST, PUT, PATCH and DELETE?

GET reads a resource (safe, idempotent, cacheable). POST creates a resource or triggers processing (not idempotent). PUT replaces a resource entirely at a known URL (idempotent). PATCH applies a partial…

Read detailed answer
31What is the difference between a Web API controller and an MVC controller?

An MVC controller derives from Controller and typically returns a view (HTML) via view/model. A Web API controller derives from ControllerBase, is marked [ApiController], and returns data that is serialised…

Read detailed answer
32How do you version a Web API?

Pick one scheme and be consistent: URL path (/api/v2/orders) — most visible and cache-friendly; query string (?api-version=2.0); header (api-version: 2.0) — keeps URLs clean; or media type (Accept:…

Read detailed answer
33What are filters in ASP.NET Core MVC/Web API?

Filters run code at specific stages of the MVC action pipeline, inside model binding and routing. The types, in order: Authorization → Resource → Action (before/after the action) → Exception → Result…

Read detailed answer

Entity Framework

5 questions
34What is Entity Framework Core?

Entity Framework Core is Microsoft's lightweight, cross-platform object-relational mapper (ORM) for .NET. It lets you work with a database using C# classes and LINQ instead of hand-written SQL: DbContext…

Read detailed answer
35What is the difference between Code First and Database First?

Code First: you write the C# entity classes and configuration, and EF generates the database schema through migrations. Database First: the database already exists and you scaffold (reverse-engineer) the…

Read detailed answer
36What is the difference between lazy loading, eager loading and explicit loading?

Eager loading pulls related data in the same query using Include(). Lazy loading fetches a navigation property automatically the first time you access it — convenient but the classic cause of the N+1 query…

Read detailed answer
37What is change tracking in EF Core?

Change tracking is how EF Core knows what to save. When you query with tracking (the default), the context keeps a snapshot of each entity and assigns it a state — Unchanged, Added, Modified, Deleted. On…

Read detailed answer
38What is a migration in EF Core?

A migration is a versioned, code-generated description of a schema change. When you change your entity model, dotnet ef migrations add <Name> diffs the model against the last migration and writes Up()/Down()…

Read detailed answer

SQL Server

8 questions
39What is an index in SQL Server?

An index is an on-disk structure (a B-tree) that lets SQL Server find rows without scanning the whole table. It stores the indexed column values in sorted order with pointers to the matching rows, so lookups,…

Read detailed answer
40What is the difference between a clustered and a non-clustered index?

A clustered index determines the physical order of the rows in the table — the leaf level of the index is the table data — so there can be only one. A non-clustered index is a separate structure; its leaf…

Read detailed answer
41What is the difference between an INNER JOIN and a LEFT JOIN?

An INNER JOIN returns only rows that have a match in both tables. A LEFT JOIN (left outer join) returns every row from the left table, plus matching columns from the right table where they exist and NULLs…

Read detailed answer
42What is an execution plan in SQL Server?

An execution plan is the set of physical operations the query optimiser chose to run a query — which indexes to use, in what order to join tables, whether to seek or scan, how to sort and aggregate. The…

Read detailed answer
43How do you optimise a slow SQL query?

Measure first: capture the actual execution plan and STATISTICS IO/TIME. Then look for the usual culprits — a scan where a seek should happen (missing or unusable index), non-sargable predicates (functions on…

Read detailed answer
44What is a transaction and what does ACID mean?

A transaction is a unit of work that either fully completes or has no effect. ACID is the set of guarantees: Atomicity (all-or-nothing), Consistency (constraints hold before and after), Isolation (concurrent…

Read detailed answer
45What is the difference between DELETE, TRUNCATE and DROP?

DELETE is DML: removes rows (optionally with a WHERE), logs each row, fires triggers, keeps the table and can be rolled back. TRUNCATE is DDL: removes all rows by deallocating pages, minimally logged, very…

Read detailed answer
46What is a stored procedure and when would you use one?

A stored procedure is a named, precompiled batch of T-SQL saved in the database that you call with EXEC, optionally passing parameters. It centralises data logic, is parameterised (so it resists SQL…

Read detailed answer

Scenario & debugging

5 questions
47An API endpoint is fast in testing but slow under production load. How do you investigate?

Reproduce with realistic concurrency, then use data — server metrics (CPU, memory, GC, thread-pool queue), request tracing/APM, and the database's own view (slow query log, wait stats). The usual causes:…

Read detailed answer
48You get an intermittent NullReferenceException in production that you can't reproduce locally. How do you approach it?

Get the exact stack trace and a correlation ID from structured logging, and identify the line and the reference that's null. “Intermittent” and “only in production” usually points to concurrency (a…

Read detailed answer
49After a successful save, some users still see the old data for a while. What could cause this?

Something between the write and that user's read is serving an older version: an application or output cache that wasn't invalidated, a long-lived DbContext returning tracked (pre-update) entities, HTTP/CDN…

Read detailed answer
50What is a captive dependency?

A captive dependency is when a longer-lived service holds a reference to a shorter-lived one, “capturing” it and keeping it alive far longer than intended. The classic case is a Singleton that injects a…

Read detailed answer
51Why is DbContext registered as Scoped?

DbContext is registered as Scoped because it is a lightweight, stateful, not thread-safe unit-of-work. One instance per request lets every repository and service in that request share the same change tracker…

Read detailed answer
Back to the interview hub