100 C# Interview Questions for Senior Developers π
Introduction
C# remains one of the most powerful and versatile programming languages in the .NET ecosystem. For senior developers, especially those working with APIs, microservices, and enterprise applications, mastering advanced C# concepts is essential. This blog organizes 100 commonly asked C# interview questions into structured sections, making it easier to study and prepare.
1. C# Core / Advanced
What is the difference between value type and reference type?
Explain boxing and unboxing.
What is the difference between const, readonly, and static readonly?
Difference between ref, out, and in?
Difference between is and as?
What is nullable reference type?
What is pattern matching in C#?
Difference between record, class, and struct?
What is covariance and contravariance?
Explain extension methods.
2. OOP / SOLID
Explain SOLID principles with real examples.
What is abstraction vs encapsulation?
Difference between abstract class and interface?
Can interface have implementation?
What is multiple inheritance issue?
What is composition over inheritance?
What is dependency inversion principle?
What is Liskov substitution principle?
What is interface segregation principle?
What is open/closed principle?
3. Delegates / Events
What is a delegate?
What is multicast delegate?
Difference between delegate and event?
What is Func<>?
What is Action<>?
What is Predicate<>?
Where have you used events in real project?
4. Exception Handling
Difference between throw and throw ex?
How to create custom exception?
What is global exception handling?
How to handle exceptions in middleware?
Difference between finally and finalize?
5. Collections / LINQ
Difference between Array, ArrayList, and List<T>?
Difference between Dictionary and Hashtable?
Difference between HashSet and List?
What is IEnumerable?
What is IEnumerator?
Difference between IEnumerable and IQueryable?
Deferred execution vs immediate execution?
Difference between First, FirstOrDefault, Single, SingleOrDefault?
6. Async / Threading
What is async/await?
How async/await works internally?
Difference between Task and Thread?
Difference between Task and ValueTask?
What is deadlock?
How deadlock happens in async code?
What is lock keyword?
Difference between lock, Monitor, Mutex, Semaphore?
What is ThreadPool?
Difference between parallelism and concurrency?
7. Memory Management / GC
How Garbage Collector works?
Explain generations in GC?
What is Large Object Heap?
What is memory leak in .NET?
What is IDisposable?
Difference between Dispose and Finalize?
What is using statement?
8. Design Patterns
Explain Singleton pattern.
Explain Factory pattern.
Explain Repository pattern.
Explain Unit of Work.
Explain Strategy pattern.
Explain Mediator pattern.
Explain CQRS pattern.
Explain Decorator pattern.
Explain Observer pattern.
Explain Builder pattern.
9. ASP.NET Core / API
Explain middleware in ASP.NET Core.
Order of middleware execution?
How routing works?
What is model binding?
What is dependency injection?
Explain service lifetimes.
Difference between Singleton, Scoped, and Transient?
How authentication works in API?
JWT token flow?
Difference between OAuth2 and OpenID Connect?
10. Security
How to secure microservices?
What is rate limiting?
What is CORS?
What is CSRF?
What is XSS?
What is SQL Injection?
What is HTTPS/TLS?
What is mTLS?
11. Entity Framework / Database
What is Entity Framework Core?
Difference between eager, lazy, explicit loading?
What is tracking vs no-tracking?
What is N+1 problem?
How transactions work in EF Core?
How to optimize slow query?
Difference between stored procedure and EF?
12. Microservices / Architecture
What is microservices architecture?
Difference between monolith and microservices?
What is Saga pattern?
What is Circuit Breaker?
What is API Gateway?
What is Service Bus / Kafka / RabbitMQ?
How to handle distributed transactions?
How do you troubleshoot production issues?
Conclusion
These 100 questions cover the breadth of C# knowledge expected from senior developers. From core language features and OOP principles to advanced topics like async programming, design patterns, and microservices architecture, this list serves as a comprehensive guide for interview preparation. By mastering these topics, you’ll not only be ready for interviews but also equipped to build robust, scalable, and secure applications in real-world scenarios.
This was part of Interview Preparation With Bipin — Let’s Crack It!
Comments
Post a Comment