.NET Core Interview Questions and Answers
A complete list of 450+ .NET Core interview questions and answers, organized by topic. Click any question to jump straight to its detailed answer with code examples.
8 topics 450 questions
.NET Core Fundamentals
CLR Runtime
- What is the CLR and what does it do?
- What is Intermediate Language (IL) and how does the CLR execute it?
- What is JIT compilation and how does it differ from AOT?
- What is the Common Type System (CTS)?
- What is the Common Language Specification (CLS) and why does it matter?
- What is the difference between managed and unmanaged code?
- What is a .NET Assembly and what does it contain?
- What is the difference between .NET Framework, .NET Core, and modern .NET (5+)?
- How does the .NET garbage collector work at a high level?
- What are GC generations and why do they matter?
- What is reflection in .NET and when should you use it?
- What is the difference between stack and heap allocation in the CLR?
- What is tiered compilation in .NET and how does it improve performance?
- What is an AppDomain and how does process isolation work in modern .NET?
- How does the CLR handle exceptions — what happens when an exception is thrown?
Value vs Reference Types
- What is the difference between value types and reference types in C#?
- Where are value types and reference types stored in memory?
- What is boxing and unboxing, and why is it a performance concern?
- What is the difference between a struct and a class in C#?
- When should you use a struct instead of a class?
- What does "pass by value" mean in C#, and how does it apply to reference types?
- What does the `ref` keyword do when passing parameters?
- What is the `out` parameter modifier and how does it differ from `ref`?
- What is the `in` parameter modifier in C#?
- What is a `ref struct` in C#?
- What is `Span<T>` and why is it a `ref struct`?
- How does equality work differently for value types vs reference types in C#?
- What is a `readonly struct` in C# and when should you use it?
- What are record types in C# and how do they relate to value vs reference type semantics?
- What is string interning in .NET and how does it relate to reference type equality?
Generics
- What are generics and why were they introduced in C# 2.0?
- What are generic type constraints in C# and what kinds exist?
- What is covariance in C# generics?
- What is contravariance in C# generics?
- What is the difference between `IEnumerable<T>` and `ICollection<T>` in generics?
- How do C# generics differ from Java generics?
- What is `default(T)` and when would you use it?
- What are the built-in generic delegates `Action<T>`, `Func<T>`, and `Predicate<T>`?
- Can a class implement the same generic interface multiple times with different type arguments?
- What is the difference between `typeof(T)` and `t.GetType()` inside a generic method?
- What is the difference between `List<T>` and `ArrayList`, and why should you always prefer `List<T>`?
- Do generic types share static members across different type arguments?
- What is the difference between an open generic type and a closed generic type?
- What are generic math interfaces in .NET 7+ and how do they enable numeric generics?
- How does C# infer generic type arguments, and when do you have to specify them explicitly?
LINQ
- What is LINQ and what problem does it solve?
- What is deferred execution in LINQ and why does it matter?
- What is the difference between LINQ query syntax and method syntax?
- What is the difference between `IEnumerable<T>` and `IQueryable<T>` in LINQ?
- What is the difference between `Select` and `SelectMany` in LINQ?
- What is the difference between `First()`, `FirstOrDefault()`, `Single()`, and `SingleOrDefault()`?
- How does `GroupBy` work in LINQ?
- When do you use `Any()`, `All()`, and `Count()` in LINQ?
- What is `Aggregate()` in LINQ and what is it equivalent to in functional programming?
- What is the difference between `ToList()`, `ToArray()`, and `AsEnumerable()`?
- How does a LINQ join work, and what is the difference between `Join` and `GroupJoin`?
- What is `Zip()` in LINQ and when would you use it?
- How do `Distinct()` and `DistinctBy()` work in LINQ?
- What is the difference between `OrderBy` and `ThenBy` in LINQ?
- What are the most common LINQ performance pitfalls and how do you avoid them?
Nullable Types
- What are nullable value types in C#?
- What is the difference between `int?` and `Nullable<int>` in C#?
- What is the null-coalescing operator `??` and when do you use it?
- What is the null-conditional operator `?.` and how does it prevent NullReferenceException?
- What are nullable reference types introduced in C# 8 and how do they differ from nullable value types?
- How do you enable nullable reference types for a .NET project?
- What is the null-forgiving operator `!` and when should you use it?
- What is the null-coalescing assignment operator `??=`?
- How does pattern matching work with null checks in C#?
- How does boxing work for nullable value types — what gets boxed?
- What is `GetValueOrDefault()` on a nullable type and how does it differ from `Value`?
- How do arithmetic and comparison operators behave with nullable value types?
- How should you handle nullable types in ternary expressions and switch statements?
- What is the difference between a nullable collection and a collection of nullable elements?
- What is nullable flow analysis and how does the C# compiler use it?
.NET Core C# Core
Async / Await
- What does the `async` / `await` pair do in C# and how does the compiler implement it?
- What is the difference between a `Task` and a `Thread` in .NET?
- What does `ConfigureAwait(false)` do and when should you use it?
- How does a deadlock occur in async code when you call `.Result` or `.Wait()`?
- What is the difference between `Task.WhenAll` and `Task.WhenAny`?
- What is `async void` and why is it dangerous?
- What is `ValueTask<T>` and when should you use it instead of `Task<T>`?
- What is `CancellationToken` and how do you use it correctly?
- What is `SynchronizationContext` and how does it interact with `async` / `await`?
- How do you handle exceptions thrown inside `async` methods?
- What is the difference between `Task.Run` and `Task.Factory.StartNew`?
- What is `IAsyncEnumerable<T>` and when do you use it?
- How do you implement a timeout for an async operation in C#?
- What is `TaskCompletionSource<T>` and when do you use it?
- How do you report progress from an async operation using `IProgress<T>`?
Delegates & Events
- What is a delegate in C# and how do you declare and use one?
- What are `Action`, `Func`, and `Predicate` delegates?
- What is a multicast delegate and how does it work?
- What is the difference between a delegate and an event in C#?
- What is the standard `EventHandler<TEventArgs>` pattern and why is it preferred?
- What is a lambda expression in C# and how does it relate to delegates?
- What is a closure and what is the classic loop-capture bug?
- What are delegate covariance and contravariance?
- What is the memory leak risk with events and how do you address it?
- How do C# events implement the observer pattern, and what is `IObservable<T>`?
- How do you compose delegates and functions in C# to build pipelines?
- What are anonymous methods and how do they differ from lambda expressions?
- What is an expression tree and how does it differ from a delegate?
- How do you raise an event safely from multiple threads?
- When should you use a delegate instead of a single-method interface?
Pattern Matching
- What is pattern matching in C# and when was it introduced?
- How does a `switch` expression differ from a `switch` statement?
- What is a type pattern in C# and how does it bind a variable?
- What is a property pattern and how do you nest them?
- What is a positional pattern and how does it work with deconstruction?
- What are relational patterns and logical patterns in C# 9?
- What is a `when` guard in a switch expression or statement?
- What is a list pattern in C# 11?
- What is deconstruction in C# and how do you implement it for custom types?
- What is the `var` pattern and when is it useful?
- How does pattern matching work with C# records?
- How does pattern matching handle `null` values?
- What is a constant pattern in C# and how is it used?
- What is exhaustiveness checking in switch expressions and how does it affect safety?
- How does pattern matching perform compared to if-else chains and what are the compiler optimisations?
Collections
- What are the main collection types in .NET and how do you choose between them?
- What is the difference between `List<T>` and `T[]` (array)?
- How does `Dictionary<TKey, TValue>` work internally and what makes a good key?
- When should you use `HashSet<T>` over `List<T>`?
- What is `ConcurrentDictionary<K,V>` and when do you need it?
- What is the difference between `IReadOnlyList<T>`, `IReadOnlyCollection<T>`, and `ImmutableList<T>`?
- What is `Span<T>` and `Memory<T>` and why do they matter for performance?
- What are `Queue<T>` and `Stack<T>` and what are common use cases?
- What are `SortedDictionary<K,V>` and `SortedList<K,V>` and how do they differ?
- What are the key collection interfaces (`IEnumerable`, `ICollection`, `IList`) and what does each add?
- When should you use `LinkedList<T>` instead of `List<T>`?
- What are the key performance considerations when working with .NET collections?
- What is `PriorityQueue<TElement, TPriority>` and when do you use it?
- What are `FrozenDictionary<K,V>` and `FrozenSet<T>` (.NET 8) and when do you use them?
- What is `System.Threading.Channels` and when should you use it over `ConcurrentQueue`?
Exception Handling
- What is the .NET exception hierarchy and how does it relate to what you should catch?
- What is the difference between `throw` and `throw ex` and why does it matter?
- What does `finally` guarantee and when is it NOT executed?
- How do you create a well-designed custom exception class?
- What is `AggregateException` and when does it appear?
- What is a `catch` block `when` filter and how does it help?
- What is `ExceptionDispatchInfo` and when do you use it?
- How do you handle unhandled exceptions globally in an ASP.NET Core application?
- What are the common patterns for rethrowing exceptions and when should each be used?
- What are `checked` and `unchecked` contexts for arithmetic overflow?
- What are the key do's and don'ts of exception handling in production code?
- What is a throw expression (C# 7) and how does it improve code clarity?
- Why are exceptions expensive in .NET and how do you avoid them on hot paths?
- What is `InnerException` and how do you use exception chaining correctly?
- When should you use guard clauses and validation instead of relying on exceptions?
.NET Core ASP.NET Core
Middleware
- What is middleware in ASP.NET Core and how does the request pipeline work?
- What is the difference between `Use`, `Run`, and `Map` in the middleware pipeline?
- Why does middleware ordering matter in ASP.NET Core and what is the recommended order?
- How do you write a custom middleware class in ASP.NET Core?
- What does "short-circuiting" the pipeline mean and when should you do it?
- How does exception-handling middleware work in ASP.NET Core?
- What is the difference between middleware and MVC action filters?
- What are the most important built-in middleware components in ASP.NET Core?
- How do you inject services into middleware, and what lifetime restrictions apply?
- How does `UseResponseCaching` work and when should you use `UseOutputCache` instead?
- How do you configure CORS middleware in ASP.NET Core?
- Can you describe the lifecycle of a request through the ASP.NET Core middleware pipeline?
- How do you add rate limiting to an ASP.NET Core application with `UseRateLimiter`?
- What is the difference between `UseWhen` and `MapWhen` for conditional middleware?
- What are endpoint filters in minimal APIs and how do they compare to action filters?
Routing
- What is routing in ASP.NET Core and how does endpoint routing work?
- What is the difference between conventional routing and attribute routing?
- What are route constraints and how do you use them?
- How do route templates work — what are literal segments, parameters, and catch-all parameters?
- What are the HTTP verb attributes (`[HttpGet]`, `[HttpPost]`, etc.) and how do they map to REST?
- How do you generate URLs in ASP.NET Core using `IUrlHelper` and `LinkGenerator`?
- What are Areas in ASP.NET Core MVC and when do you use them?
- What are minimal APIs and how do they compare to controller-based routing?
- What are route groups in minimal APIs and how do they reduce boilerplate?
- Where can ASP.NET Core bind route and action parameters from, and how does it decide?
- What happens when two routes are ambiguous and how does ASP.NET Core resolve conflicts?
- What is a fallback route and how do you configure one in ASP.NET Core?
- What is endpoint metadata and how do middleware components use it?
- How do you control the order and priority of routes in ASP.NET Core's endpoint routing?
- How do you add OpenAPI metadata to minimal API endpoints for Swagger documentation?
Controllers & Actions
- What is a controller in ASP.NET Core and what makes a class a controller?
- What is the difference between `IActionResult`, `ActionResult<T>`, and returning `T` directly?
- What does the `[ApiController]` attribute do?
- How does model binding work in ASP.NET Core?
- How do you validate models with Data Annotations and `ModelState`?
- What are action filters and when should you use them?
- What is content negotiation in ASP.NET Core and how is it configured?
- What is the difference between `Controller` and `ControllerBase`?
- What is `[ProducesResponseType]` and why does it matter?
- What are the common action result helper methods in `ControllerBase`?
- Should controller action methods be async, and what are the best practices?
- What is the Problem Details standard and how does ASP.NET Core implement it?
- How do you return file downloads from a controller action?
- How do you perform redirects from a controller action, and what is the difference between the redirect methods?
- What do `[Consumes]` and `[Produces]` attributes do on a controller action?
Configuration
- What is the ASP.NET Core configuration system and how does it work?
- What are the built-in configuration providers and how are they ordered?
- What is the Options pattern (`IOptions<T>`, `IOptionsSnapshot<T>`, `IOptionsMonitor<T>`) and when do you use each?
- How do you validate configuration options at startup to fail fast on bad config?
- What are User Secrets and how do you use them in development?
- How does ASP.NET Core handle environment-specific configuration?
- How do you use `IConfiguration.Bind`, `Get<T>`, and `GetSection` to read config?
- Does ASP.NET Core automatically reload configuration when `appsettings.json` changes?
- What are named options and when do you use them?
- What is `PostConfigure` and how does it differ from `Configure`?
- How do you use the ASP.NET Core configuration system in a console app or background service?
- What is `IConfigureOptions<T>` and how does it differ from `services.Configure<T>`?
- How do you integrate Azure Key Vault as a configuration provider in ASP.NET Core?
- How do you override configuration values in integration tests?
- What is `IChangeToken` and how does it relate to configuration reload notifications?
.NET Core Dependency Injection
DI Basics
- What is dependency injection and why does ASP.NET Core use it by default?
- What is IServiceCollection and how do you register services with it?
- How does constructor injection work in ASP.NET Core and why is it the preferred style?
- What is IServiceProvider and when is it appropriate to use it directly?
- What is the difference between Add*, TryAdd*, and Replace* registration methods?
- How do you register open generic services in the .NET DI container?
- What are keyed services in .NET 8 and when should you use them?
- How do you resolve all registered implementations of an interface?
- What are ValidateOnBuild and ValidateScopes and why should you enable them in development?
- How does dependency injection work in minimal API endpoint handlers?
- How do extension methods help organize service registrations?
- What are the most common DI anti-patterns in ASP.NET Core?
- Does ASP.NET Core's built-in DI container support property or method injection?
- How do you implement the decorator pattern with the built-in DI container?
- When and how do you replace the built-in DI container with a third-party container?
Service Lifetimes
- What are the three service lifetimes in .NET Core DI and when do you use each?
- When should you use Singleton lifetime and what are the thread-safety requirements?
- How does Scoped lifetime work in ASP.NET Core and what is the "scope" boundary?
- When should you use Transient lifetime and what are its trade-offs?
- What is a captive dependency and how do you detect and fix it?
- What is IServiceScopeFactory and when do you need it?
- How does the DI container handle IDisposable and IAsyncDisposable services?
- Why can't a BackgroundService inject Scoped services directly?
- What is the root scope in .NET DI and why is it a source of memory leaks?
- How do service lifetimes differ in Blazor Server vs Blazor WebAssembly?
- How do you detect and prevent lifetime mismatch bugs at development time?
- What are the performance implications of choosing Transient vs Singleton for stateless services?
- How do you use Scoped services outside the ASP.NET Core request pipeline?
- What patterns ensure thread safety in Singleton services?
- How does service lifetime work in gRPC services with ASP.NET Core?
Options Pattern
- What is the options pattern in .NET Core and why use it instead of IConfiguration directly?
- What is the difference between IOptions<T>, IOptionsSnapshot<T>, and IOptionsMonitor<T>?
- How do you bind a configuration section to a typed options class?
- What are named options and when are they useful?
- How do you validate options at startup and what approaches are available?
- What is the difference between Configure<T> and PostConfigure<T>?
- How do you inject options in unit tests without a real configuration file?
- How does the AddOptions<T> fluent builder improve on Configure<T>?
- How does configuration reloading work with the options pattern?
- What does builder.Services.Configure<T> actually do under the hood?
- When should you inject IOptions<T> vs IConfiguration directly?
- How do you provide environment-specific overrides for options in ASP.NET Core?
- How do you handle secrets (API keys, connection strings) with the options pattern?
- How do you bind nested objects, collections, and enums in options classes?
- How does IOptionsMonitor<T> use change tokens to detect configuration reloads?
.NET Core Entity Framework Core
DbContext & DbSet
- What is DbContext and what role does it play in EF Core?
- What operations does DbSet<T> expose and how do they map to SQL?
- How do you configure DbContextOptions and what provider options are available?
- How does EF Core's change tracker work and what entity states are there?
- How does SaveChanges work and what happens under the hood?
- Why should DbContext be registered as Scoped, not Singleton or Transient?
- What is DbContext pooling and when should you use it?
- What is the difference between configuring EF Core via OnConfiguring vs AddDbContext?
- How do you configure entity mappings in EF Core — data annotations vs Fluent API?
- What are value conversions in EF Core and when do you use them?
- What are global query filters and how do you use them for soft deletes?
- What are keyless entity types in EF Core and when do you use them?
- What is SqlQuery and how does it differ from FromSqlRaw in EF Core 8?
- What are EF Core interceptors and how do you use them for auditing?
- Should you wrap EF Core DbContext in a Repository and Unit of Work pattern?
Migrations
- What are EF Core migrations and why do you use them instead of manual schema scripts?
- What is the standard EF Core migration workflow from model change to production?
- What is the __EFMigrationsHistory table and how does EF Core use it?
- How do you seed data with EF Core migrations?
- What is a design-time DbContext factory and when do you need one?
- What are EF Core migration bundles and why are they preferred for CI/CD?
- How do you roll back a migration in EF Core?
- How do you squash or consolidate many EF Core migrations?
- How do you inspect the SQL that EF Core migration commands generate?
- How do you manage multiple DbContexts in one application?
- What is the difference between EnsureCreated and MigrateAsync?
- How do you detect and prevent model/migration drift in CI?
- Are EF Core migrations applied inside a database transaction?
- How do you rename a column in an EF Core migration without losing data?
- How do you put EF Core migrations in a separate assembly from the DbContext?
Querying
- What is the difference between IQueryable and IEnumerable in EF Core queries?
- What is deferred execution in EF Core and which operations trigger SQL?
- How do you use projections (Select) to load only the columns you need?
- What is eager loading and how do you use Include and ThenInclude?
- What is the N+1 query problem and how do you fix it in EF Core?
- What is lazy loading in EF Core and why is it dangerous in web applications?
- When and how do you execute raw SQL in EF Core?
- Why should EF Core queries always use async methods like ToListAsync?
- What are compiled queries in EF Core and when do they give a measurable speedup?
- What are split queries in EF Core and when should you use them?
- How does EF Core translate GroupBy and aggregate functions to SQL?
- What is AsNoTracking and when should you use it?
- How do you implement pagination with EF Core?
- How do you perform text search (LIKE, full-text) with EF Core?
- What is explicit loading in EF Core and how does it differ from eager and lazy loading?
Relationships
- How do you configure a one-to-many relationship in EF Core?
- How has many-to-many relationship configuration changed between EF Core 3 and EF Core 5+?
- How do you configure a one-to-one relationship in EF Core?
- What are navigation properties in EF Core and what are the different types?
- What is cascade delete in EF Core and what are the DeleteBehavior options?
- What are owned entity types in EF Core and when should you use them?
- How do you configure a self-referencing (hierarchical) relationship in EF Core?
- What is the difference between a primary key and an alternate key in EF Core?
- What are EF Core inheritance mapping strategies and when do you use each?
- What are shadow properties in EF Core and how do you use them for auditing?
- What is table splitting in EF Core and when should you use it?
- How do you handle optimistic concurrency in EF Core?
- Can you configure a relationship in EF Core without a navigation property?
- What are skip navigations in EF Core many-to-many relationships?
- What is the difference between a required and an optional relationship in EF Core?
.NET Core Security
Authentication
- What is the difference between authentication and authorization in ASP.NET Core?
- How do you configure authentication in an ASP.NET Core application?
- How does cookie authentication work in ASP.NET Core?
- What is claims-based identity and how does it work in .NET?
- What are authentication schemes and how do you configure multiple schemes?
- How do you implement a custom authentication handler in ASP.NET Core?
- How do SignInAsync and SignOutAsync work and what do they actually do?
- What is the difference between Challenge and Forbid in ASP.NET Core authentication?
- How and when is HttpContext.User populated during a request?
- What is Windows Authentication and when would you use it in ASP.NET Core?
- How do you add external OAuth/OIDC providers like Google or Microsoft to ASP.NET Core?
- What is ASP.NET Core Data Protection and how does it relate to authentication?
- How do you protect endpoints in minimal APIs with authentication?
- What is OpenID Connect and how does it differ from OAuth 2.0 in ASP.NET Core?
- How do you implement two-factor authentication (2FA) with ASP.NET Core Identity?
Authorization
- What is policy-based authorization and how does it differ from role-based authorization?
- How do you configure authorization policies in ASP.NET Core?
- What are authorization requirements and handlers, and how do they work together?
- What is resource-based authorization and when do you need it?
- How does the [Authorize] attribute work and what are its key parameters?
- How do you use IAuthorizationService for imperative authorization checks?
- How do you authorize based on specific claim values rather than roles?
- What are the default policy and fallback policy in ASP.NET Core authorization?
- How does [AllowAnonymous] work and where should you use it?
- How do you add a global authorization filter so that every endpoint requires authentication?
- What is IAuthorizationPolicyProvider and when would you implement a custom one?
- Why does middleware order matter for authorization, and what breaks if it is wrong?
- How do you implement fine-grained permission-based authorization beyond roles?
- How do you implement conditional access rules, such as restricting endpoints by IP range or time of day?
- How do you return custom error responses when authorization fails, instead of the default 403?
JWT Tokens
- What is a JWT and what are its three parts?
- How do you configure JWT bearer authentication in ASP.NET Core?
- How do you generate a JWT in ASP.NET Core?
- What are the critical TokenValidationParameters settings and what does each prevent?
- What are refresh tokens and how do you implement a refresh flow in ASP.NET Core?
- What is the difference between symmetric and asymmetric JWT signing?
- How does ASP.NET Core map JWT claims to ClaimsPrincipal, and what common gotchas exist?
- What are the most common JWT vulnerabilities and how do you prevent them in ASP.NET Core?
- How do you handle JWT expiration — on the server and on the client?
- JWTs are stateless — how do you revoke one before it expires?
- Where should JWTs be stored on the client, and what are the security trade-offs?
- What is a JWKS endpoint and how does ASP.NET Core use it for token validation?
- How do you validate a JWT against multiple valid audiences?
- What is the on-behalf-of (OBO) flow and when do you use it in a microservices architecture?
- How does JWT size affect performance and what can you do to keep tokens small?
.NET Core Testing
Unit Testing
- What is a unit test and what makes a good unit test in .NET?
- What are the differences between xUnit, NUnit, and MSTest?
- What is the Arrange-Act-Assert pattern and why does it matter?
- What naming conventions are used for unit tests in .NET?
- How do you write data-driven (parameterised) tests in xUnit?
- How do you achieve test isolation in .NET unit tests?
- How do you test that a method throws the correct exception in xUnit?
- What are the different types of test doubles and when do you use each?
- What design practices make .NET code easier to unit test?
- What is code coverage and how do you measure it in .NET?
- How does xUnit use the constructor and IDisposable for test setup and teardown?
- What is FluentAssertions and why do developers prefer it over built-in xUnit asserts?
- How do you organise large test classes to keep them maintainable?
- How do you write unit tests for async methods in xUnit?
- Should you test private methods directly, and if not, how do you ensure they are covered?
Mocking
- What is mocking and why is it used in unit tests?
- How do you configure a mock to return a value using Moq?
- How do you verify that a method was called on a mock using Moq?
- What is the difference between strict and loose mocks in Moq?
- What argument matchers does Moq provide and when do you use each?
- How do you use Callback in Moq to capture or inspect method arguments?
- How do you set up a mock to return different values on successive calls?
- How does NSubstitute differ from Moq in syntax and philosophy?
- How do you mock protected or internal members in Moq?
- What is over-mocking and how do you avoid it?
- How do you mock HttpClient in .NET unit tests?
- How do you mock a property that has no setter in Moq?
- How do you raise events on a mock object using Moq?
- What is an auto-mocking container and when is it useful?
- How do you mock an abstract class in Moq?
Integration Testing
- What is the difference between unit testing and integration testing in .NET?
- What is WebApplicationFactory and how do you use it to test ASP.NET Core endpoints?
- Should you use the EF Core in-memory provider or SQLite for integration tests?
- How do you seed test data for integration tests in .NET?
- How do you test authenticated ASP.NET Core endpoints in integration tests?
- What are Testcontainers and when should you use them for .NET integration tests?
- How do you write integration tests that target a specific middleware component?
- How does xUnit handle parallel test execution and how do integration tests affect it?
- How do you test a typed HttpClient in ASP.NET Core?
- How do you test endpoints that use response caching in integration tests?
- How do you assert on ProblemDetails error responses in integration tests?
- How do you test that EF Core migrations apply cleanly in integration tests?
- How do you replace or add services in WebApplicationFactory for specific test scenarios?
- How do you integration-test a hosted background service (IHostedService) in .NET?
- How do you integration-test Minimal API endpoints in ASP.NET Core?
.NET Core Performance & Deployment
Caching
- Why is caching important in ASP.NET Core applications?
- How do you use IMemoryCache in ASP.NET Core?
- What is IDistributedCache and how does it differ from IMemoryCache?
- What is the cache-aside pattern and how is it implemented in .NET?
- What is response caching in ASP.NET Core and how do you enable it?
- What is output caching in .NET 7+ and how does it differ from response caching?
- What are the main strategies for cache invalidation in .NET?
- How do you connect to Redis in .NET and what is it used for beyond caching?
- What is a cache stampede and how do you prevent it in .NET?
- How do you limit memory usage in IMemoryCache?
- How does ASP.NET Core session storage relate to caching, and how do you configure it?
- What is HybridCache in .NET 9 and why was it introduced?
- How do you measure the impact of caching on ASP.NET Core application performance?
- What is cache warming and how do you implement it in ASP.NET Core?
- What are ETags and how do you implement HTTP conditional caching in ASP.NET Core?
Logging & Monitoring
- How does the built-in ILogger work in ASP.NET Core?
- What are the log levels in .NET and when should each be used?
- What is structured logging and why is it preferred over plain text logging?
- How do you configure Serilog in an ASP.NET Core application?
- What are log scopes in .NET and when do you use them?
- How do you implement health checks in ASP.NET Core?
- How do you emit custom metrics in .NET using System.Diagnostics.Metrics?
- What is distributed tracing in .NET and how does OpenTelemetry enable it?
- How do you log unhandled exceptions globally in ASP.NET Core?
- How do you avoid performance overhead from logging in hot paths?
- How do you integrate Application Insights with an ASP.NET Core application?
- How do you filter log output by namespace or provider in ASP.NET Core?
- How do you enrich log entries with ambient context (user, tenant, request ID) in .NET?
- How do you propagate a correlation ID across service boundaries in .NET?
- What is dotnet-monitor and how does it help diagnose production issues?
Deployment
- What are the different publish modes for a .NET application and when do you use each?
- What is Kestrel and why is it typically used behind a reverse proxy in production?
- How does ASP.NET Core handle configuration across different environments?
- How do you write a production-ready multi-stage Dockerfile for an ASP.NET Core application?
- How do you configure Kubernetes liveness and readiness probes for an ASP.NET Core app?
- How do you implement graceful shutdown in ASP.NET Core?
- How do you deploy an ASP.NET Core application to Azure App Service?
- How do you set up a CI/CD pipeline for a .NET application using GitHub Actions?
- How do you manage secrets securely in a .NET production deployment?
- What tools do you use to profile and diagnose performance issues in a .NET application?
- What is the production deployment checklist for an ASP.NET Core application?
- What are blue-green and rolling deployment strategies, and how do you implement them for .NET apps?
- How should you run Entity Framework Core migrations in a CI/CD pipeline?
- Why does ASP.NET Core Data Protection need special configuration in multi-instance deployments?
- How do resource limits in Docker and Kubernetes affect .NET runtime behaviour?
More ways to practice
The self-quiz is live. Get notified when mock interviews and new question packs drop.
or
Join our WhatsApp Channel