C# and .NET Interview Questions for Backend Engineers: CLR, Async/Await, LINQ, and ASP.NET Core
Quick Overview
Prepare for C# and .NET backend interviews with production-focused questions on the CLR, garbage collection, async/await, LINQ, ASP.NET Core, EF Core, and diagnostics.
C# and .NET interview questions for backend engineers test whether you can connect language features to runtime behavior and production consequences. Strong candidates explain what the CLR manages, how asynchronous work affects scalability, when LINQ executes locally or through a provider, and why ASP.NET Core pipeline order changes correctness.
This guide uses the supported .NET 10 LTS line as its current reference point while keeping the questions useful across .NET releases. Practice the scenarios in PracHub's Backend Engineer question bank, then answer with assumptions, failure modes, and a verification plan. PracHub question records are practice material, not predictions of your exact assessment or interview.

What .NET backend interviewers are actually testing
The core signal is not API recall. It is whether you can cross the boundary from C# source code to the runtime, operating system, database, and HTTP request. A concise answer should name the mechanism, identify the cost or failure mode, and say what evidence would confirm it.
| Area | Baseline knowledge | Strong interview signal |
|---|---|---|
| CLR | CIL, metadata, JIT, managed code | Distinguishes language rules from runtime implementation and Native AOT |
| Memory | Generational GC, roots, disposal | Separates managed reachability from deterministic resource cleanup |
| Async | Task, await, cancellation | Explains I/O versus CPU work, blocking, and end-to-end propagation |
| LINQ | Deferred execution and operators | Knows when delegates run locally and expression trees reach a provider |
| ASP.NET Core | Middleware and DI | Reasons about order, short-circuiting, scopes, and thread safety |
| Data and operations | EF Core and diagnostics | Connects query shape and context lifetime to metrics, traces, and dumps |
CLR and managed execution interview questions
What happens between compiling C# and executing a method?
C# normally compiles to Common Intermediate Language plus metadata in a portable executable assembly. The CLR loads the metadata, resolves types and members, and typically JIT-compiles a method to native machine code when it is needed. The runtime also provides services such as garbage collection, exception handling, type safety, debugging, and profiling. The CLR overview is the authoritative baseline.
A stronger answer adds two qualifications. Tiered compilation can replace quickly generated code with optimized code. Native AOT compiles IL to native code at publish time and does not use a runtime JIT. Compare deployment models by startup, size, dynamic-code needs, compatibility, and measured throughput.
Are C# and the CLR the same thing?
No. C# is a language with its own compiler and specification; the CLR is the managed execution environment used by .NET languages. That distinction matters when a question asks whether behavior is guaranteed by C# semantics, implemented by the runtime, or supplied by a library such as ASP.NET Core or EF Core.
Garbage collection, allocation, and disposal
Garbage collection manages reachable managed memory; it does not guarantee timely release of files, sockets, database handles, or other scarce resources.
How does generational garbage collection work?
The GC traces objects reachable from roots and reclaims unreachable managed objects. New objects normally begin in generation 0; survivors can be promoted through generations 1 and 2. The design reflects the common observation that many allocations die young. A collection of an older generation also includes younger generations.
Avoid turning that model into a tuning recipe. Allocation rate, survival, pinned memory, GC mode, and large allocations all change behavior. On Windows, objects of at least 85,000 bytes go to the large object heap, but that official guidance is platform-specific. Profile before pooling objects or forcing GC.Collect.
If .NET has a GC, why use IDisposable?
The GC owns managed memory, not timely cleanup of scarce resources. IDisposable, IAsyncDisposable, using, and await using make ownership explicit. Dispose resources a type owns, not dependencies owned by a container or caller. The Dispose guidance recommends SafeHandle over writing a finalizer directly in most interop code.
Async/await questions that expose production judgment
Does async create a new thread?
No. The compiler transforms an async method into a state machine. It runs synchronously until an incomplete await, then records state and returns control. Truly asynchronous I/O need not occupy the calling thread while waiting; file and database providers may use OS async I/O or ThreadPool threads. CPU work may use Task.Run when offloading is appropriate. Wrapping asynchronous I/O in Task.Run adds scheduling overhead.
Use Task or Task<T> by default. ValueTask can reduce allocation on measured hot paths with frequent synchronous completion, but adds consumption constraints. It is not a “faster Task.” Avoid async void except event handlers because callers cannot await it.
Why are .Result and .Wait() risky?
Synchronous blocking can deadlock when a continuation needs a captured, constrained synchronization context. ASP.NET Core lacks the classic ASP.NET context by default, so not every .Result deadlocks. More often, blocked request threads reduce scalability or cause ThreadPool starvation. Prefer async all the way and confirm starvation with queue length, thread count, CPU, stacks, and traces.
How should cancellation flow through a request?
Cancellation is cooperative. A caller requests it through a CancellationTokenSource, and each operation must observe the token and stop safely. In ASP.NET Core, pass HttpContext.RequestAborted or an action's bound token to EF Core, outbound HTTP calls, channel waits, and other cancellable work. Decide whether a canceled operation can leave partial state, which cleanup must still run, and whether a durable side effect needs an idempotency or reconciliation strategy.
LINQ execution and translation questions
What is deferred execution, and when does a LINQ query run?
Many LINQ operators build a recipe that runs when the sequence is enumerated. ToList and ToArray force execution and store a snapshot; scalar operators such as Count, First, and Average also execute immediately. Re-enumerating a deferred sequence can repeat expensive work or observe changed input, so materialize deliberately rather than reflexively.
What is the difference between IEnumerable<T> and IQueryable<T>?
LINQ over IEnumerable<T> normally compiles lambdas to delegates and runs them in the current process. An IQueryable<T> carries an expression tree and a provider that can interpret or translate it. It does not inherently mean SQL or remote execution. With EF Core, the provider attempts to translate the tree into database commands; translation support depends on the provider and version.
A strong answer asks where the boundary changes. AsEnumerable switches subsequent operators to LINQ to Objects; ToListAsync materializes results. Filtering afterward can move work and data into the application. Inspect generated SQL, select needed columns, bound results, count round trips, and read the database plan.
ASP.NET Core pipeline and dependency injection
Why does middleware order matter?
Middleware handles requests in registration order and responses in reverse order. A component can short-circuit and prevent later components from running. That makes order part of correctness and security: exception handling generally belongs early, authentication precedes authorization, and CORS has placement requirements around routing and authorization. Static files served before authorization are public unless protected separately. Use the middleware-order documentation because templates can change.
Explain transient, scoped, and singleton lifetimes
Transient services are created per resolution, scoped services once per scope, and singletons once per container. In a typical web app, a scope corresponds to one request. A singleton must be safe for concurrent use and must not capture a scoped service. Background or singleton work that needs scoped dependencies should create an explicit scope for each unit of work.
Conventional middleware is normally constructed once, so inject scoped dependencies into InvokeAsync, not its constructor. Factory-based IMiddleware is activated per request and can receive scoped constructor dependencies. The interview signal is recognizing the captive-dependency bug and defining who owns disposal.

