Top 20+ Dotnet Technical Interview Questions for junior and senior roles
Here is a wide range of topics related to .NET Core, C#, APIs, Microservices, SQL, RabbitMQ, and Azure Service Bus for who trying dotnet developer jobs.
Also, a breakdown of some key questions that came up – enrichvia sharing you to help prepare!!
C#:
1. Explain the Garbage Collector and its generation details.
2. IDisposable vs Finalizer – what’s the difference, and when to use each?
3. Describe Delegates and Events.
4. If three tasks are running in parallel and one fails, how would you stop the other two? Explain the approach.
5. When would you choose an Interface over an Abstract Class?
6. What is the Liskov Substitution Principle?
7. Describe the Design Patterns you used in recent projects.
8. What are Generics in C#, and why are they useful?
9. Explain the purpose and use of Extension Methods.
10. What is a Record in C#?
11. What are some of the new features in C# 12?
12. Types of Delegates in LINQ.
API:
1. HTTP PUT vs. HTTP PATCH – when to use each?
2. How would you implement Authentication and Authorization in an API?
3. When using JWT, how does the Web API validate a token’s authenticity?
4. What is Middleware in .NET Core, and how have you implemented it?
5. In Middleware, if you want to log a message for GET/POST requests and a different message for PUT requests, how would you set this up?
Microservice:
1. In what situations should you consider implementing Microservices?
2. Explain the CQRS (Command Query Responsibility Segregation) pattern.
3. Suppose you have three microservices, each with its own database. If the third service fails, how would you roll back changes in the first two?
SQL:
1. What is a CTE (Common Table Expression)?
2. CTE vs. Temporary Tables – when would you use each?
3. How would you efficiently insert 1 million (10 lakh) records?
4. Discuss SQL query performance tuning techniques.
5. When would you use a Self Join?
6. Explain the differences between RANK, DENSE_RANK, and ROW_NUMBER.
7. Stored Procedure vs. Function – which is better for specific scenarios?
.Net Core:
1. Differences between .NET 8.0 and earlier versions.
2. How do you implement Caching in .NET Core?
3. Describe Dependency Injection (DI) and its lifetimes (Transient, Scoped, Singleton).
RabbitMQ:
1. How do you handle reading messages once they’re received in the queue? Describe your approach.
Azure Service Bus:
1. How would you increase the message lifetime duration in Azure Service Bus?
2. If a message needs to be sent to multiple receivers, how would you implement it?