50 .
NET Interview
Questions & Answers –
Infosys Focus
DotNetMaster – Professional Career Services
We help you shine brighter in your .NET career journey with our expert-led, end-to-end
services:
1) Professional Resume Building
2) Mock Interviews (Company & Role Specific)
3) Mini & Major Project Guidance
4) Interview Preparation Guide
5) .NET Training & Placement Assistance
6) LinkedIn & Naukri Profile Optimization
.NET Framework & CLR
What is the .NET Framework?
The .NET Framework is a software development platform by Microsoft for building and
running applications on Windows, with support for languages like C#, VB.NET, and F#.
What is CLR?
The Common Language Runtime (CLR) is the execution engine for .NET, providing
services like memory management, type safety, exception handling, and garbage
collection.
What is CTS & CLS?
CTS (Common Type System) defines how data types are declared.
CLS (Common Language Specification) is a subset of CTS ensuring cross-language
compatibility.
What is an Assembly?
An Assembly is a compiled unit of code (.exe or .dll) containing metadata and IL code.
What is GAC?
Global Assembly Cache stores shared .NET assemblies for reuse by multiple
applications.
C# Language & OOP
What are the main OOP principles in .NET?
Encapsulation, Inheritance, Polymorphism, Abstraction.
Difference between abstract class and interface?
• Abstract: can have implementation, fields, constructors.
• Interface: only contracts, no implementation (prior to C# 8.0).
What is the difference between ref and out?
ref requires the variable to be initialized before passing.
out does not require initialization.
What are extension methods?
They allow adding methods to existing types without modifying their source.
What are nullable types?
A value type that can represent null (e.g., int?).
ASP.NET & Web Development
What is the difference between ASP.NET Web Forms & MVC?
• Web Forms: event-driven, stateful.
• MVC: stateless, follows Model-View-Controller pattern.
What are the different HTTP verbs and their use?
GET, POST, PUT, DELETE – for CRUD operations.
What is ViewState?
A mechanism to maintain page state across postbacks in Web Forms.
What is TempData in ASP.NET MVC?
A way to pass data between controller actions (stored temporarily).
How does routing work in MVC?
Maps incoming URLs to controller actions using route tables.
.NET Core & .NET 5/6+
What is .NET Core?
A cross-platform, open-source version of .NET for Windows, Linux, macOS.
Difference between .NET Framework and .NET Core?
.NET Framework is Windows-only; Core is cross-platform & lightweight.
What are Middleware in .NET Core?
Components that handle requests/responses in the pipeline.
How does dependency injection work in .NET Core?
Built-in DI container to inject services into constructors.
What are Minimal APIs?
Lightweight APIs introduced in .NET 6 with minimal boilerplate code.
Database & Entity Framework
What is Entity Framework?
An ORM to interact with databases using .NET objects.
Difference between EF Code First & Database First?
• Code First: define classes → generate DB.
• DB First: generate classes from DB.
What is lazy loading?
EF delays loading related entities until accessed.
What is LINQ?
Language Integrated Query – query collections & databases in a C#-like syntax.
How to handle transactions in EF?
Using DbContext.Database.BeginTransaction().
Memory & Performance
What is garbage collection?
Automatic memory management by CLR to reclaim unused memory.
What are generations in GC?
Gen 0, Gen 1, Gen 2 – objects move to higher generations if they survive collections.
What is boxing & unboxing?
Converting value type → object (boxing), and back (unboxing).
What are weak references?
References that don’t prevent an object from being collected.
What is async/await?
Keywords for writing asynchronous, non-blocking code.
Design Patterns & Best Practices
What is a Singleton pattern?
Ensures a class has only one instance globally.
What is Repository pattern?
Abstracts data access logic.
What is Dependency Injection pattern?
Provides dependencies from external sources.
What is CQRS?
Command Query Responsibility Segregation – separate read/write logic.
What are anti-patterns in .NET?
Hardcoding configs, tightly coupled code, no exception handling.
Web API & Services
Difference between SOAP & REST?
SOAP: XML-based, strict.
REST: lightweight, uses HTTP verbs.
How to secure Web APIs?
JWT tokens, OAuth, HTTPS.
What is CORS?
Cross-Origin Resource Sharing – allows controlled access to resources.
What are filters in Web API?
Enable cross-cutting concerns like authentication, logging.
How to version APIs?
Through URL, query string, headers.
Behavioral / Scenario-Based
Explain a challenging .NET bug you solved.
How do you ensure code quality?
How do you approach optimizing slow .NET applications?
How do you handle memory leaks in .NET?
How do you keep up with .NET advancements?
Miscellaneous & Latest Features
What is Span<T>?
A memory-efficient way to work with slices of arrays & strings.
What is Blazor?
A framework to build interactive web UIs using C#.
What is the difference between Task and Thread?
Task: logical unit of work, managed by .NET scheduler.
Thread: actual OS thread.
What is Nullable Reference Types in C# 8?
Helps avoid null reference exceptions by explicit nullable annotations.
What is MAUI?
Multi-platform App UI – write once, run on Android, iOS, Windows, macOS.
CHECK out success stories of dotnetmaster Instagram page :
https://www.instagram.com/dotnetmaster/