Prepare for your .NET Core interview with this comprehensive guide featuring 30 essential questions categorized by difficulty. Covering conceptual, practical, and scenario-based topics, these questions target freshers, 1-3 years, and 3-6 years experienced developers working with .NET Core applications.
Basic .NET Core Interview Questions (1-10)
1. What are the key characteristics of .NET Core?
Answer: .NET Core offers flexible deployment options where it can be included in your app or installed side-by-side. It is cross-platform, running on Windows, macOS, and Linux, with support growing for more OS, CPUs, and scenarios.[1]
2. What is the Common Language Runtime (CLR) in .NET Core?
Answer: CLR is the execution engine that manages code execution, converts Common Intermediate Language (CIL) to machine code via JIT compiler, and handles memory management and security.[2]
3. Explain the difference between .NET Framework and .NET Core deployment models.
Answer: .NET Core supports side-by-side deployment where updated versions install in new folders without affecting existing apps. .NET Framework deploys updates primarily through IIS, affecting all applications.[2]
4. What is CoreCLR in .NET Core?
Answer: CoreCLR is the .NET Core runtime that includes the CLR, JIT compiler, and base class libraries optimized for cross-platform execution.[1]
5. What does Common Language Specification (CLS) mean in .NET Core?
Answer: CLS defines rules for language interoperability, ensuring components written in different .NET languages can work together seamlessly.[1]
6. Differentiate between managed and unmanaged code in .NET Core.
Answer: Managed code runs under CLR control with automatic memory management. Unmanaged code runs outside CLR, requiring manual memory handling.[1]
7. What is .NET Standard in the context of .NET Core?
Answer: .NET Standard is a specification for common APIs that multiple .NET implementations like .NET Core must support for library compatibility.[1]
8. How does the .NET Core compilation process work?
Answer: Source code compiles to CIL stored in assemblies (.dll/.exe). CLR uses JIT compiler to convert CIL to native machine code at runtime.[2]
9. What are the supported platforms for .NET Core applications?
Answer: .NET Core runs on Windows, macOS, and Linux, with extensible support for additional operating systems.[1]
10. What is RyuJIT in .NET Core?
Answer: RyuJIT is the high-performance JIT compiler used in .NET Core for converting CIL to optimized native code.[1]
Intermediate .NET Core Interview Questions (11-20)
11. Explain the three dependency injection lifetimes in ASP.NET Core.
Answer: Singleton creates one instance for the app lifetime. Scoped creates one instance per request. Transient creates a new instance every time requested.[3]
12. What is middleware in ASP.NET Core?
Answer: Middleware components form the request processing pipeline in the Configure method, handling requests sequentially for features like authentication and logging.[2]
13. How does async/await work in .NET Core? Consider this example:
private async Task<bool> TestFunction()
{
var x = await DoesSomethingExists();
var y = await DoesSomethingElseExists();
return y;
}
Answer: The second await executes after the first completes. Each await yields control until its task finishes, enabling non-blocking execution.[1]
14. What are the two main deployment types for .NET Core applications?
Answer: Framework-dependent requires .NET Core runtime installed separately. Self-contained includes runtime in the app for standalone deployment.[1]
15. Explain the difference between .NET Standard and Portable Class Libraries (PCL).
Answer: .NET Standard is a single API specification for all .NET platforms. PCL targets specific platform combinations with limited API surface.[1]
16. Why is the order of middleware important in ASP.NET Core?
Answer: Middleware processes requests sequentially; incorrect order can cause unexpected behavior as each component modifies requests/responses before passing forward.[4]
17. What is Reflection used for in .NET Core?
Answer: Reflection enables runtime metadata inspection, dynamic method invocation, object creation, and supports serialization and DI frameworks.[4]
18. How do you implement Dependency Injection in ASP.NET Core?
Answer: Register services in ConfigureServices with lifetimes, then inject via constructor in controllers or services. ASP.NET Core has built-in DI container.[3][5]
19. Example of using Reflection to invoke a method dynamically:
MethodInfo method = typeof(Console).GetMethod("WriteLine", new[] { typeof(string) });
method.Invoke(null, new object[] { "Hello, Reflection!" });
Answer: This code retrieves method info and invokes it at runtime without compile-time binding.[4]
20. What advantages does .NET Core offer for container deployment?
Answer: Its lightweight, modular design makes deployment in containers easy across Linux, Windows, and cloud platforms.[2]
Advanced .NET Core Interview Questions (21-30)
21. Scenario: At Zoho, how would you debug a 404 error in an ASP.NET Core API endpoint?
Answer: Check client dev tools for response details. Verify endpoint registration, route constraints, filters, and IDE output window for exceptions.[3]
22. Explain Finalize vs Dispose pattern in .NET Core.
Answer: Finalize is garbage collector-called for cleanup (unreliable timing). Dispose is explicitly called for deterministic resource cleanup implementing IDisposable.[1]
23. What are the types of JIT compilation in .NET Core?
Answer: EconoJIT (fast, no optimizations), Tiered Compilation (EconoJIT first, then RyuJIT for hot methods), and ReadyToRun (pre-JIT).[1]
24. Scenario: In a Paytm-like high-traffic app, when would you use Singleton vs Scoped services?
Answer: Use Singleton for stateless, expensive services shared across requests. Use Scoped for request-specific data like database contexts to avoid sharing state.[3]
25. Compare abstract classes and interfaces in .NET Core:
| Feature | Abstract Class | Interface |
|---|---|---|
| Method Implementation | Can have concrete methods | No implementations (except default in C# 8+) |
| Inheritance | Single inheritance only | Multiple inheritance |
| Fields | Can have fields/properties | No fields/constructors |
Answer: Choose based on shared implementation needs vs contract definition.[4]
26. What is the request processing pipeline in ASP.NET Core MVC?
Answer: Middleware pipeline handles requests via delegates. MVC actions use model binding for strongly-typed parameters and return HTML/JSON responses.[3]
27. Scenario: At Salesforce, how would you handle unnecessary data loading in EF Core?
Answer: Use explicit loading or projection to load only required data instead of lazy loading which can cause N+1 query problems.[5]
28. What’s the difference between RyuJIT and Roslyn in .NET Core?
Answer: RyuJIT is the JIT compiler for runtime code generation. Roslyn is the C#/VB compiler producing CIL from source code.[1]
29. Explain synchronous vs asynchronous programming in .NET Core.
Answer: Synchronous blocks threads until completion. Asynchronous uses async/await for non-blocking I/O, improving scalability in high-throughput apps.[5]
30. In an Atlassian scenario with microservices, why choose .NET Core?
Answer: .NET Core’s cross-platform support, lightweight CLI tools, and container-friendly deployment enable scalable microservices across diverse environments.[2]