These questions test foundational conceptual mastery, syntax accuracy, and core theoretical knowledge:
Q1. What is .NET Core and how does it differ from traditional .NET Framework?
Foundation • 0-2 Yrs
.NET Framework was Windows-only, tightly coupled to IIS and the Windows OS. .NET Core (and modern unified .NET 6/7/8/9) is cross-platform (runs natively on Linux, macOS, Windows, Docker), modular, open-source, features high performance (Kestrel web server), and supports side-by-side version deployments.
Q2. What is the Common Language Runtime (CLR) and Common Type System (CTS)?
Foundation • 0-2 Yrs
The CLR is the virtual machine execution engine of .NET that compiles Intermediate Language (IL) code into native machine code using Just-In-Time (JIT) compilation, managing memory, thread execution, and security. CTS defines the standard data types and rules supported across all .NET languages.
Q3. Explain the difference between Value Types and Reference Types in C#.
Foundation • 0-2 Yrs
Value Types (structs, primitives: int, float, bool, char, enum) store their data directly in memory (typically allocated on the Stack) and are copied by value. Reference Types (classes, strings, arrays, delegates, interfaces) store a memory address pointer pointing to heap-allocated objects.
Q4. What is Boxing and Unboxing in C# and what is its performance impact?
Foundation • 0-2 Yrs
Boxing: Converting a value type to a reference type (object or interface) by allocating an object on the heap and copying the value into it. Unboxing: Explicitly extracting the value type from the object reference back to the stack. Excessive boxing causes high heap allocations and GC overhead.
Q5. What is the difference between string and StringBuilder in C#?
Foundation • 0-2 Yrs
string is immutable; any modification (concatenation) allocates a new string object on the heap. StringBuilder (in System.Text) is mutable, maintaining an internal character buffer that expands dynamically, delivering superior performance for high-volume string concatenation.
Q6. Explain the difference between 'ref', 'out', and 'in' parameter modifiers.
Foundation • 0-2 Yrs
'ref': Variable must be initialized before passing; allows method to read and modify original value. 'out': Variable does not need prior initialization; method MUST assign a value before returning. 'in' (introduced in C# 7.2): Passes variable by reference for performance but enforces read-only immutability.
Q7. What are Generics in C# and why are they preferred over ArrayList?
Foundation • 0-2 Yrs
Generics (List, Dictionary) allow defining type-safe classes, interfaces, and methods with deferred type parameters. They eliminate the high performance penalty of boxing/unboxing and catch type mismatches at compile-time rather than runtime.
Q8. What is the difference between an Abstract Class and an Interface in C#?
Foundation • 0-2 Yrs
Abstract Class: Can contain instance fields, constructors, and concrete method implementations, and supports single inheritance. Interface: Pure contract defining method signatures without instance state (supports default implementations in C# 8+), and a class can implement multiple interfaces.
Q9. What is LINQ (Language Integrated Query) and what are its two syntaxes?
Foundation • 0-2 Yrs
LINQ provides native, type-safe data querying capabilities inside C# across collections, databases (EF Core), and XML. Syntaxes: Query Syntax (SQL-like: from x in list where x > 5 select x) and Method/Fluent Syntax (lambda expressions: list.Where(x => x > 5).Select(x => x)).
Q10. What is the difference between IEnumerable and IQueryable in LINQ?
Foundation • 0-2 Yrs
IEnumerable (in System.Collections): Executes in-memory (client-side evaluation); pulling data from DB brings all records into memory before filtering. IQueryable (in System.Linq): Builds an Expression Tree translated into native SQL queries executed on the database server, returning only filtered rows.
Q11. Explain Dependency Injection lifetimes in ASP.NET Core (Transient vs Scoped vs Singleton).
Foundation • 0-2 Yrs
Transient (AddTransient): New instance created every time requested. Scoped (AddScoped): New instance created once per client HTTP request cycle (standard for DbContext). Singleton (AddSingleton): Exactly one instance created on initial request and shared across all requests for the application lifetime.
Q12. What is Middleware in ASP.NET Core and how does the pipeline work?
Foundation • 0-2 Yrs
Middleware consists of software components assembled into an application pipeline to handle HTTP requests and responses. Each component can inspect the request, invoke the next middleware via next(), and execute logic on the return response path (e.g., Exception Handling, Routing, Authentication, Static Files).
Q13. What is the 'async' and 'await' pattern in C# and how does it prevent thread blocking?
Foundation • 0-2 Yrs
async/await enables non-blocking asynchronous programming. When execution hits 'await' on an I/O-bound task, the current thread is immediately released back to the thread pool to serve other requests; when the async operation finishes, a thread pool worker resumes execution from the continuation point.
Q14. What is the purpose of the 'using' statement and the IDisposable interface?
Foundation • 0-2 Yrs
The 'using' statement guarantees deterministic disposal of unmanaged resources (database connections, file handles). It ensures that the object's Dispose() method is invoked immediately upon exiting the scope, even if an unhandled exception occurs (syntactic sugar for try-finally).
Q15. What are Nullable Value Types and the Null-Coalescing operator (??)?
Foundation • 0-2 Yrs
Value types cannot normally hold null. Appending '?' (e.g., int?) allows value types to store null. The null-coalescing operator 'a ?? b' evaluates to 'a' if 'a' is not null; otherwise, it returns fallback value 'b'. The '??=' operator assigns only if the left-hand variable is null.