5 min readBy Muhammad Shahid
.NET Interview Questions and Answers (C# and ASP.NET Core)
.NET interview questions and answers for mid-to-senior roles — C# async, ASP.NET Core scenarios, EF Core, Angular integration, with links to full scenario write-ups.
Part of Interview Questions
Quick answers
- What are common .NET interview questions?
- Mid-level loops cover C# async await (.Result starvation, async void, WhenAll on one DbContext), ASP.NET Core DI lifetimes, JWT with Angular, middleware order, and EF Core N+1. Senior loops add IAsyncEnumerable exports, tenant-safe caches, Channels, and SQL deadlocks under load.
- What ASP.NET Core interview questions are asked most?
- Captive dependencies (singleton holding DbContext), 401 vs 403, thread pool starvation from sync-over-async, validation envelopes for SPAs, and middleware order (CORS before auth failures). Scenario answers live on the ASP.NET Core interview questions page.
- What C# interview questions and answers should I prepare?
- Task vs Thread, async vs multithreading, lock vs SemaphoreSlim, ConfigureAwait in libraries, and production failure stories — not syntax trivia. Start with async await interview questions, then expert scenarios for staff loops.
- How do I study .NET interview questions efficiently?
- Pick one track: async, ASP.NET Core scenarios, EF Core, or Angular integration. Read the scenario prompt, answer aloud, then compare to the strong answer. Link to how-to articles for merge-checklist depth.
If you search .NET interview questions, ASP.NET Core interview questions, or C# interview questions and answers, you want a map — not a 200-line dump copied from a PDF.
This page is that map: the questions I actually ask and hear in healthcare, SaaS, and marketplace hiring loops, with links to full scenario answers on dedicated URLs.
How to use this guide
- Pick your level (mid vs staff)
- Open the linked article for each topic
- Rehearse out loud — definition, production symptom, fix
- Read the how-to post when you need merge-checklist depth
Hub: interview questions.
.NET interview questions by topic
C# and async (most common mid-level loop)
| Question | Short answer | Full scenario |
|---|---|---|
Does async create a thread? | No for I/O — yields the worker | Async await interview questions |
.Result on ASP.NET Core? | Thread pool starvation, not UI deadlock | Thread pool starvation |
async void on a controller? | Unobserved exceptions — use Task | Async await interview questions |
WhenAll on one DbContext? | Race — not thread-safe | WhenAll vs Parallel |
Task vs Thread? | Promise vs OS worker | Task vs Thread |
ConfigureAwait(false) on API? | Library rule, not controller default | ConfigureAwait |
Definitions: asynchronous meaning, async vs sync.
ASP.NET Core interview questions
| Question | Short answer | Full scenario |
|---|---|---|
| Captive dependency? | Singleton captured scoped DbContext | ASP.NET Core scenarios |
| 401 vs 403? | Not authenticated vs forbidden | 401 vs 403 |
| Middleware order? | CORS, exception handling, auth, authz | Middleware order |
| JWT works in Postman, not Angular? | CORS, cookie vs bearer, clock skew | JWT auth |
| Why idle CPU and 504s? | Sync-over-async starving pool | Starvation |
Full narrative answers: ASP.NET Core interview questions scenarios.
C# interview questions and answers (staff / expert)
| Question | Short answer | Full scenario |
|---|---|---|
| Export 200k rows OOM? | IAsyncEnumerable, project in SQL | Expert interview questions |
| Multi-tenant cache leak? | Key must include tenantId | ConcurrentDictionary |
| Fire-and-forget email? | Channel + BackgroundService | BackgroundService async |
| Deadlock vs starvation? | UI sync context vs pool queue | Deadlock explained |
EF Core interview questions
| Question | Short answer | Full scenario |
|---|---|---|
| N+1? | Loop + lazy load or missing Include | EF interview questions |
| Include vs AsSplitQuery? | JOIN explosion vs multiple SQL | N+1 Include AsSplitQuery |
| Lost update vs deadlock? | RowVersion vs RCSI | Optimistic concurrency |
| Global query filter pitfall? | IgnoreQueryFilters for admin | EF interview questions |
Angular + ASP.NET Core interview questions
| Question | Short answer | Full scenario |
|---|---|---|
| Refresh token race? | Queue 401s, single refresh | 401 refresh queue |
| JWT interceptor design? | Attach bearer, handle 401 | Angular JWT interceptors |
| Auth guard vs API? | Guard is UX; API enforces | Auth guard |
Full list: Angular interview questions.
Sample C# interview questions and answers
Q: What is the difference between async and multithreading?
Answer: async/await frees the ThreadPool worker during I/O waits — the Task is a promise, not a dedicated thread. Multithreading runs work on multiple workers (Task.Run, Parallel, lock). On ASP.NET Core APIs, default to async for SQL and HTTP; use threading for CPU offload and in-memory gates.
Q: What is dependency injection?
Answer: Inversion of control — the framework constructs services and injects them. Lifetimes matter: Singleton (one per app), Scoped (per request — DbContext), Transient (every resolve). Never inject scoped into singleton without a scope factory.
Q: What is Clean Architecture?
Answer: Domain and application rules at the center; infrastructure and UI at the edges. Controllers stay thin. Goal is testable boundaries — not copying folder templates without domain complexity. Clean Architecture guide.
Q: Repository pattern — yes or no?
Answer: DbContext is already a unit of work. Add repositories for named, reused queries — not generic IRepository<T> on every entity. Repository definition.
Study order (recommended)
Week 1 — Async track
asynchronous meaning → async await interview questions → starvation how-to
Week 2 — ASP.NET Core track
ASP.NET Core scenarios → DI lifetimes → JWT + Angular interceptors
Week 3 — Data track
EF Core interview questions → N+1 / AsSplitQuery how-tos
Week 4 — Staff polish
Expert interview questions → Channels, IAsyncEnumerable
If an interviewer asks
"What .NET interview questions should a senior know?"
Production failures: tenant cache leaks, starvation dumps, JWT rotation, EF concurrency, and API design tradeoffs — not keyword lists.
"ASP.NET Core vs .NET interview questions?"
.NET is the runtime and language. ASP.NET Core questions are web-specific: pipeline, auth, hosting, EF in request scope.
All tracks: interview questions hub.