.NET Interview Questions for 3–5 Years Experience

A cross-technology set pitched at mid-level .NET developers — deeper C# and CLR, the ASP.NET Core pipeline and DI lifetimes, EF Core internals, SQL tuning and scenario questions.

17 questionsFree · Updated for 2026

By 3–5 years, interviewers expect you to explain mechanisms, not just name them: how the GC decides what to collect, why a captive dependency happens, why a query is slow and how you would prove it. This collection combines the mid-level questions from every technology.

C# & runtime depth

4 questions
01What 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
02How 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
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
04How 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 Core depth

5 questions
05Explain 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
06What 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
07What 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
08Why 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
09What 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

Data depth

5 questions
10What 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
11What 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
12What 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
13How 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
14Can indexes hurt performance?

Yes. Every non-clustered index is extra data that must be updated on every INSERT, UPDATE (of an indexed column) and DELETE, so too many indexes slow writes and increase locking, logging and storage. Indexes…

Read detailed answer

Scenarios

3 questions
15An 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
16You 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
17After 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
Back to the interview hub