Complete .
NET Interview Questions & Answers
1. C# & OOP Interview Questions
- OOP pillars: Encapsulation, Abstraction, Inheritance, Polymorphism.
- Encapsulation: Hides internal data using private fields and public properties.
- Abstraction: Shows only essential details using interfaces/abstract classes.
- Abstract class vs Interface: Abstract can have both abstract/non-abstract methods; Interface cannot
have fields or constructors.
- Overloading vs Overriding: Overloading at compile-time; Overriding at runtime.
- Value vs Reference types: Value stores actual value; Reference stores memory address.
- Const vs Readonly: Const is compile-time; Readonly is runtime.
- Static class: Cannot be instantiated; all members static.
- Boxing/Unboxing: Value to object / Object to value.
2. .NET Core Concepts
- Request pipeline: Sequence of middlewares handling HTTP requests.
- Middleware: Component to process request/response.
- Dependency Injection: AddScoped, AddTransient, AddSingleton.
- Scoped vs Transient vs Singleton: Per request / every call / whole app.
- IOptions: static; IOptionsSnapshot: per-request; IOptionsMonitor: real-time updates.
- Kestrel: Default cross-platform server.
- Configuration: Read from [Link], environment variables.
3. Entity Framework Core
- DbContext: Manages DB connection and CRUD.
- LINQ: Query language in C#.
- Eager vs Lazy loading: Include loads immediately; lazy loads later.
- Change Tracking: Tracks entity state.
- Migration: Update DB schema from code.
- NoTracking: Boosts performance for read operations.
- Repository Pattern: Decouples DB code.
4. [Link] Core Web API
- Controller: Handles HTTP requests.
- Routing: Maps URLs to actions.
- Model Binding: Converts request data to method parameters.
- DTO: Data Transfer Object, hides entity model.
- JWT Auth: Token with header, payload, signature.
- PUT vs PATCH: Replace whole record / partial update.
- Global Exception Handling: Middleware-based handling.
5. Architecture (3-Tier / Clean Architecture)
- Controller → Service → Repository → Database.
- SOLID: 5 principles for clean architecture.
- MediatR: Implements CQRS and request pipeline.
6. SQL Concepts
- INNER vs LEFT join: Matching rows / all left rows.
- Stored Procedure: Pre-compiled SQL.
- Clustered vs Non-Clustered index: Actual data order / pointer-based.
- View: Virtual table.
- Transaction: Ensures ACID.
- Group By vs Having: Group / filter group.
7. Real-Time Concepts
- Pagination: Skip() and Take().
- Secure connection strings: User secrets, Key Vault.
- Async/await: Non-blocking operations.
- Logging: Console/file/database providers.
- EF Optimizations: AsNoTracking, projections, avoiding N+1, indexes.