EF Core questions for backend interviews
Is DbContext thread-safe?
No. A DbContext represents a short-lived unit of work and does not support parallel operations on one instance. Await each EF operation before using that context again, or create separate contexts for truly parallel work. AddDbContext registers a scoped context by default, which fits many request-based workloads but does not make fire-and-forget tasks safe.
Tracking queries suit entities that will be updated; no-tracking is generally faster for read-only results. Tracking can win when entities are already tracked or repeated because it performs identity resolution. Query performance usually depends more on indexes, projection, result bounds, pagination, round trips, and generated SQL. Split queries can avoid cartesian explosion for sibling collection navigations at one query level, but add round trips, buffering, and possible consistency trade-offs.
For deeper database discussion, connect these C# decisions to PostgreSQL interview questions on MVCC, indexes, query plans, and transactions.
A four-pass framework for answering .NET questions
Use BOLT to turn a syntax answer into a production answer:
- Boundary: Is this guaranteed by C#, implemented by the CLR, translated by a provider, or handled by the OS or database?
- Ownership: Who owns the object, request scope, connection, token, and cleanup responsibility?
- Load: What happens under concurrency, cancellation, allocation pressure, slow dependencies, and repeated enumeration?
- Telemetry: Which test, metric, generated command, stack, trace, or dump would confirm the explanation?
For example, do not answer “use async because it is faster.” Say the boundary is I/O, the request owns a cancellation token, blocking would consume worker capacity under load, and dotnet-counters plus an EventPipe trace can test the hypothesis.
Practice with verified PracHub questions
These exercises are transferable backend practice. Answer them in modern C# and state the .NET mapping explicitly; they are not guarantees about any employer's exact interview.
| PracHub question | .NET practice focus | Strong follow-up |
|---|---|---|
| Explain OS processes, threads, and memory | CLR process, managed threads, stacks, heaps | Separate runtime abstraction from OS scheduling |
| Implement thread-safe blocking queue | Locks, SemaphoreSlim, channels, shutdown | Add bounds, cancellation, fairness, and tests |
| Design async batched key-value fetcher | Tasks, batching, deduplication, backpressure | Propagate timeouts and cancellation safely |
| Debug row loss after SQL joins | LINQ/SQL semantics and translation | Inspect generated SQL and preserve intended cardinality |
| Design Calendar Event CRUD with Unit Tests | ASP.NET Core contracts and test boundaries | Cover validation, concurrency, and failure responses |
Common C# and .NET interview mistakes
- Saying
asynccreates a background thread. - Treating
ValueTaskas an automatic upgrade fromTask. - Claiming every blocked task deadlocks in ASP.NET Core.
- Assuming
IQueryablemeans SQL or that every expression is translatable. - Letting a singleton capture
DbContextor another scoped dependency. - Sharing one
DbContextacross parallel operations. - Relying on the GC for timely socket, stream, or handle cleanup.
- Optimizing allocations or queries before measuring the actual hot path.
Frequently asked questions
Which .NET version should I prepare for in 2026?
Know the runtime used by the role, but prepare modern concepts rather than memorizing one patch. As of August 31, 2026, Microsoft supports .NET 10 LTS, .NET 9 STS, and .NET 8 LTS. Mention version-sensitive behavior explicitly and avoid presenting preview .NET 11 or C# 15 features as production defaults.
Do I need to memorize every LINQ operator?
No. You should recognize common transformations, filtering, grouping, joining, and aggregation, then reason about deferred execution, materialization, cardinality, translation, and complexity. An interviewer learns more from your execution-boundary explanation than from obscure method recall.
Is ConfigureAwait(false) required in ASP.NET Core?
Not universally. It prevents forcing a continuation back to a captured synchronization context or nondefault scheduler and remains common in general-purpose library code. ASP.NET Core application code usually lacks a custom synchronization context, so explain the environment instead of applying the call mechanically.
How should I debug a slow .NET service in an interview?
Start from symptoms and measurements. Use dotnet-counters for live metrics, dotnet-trace for EventPipe traces, dotnet-stack for live managed stacks, dotnet-dump for crashes and hangs, and dotnet-gcdump for managed-heap counts and roots. Correlate runtime evidence with request traces, dependency latency, generated SQL, and database plans.
Are ASP.NET Core interview questions mostly framework trivia?
Good questions use the framework to expose engineering judgment: pipeline ordering, scope ownership, cancellation, error contracts, security, data access, observability, and behavior under load. If you forget an exact method name, state the invariant and how you would verify the configuration.
Final takeaway
C# and .NET interviews reward boundary-aware reasoning. Explain which layer owns the behavior, carry resource and cancellation ownership through the request, test the design under load, and name the evidence that would prove your claim. That approach is stronger than memorizing runtime trivia because it shows how you would operate a real backend service.
Practice the five linked questions aloud, then change one constraint—higher concurrency, slower storage, client cancellation, or a singleton consumer—and defend the new design.
Sources and Further Reading
- .NET releases, patches, and support
- Common Language Runtime overview
- Managed execution process
- .NET garbage-collection fundamentals
- Implement the Dispose pattern
- C# asynchronous programming scenarios
- C# async return types
- .NET cooperative cancellation model
- Debug .NET ThreadPool starvation
- Language Integrated Query overview
- ASP.NET Core middleware
- .NET dependency-injection service lifetimes
- EF Core DbContext lifetime and threading
- EF Core efficient querying
- .NET diagnostic tools overview
Research note: This guide was checked against official Microsoft documentation on August 31, 2026. .NET servicing levels and provider-specific behavior change, so verify version-sensitive details against the runtime, framework, and database provider used in your interview.
Comments (0)