Prepare for your .NET Core interview with these 30 essential questions covering basic, intermediate, and advanced topics. Ideal for freshers, developers with 1-3 years, and 3-6 years of experience. Each question includes clear explanations and practical code examples.
Basic .NET Core Interview Questions (1-10)
1. What is .NET Core?
.NET Core is a cross-platform, open-source framework for building modern cloud-based applications. It supports Windows, macOS, and Linux with flexible deployment options[2].
2. What are the key characteristics of .NET Core?
.NET Core offers flexible deployment (side-by-side or self-contained), cross-platform support, and high performance through its modular design[2].
3. How does .NET Core differ from .NET Framework in deployment?
.NET Core supports self-contained deployment where the runtime is included in the app, while .NET Framework requires the full framework installation[3].
4. What is the role of the Common Language Runtime (CLR) in .NET Core?
The CLR manages code execution, memory management, and security. It converts CIL to machine code using JIT compilation[3].
5. What is Kestrel in .NET Core?
Kestrel is a cross-platform web server for ASP.NET Core applications, handling HTTP requests efficiently[1].
6. Explain the Program.cs structure in .NET Core.
The Program.cs contains the entry point with CreateHostBuilder or WebApplication factory to configure and run the application[1].
7. What is the purpose of appsettings.json in .NET Core?
appsettings.json stores configuration settings like connection strings and API keys, loaded via the Configuration system[1].
8. What are the main responsibilities of the Host in .NET Core?
The Host manages configuration, dependency injection, logging, lifetime management, hosting environment, and web server integration[1].
9. How do you run a .NET Core application?
Use dotnet run from the command line in the project directory, or publish with dotnet publish for deployment[2].
10. What is the default project structure in a new .NET Core web app?
Includes Program.cs, Controllers folder, wwwroot for static files, and appsettings.json[4].
Intermediate .NET Core Interview Questions (11-20)
11. What is Dependency Injection in .NET Core?
Dependency Injection (DI) provides dependencies to classes rather than creating them internally, reducing coupling and improving testability[1].
12. What are the three service lifetimes in .NET Core DI?
Singleton (one instance per application), Scoped (one instance per request), and Transient (new instance each time)[4].
services.AddSingleton<IMyService, MyService>();
services.AddScoped<IMyService, MyService>();
services.AddTransient<IMyService, MyService>();
13. How do you register services in .NET Core?
Services are registered in Program.cs using the DI container with extension methods like AddSingleton, AddScoped, or AddTransient[4].
14. What is the Options pattern in .NET Core?
The Options pattern uses strongly-typed classes bound to configuration sections via IOptions<T> for type-safe configuration access[1].
public class MySettings
{
public string ConnectionString { get; set; }
}
services.Configure<MySettings>(configuration.GetSection("MySettings"));
15. Explain Middleware in ASP.NET Core.
Middleware processes HTTP requests and responses in a pipeline. Each middleware can handle, modify, or short-circuit the request[4].
16. How do you create custom middleware in .NET Core?
Implement IMiddleware or use the generic middleware template with InvokeAsync method[1].
public async Task InvokeAsync(HttpContext context, RequestDelegate next)
{
await next(context);
}
17. What is Model Binding in ASP.NET Core?
Model Binding automatically maps HTTP request data (query strings, form values, route data) to action method parameters[4].
18. How does configuration binding work in .NET Core?
Configuration is bound using IConfiguration with methods like GetSection and strongly-typed options via DI[1].
19. What are Tag Helpers in ASP.NET Core?
Tag Helpers enable server-side HTML encoding with Razor syntax, making views more readable than HTML Helpers[1].
20. Explain Action Filters in ASP.NET Core MVC.
Action Filters run before or after action methods execute, useful for authorization, caching, and logging[4].
Advanced .NET Core Interview Questions (21-30)
21. What problems does Dependency Injection solve?
DI eliminates tight coupling, improves testability with mocks, enhances maintainability, and reduces code rigidity[1].
22. How does async/await work in .NET Core?
async/await enables non-blocking operations. The method after await executes after the awaited task completes, not immediately[2].
private async Task<bool> TestFunction()
{
var x = await DoesSomethingAsync();
var y = await DoesSomethingElseAsync(); // Executes after first await completes
return y;
}
23. What is the difference between in-memory cache and distributed cache?
In-memory cache is faster but lost on server restart; distributed cache persists across servers but has network latency[1].
24. Explain Finalize vs Dispose in .NET Core.
Finalize is called by GC for unmanaged resources (unreliable timing); Dispose should be called explicitly for deterministic cleanup[2].
25. How do you implement Health Checks in .NET Core?
Use AddHealthChecks in Program.cs and expose /health endpoint for monitoring application and dependencies[1].
builder.Services.AddHealthChecks()
.AddCheck("self", () => HealthCheckResult.Healthy());
26. What is Reflection and its use cases in .NET Core?
Reflection enables runtime inspection and manipulation of metadata, used in DI containers, serialization, and dynamic invocation[5].
Type type = typeof(string);
Console.WriteLine(type.FullName); // System.String
27. Scenario: At Zoho, how would you debug a 404 error in your .NET Core API?
Check endpoint registration, route constraints, middleware order, and output window logs. Verify the route template matches the request[4].
28. Scenario: At Salesforce, how would you handle high-traffic scenarios in .NET Core?
Implement response caching, use distributed cache, apply rate limiting middleware, and optimize database queries with async operations[1].
29. What is the Hosted Services feature in .NET Core?
Hosted Services run background tasks alongside the application using IHostedService interface[1].
30. Scenario: At Atlassian, how would you implement cross-cutting concerns like logging?
Use built-in logging with ILogger injected via DI, configure multiple providers (Console, File, Application Insights), and structured logging[1].
Master these .NET Core interview questions to excel in technical interviews across product companies, SaaS platforms, and startups.