1. Basic .NET Concepts
What is the .NET Framework?
A software framework by Microsoft that provides a runtime (CLR) and libraries for building applications.
What is CLR (Common Language Runtime)?
The execution engine that manages memory, security, and exception handling for .NET applications.
What is CTS (Common Type System) and CLS (Common Language Specification)?
CTS defines data types across .NET languages.
CLS ensures language interoperability by defining rules.
What is Managed vs Unmanaged Code?
Managed code runs under CLR control (e.g., C#).
Unmanaged code runs outside CLR (e.g., C++ native code).
2. C# Fundamentals
What are the main differences between C# and Java?
C# has properties, delegates, events, and
structs
(value types), while Java relies more on interfaces.
What is boxing and unboxing?
Boxing: Converting a value type to an object (e.g.,
int
toobject
).Unboxing: Converting an object back to a value type.
What is the difference between
==
and.Equals()
?==
compares references (for objects) or values (for primitives)..Equals()
compares content (can be overridden).
What are value types vs reference types?
Value types (
int
,struct
) store data directly.Reference types (
class
,string
) store memory references.
3. OOP Concepts
What are the four pillars of OOP?
Encapsulation, Inheritance, Polymorphism, Abstraction.
What is the difference between
abstract class
andinterface
?Abstract class can have method implementations; interface cannot (until C# 8.0).
A class can inherit only one abstract class but multiple interfaces.
What is method overloading vs overriding?
Overloading: Same method name, different parameters (compile-time).
Overriding: Redefining a method in a derived class (runtime, using
virtual
/override
).
4. Memory Management & Garbage Collection
What is Garbage Collection (GC) in .NET?
Automatic memory management by CLR that reclaims unused objects.
What are generations in GC (Gen 0, Gen 1, Gen 2)?
Objects are promoted through generations based on lifespan (Gen 0 = short-lived, Gen 2 = long-lived).
What is the
IDisposable
interface?Used to release unmanaged resources (e.g., file handles) via the
Dispose()
method.
What is the
using
statement in C#?Ensures
Dispose()
is called automatically (syntactic sugar fortry-finally
).
5. Asynchronous Programming
What is the difference between
Task
andThread
?Thread
is a low-level OS construct.Task
is a higher-level abstraction for async operations (uses thread pool).
What are
async
andawait
?async
marks a method as asynchronous.await
pauses execution until the task completes.
What is deadlock in async programming?
Occurs when two tasks wait indefinitely for each other (e.g., due to
.Result
or.Wait()
misuse).
6. ASP.NET & Web APIs
What is the difference between ASP.NET MVC and Web API?
MVC returns views (HTML), Web API returns data (JSON/XML).
What is Middleware in ASP.NET Core?
Components that handle requests/responses (e.g., authentication, logging).
What is Dependency Injection (DI)?
A design pattern where dependencies are injected rather than created inside a class.
What is JWT (JSON Web Token)?
A token-based authentication mechanism used in APIs.
7. Entity Framework (ORM)
What is Entity Framework?
An ORM (Object-Relational Mapper) for database operations using C# objects.
What is the difference between
IQueryable
andIEnumerable
?IQueryable
executes queries on the database.IEnumerable
executes queries in memory.
What are LINQ and its types (Query vs Method Syntax)?
LINQ (Language Integrated Query) allows querying collections.
Query Syntax: SQL-like (e.g.,
from x in list select x
).Method Syntax: Fluent (e.g.,
list.Where(x => x > 5)
).
8. Advanced Topics
What is Reflection in .NET?
Inspecting types/metadata at runtime (e.g.,
typeof()
,GetMethod()
).
What is a Delegate and an Event?
Delegate: A type-safe function pointer.
Event: A mechanism for notification (uses delegates).
What is Dependency Injection (DI) in .NET Core?
Built-in IoC container for managing object lifetimes (e.g.,
AddScoped
,AddSingleton
).
What is SignalR?
A library for real-time web functionality (e.g., chat apps).
What is .NET Core vs .NET Framework vs .NET 5/6/7/8?
.NET Framework: Windows-only.
.NET Core: Cross-platform, open-source.
.NET 5+: Unified platform (successor to both).
Final Tips
Be ready for coding challenges (e.g., reverse a string, Fibonacci series).
Know design patterns (Singleton, Factory, Repository).
Understand REST principles if applying for API roles.
Practice Entity Framework queries and performance tuning.
No comments:
Post a Comment