.NET Scenario-Based Interview Questions and Answers

Open-ended, real-world .NET interview scenarios — an endpoint slow under load, an intermittent production NullReferenceException, stale data after a save — with a structured way to answer each.

9 questionsFree · Updated for 2026

Scenario questions test how you think, not what you have memorised. Each of these has no single right answer — the interviewer wants a structured approach, the common causes, and how you would confirm which one it is. Answer out loud, working from data.

Performance & load

3 questions
01An 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
02How 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
03What 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

Debugging production

3 questions
04You 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
05What 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
06Why 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

Caching & consistency

3 questions
07After 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
08What 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
09What 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
Back to the interview hub