C#, .NET and SQL Server Interview Questions
This page collects every interview question topic on MakeMyCodes in one place, grouped by subject. Each topic is a complete article: it explains the concept in simple words, shows working code with real output, compares the options side by side, and ends with the follow-up questions interviewers usually ask next.
The questions are the ones that come up again and again in interviews for .NET developer roles, from freshers to developers with five or more years of experience. Interviewers rarely stop at a definition; they ask "what is the output?", "when would you use it?" and "where did you use it in your project?". The articles are written to help you answer those deeper questions with confidence.
C# language
| Topic | What you will learn |
|---|---|
| var vs dynamic | Compile-time vs runtime typing, the errors each produces, and var vs object vs dynamic |
| readonly vs const vs static | When each value is fixed and where it can be assigned |
| Boxing and unboxing | What happens in memory, InvalidCastException, hidden boxing and its measured performance cost |
| Parameter passing: ref, out, in, params | Value vs reference passing, overloading rules and 10 "what is the output" puzzles |
| IEnumerable vs List | How each is implemented, and when to use IEnumerable or List |
| Extension methods | What extension methods are and how to write one |
| Constructors in C# | What constructors are and the types of constructors in C# |
| Reverse a string in C# | Several ways to solve a classic coding question, and which one to use |
Object-oriented design
| Topic | What you will learn |
|---|---|
| Abstract vs sealed class | Opposite purposes, when to use each, and why a class can't be both |
| Sealed vs static class | How the two class modifiers differ in inheritance and instances |
| Static class vs singleton | A keyword vs a design pattern, and when to use each |
| Dispose vs Finalize | Releasing resources deterministically vs relying on the garbage collector |
| SOLID principles | 28 questions on SRP, OCP, LSP, ISP and DIP, with scenario-based answers |
.NET and ASP.NET Core
| Topic | What you will learn |
|---|---|
| .NET Framework vs .NET Core | History, 15-point comparison, advantages, disadvantages and migration |
| ViewBag vs ViewData vs TempData | Lifetimes, redirects, Peek and Keep, and when to use a ViewModel instead |
| In-memory vs distributed caching | The two caching approaches and when each fits |
| Application performance | Do's and don'ts for faster .NET applications |
| Application security | Do's and don'ts for securing .NET applications |
SQL Server
| Topic | What you will learn |
|---|---|
| DELETE vs TRUNCATE | Logging, identity reset, triggers, rollback and permissions, with real output |
| Find the Nth highest salary | Several solutions compared, including ties and departments |
| Stored procedure vs function | The differences between the two and where each can be used |
| Temp table vs CTE | How they differ and when to choose each |
| Date functions in SQL Server | The date and time functions you use most often |
Also useful for interviews
These tutorials are not written as question lists, but they cover topics interviewers ask about all the time, and each one ends with interview questions:
- GET vs POST and PUT vs PATCH in Web API
- Routing in ASP.NET Core MVC
- Filters in ASP.NET Core
- AddTransient vs AddScoped vs AddSingleton
- Garbage collection and memory management
- async and await in C#
- SQL joins and window functions
How to prepare for a .NET interview
- Understand, don't memorise. For every topic, be able to explain why it works the way it does. "TRUNCATE is faster because it deallocates pages instead of logging each row" is a much stronger answer than "TRUNCATE is faster".
- Run the code yourself. Copy the examples into a console app or SQL Server Management Studio and change them. Output questions ("what does this print?") are easy once you have seen the behaviour with your own eyes.
- Prepare a project example for each big topic. For SOLID, caching, dependency injection or async, have one short story ready: "In our order system we used..." Interviewers trust real experience more than definitions.
- Learn the comparisons. Most questions are "X vs Y". Each article has a comparison table; reading those tables the day before an interview is excellent revision.
- Know the trade-offs. Senior interviews ask "when would you not use it?". Every topic has a cost: performance, complexity or testability.
- Practise SQL by hand. Write the Nth highest salary, joins and GROUP BY queries without help, because many interviews include a live SQL task.
Found a question that isn't covered, or an answer you think could be better? Write to contactus@makemycodes.com. New topics are added regularly.