Top .NET Developer Interview Questions with Real-World Scenarios and Code Examples

Table of contents
- 1. C# Percentage Calculation – Logic Building
- 2. SQL Salary Filter – Query Writing
- 3. Web API Optimization – Best Practices
- 4. Handling 1 Lakh+ Records – Data Strategy
- 5. New Project Without a Manager – Ownership and Planning
- 6. Handling Git Merge Conflicts – Collaboration
- 7. C# Array Problem – Even Numbers
- 8. Explain Design Patterns – Conceptual Understanding

Whether you're a junior .NET developer or a mid-level engineer preparing for your next big interview, real-world problem-solving questions often separate strong candidates from the rest. In this blog, we'll explore practical and commonly asked .NET interview questions — with answers, code samples, and explanations.
1. C# Percentage Calculation – Logic Building
Question:
You are given an amount of 1000. First, add 10% of the amount, then add 18% of the new total. Write a C# program to calculate and print the final total.
Explanation:
This tests your understanding of percentage calculations and variable manipulation.
C# Solution:
using System;
class Program
{
static void Main()
{
double amount = 1000;
double tenPercent = amount * 0.10;
double firstTotal = amount + tenPercent;
double eighteenPercent = firstTotal * 0.18;
double finalTotal = firstTotal + eighteenPercent;
Console.WriteLine("Final Total: " + finalTotal);
}
}
Output:Final Total: 1298
2. SQL Salary Filter – Query Writing
Question:
Write an SQL query to fetch all employee records where the salary is greater than 5000. Sort the result in descending order of salary.
SQL Solution:
SELECT *
FROM Employees
WHERE Salary > 5000
ORDER BY Salary DESC;
Tip:
Always include indexing on the Salary
column for faster query execution if you're dealing with large datasets.
3. Web API Optimization – Best Practices
Question:
How can you optimize a Web API for better performance and scalability?
Answer:
Here are some common techniques used by .NET developers:
Enable response caching (using
[ResponseCache]
or middleware)Use asynchronous programming (
async/await
)Apply pagination for large datasets
Minimize payloads with DTOs and data shaping
Use dependency injection efficiently
Enable GZIP compression
Use EF Core query optimization (e.g.,
AsNoTracking()
, projection, filtering early)Implement rate limiting and API throttling
4. Handling 1 Lakh+ Records – Data Strategy
Question:
Assume your system needs to handle more than 1 lakh records. What strategies would you use to improve performance?
Techniques:
Server-Side Pagination (using
Skip()
andTake()
in EF Core)Indexing on frequently searched columns
Bulk Inserts/Updates using libraries like
EFCore.BulkExtensions
AsNoTracking for read-only data
Database views or stored procedures for complex logic
Background jobs (like Hangfire) for time-consuming tasks
Caching frequently accessed data using MemoryCache or Redis
5. New Project Without a Manager – Ownership and Planning
Scenario:
You’re starting a new project with one developer and no manager. You're responsible for client communication. How do you handle it?
Approach:
Requirement Gathering: Organize calls, document scope, prepare user stories
Planning: Use agile tools like Trello/Jira to track tasks
Tech Stack Selection: Decide backend (.NET), frontend (Angular/React), and database (SQL)
Version Control Setup: Git repo with branch policies
Testing Strategy: Unit tests, integration tests
Regular Client Updates: Weekly sprint demos and feedback collection
Risk Handling: Communicate blockers early, share responsibilities
Soft Skills Test:
This checks leadership, time management, and client handling capabilities.
6. Handling Git Merge Conflicts – Collaboration
Scenario:
You pushed code to a branch, causing conflicts for teammates. What next?
Steps to Handle:
Pull Latest Changes:
git pull origin main
Resolve Conflicts in files manually using VS Code or any merge tool
Mark as Resolved:
git add .
Commit and Push:
git commit -m "Resolved merge conflicts" git push origin your-branch
Communicate with your team about the resolution to avoid overlap
Pro Tip: Use feature branches and PR reviews to reduce conflict chances.
7. C# Array Problem – Even Numbers
Question:
Write a C# program to display all even numbers from a given array.
C# Solution:
using System;
class Program
{
static void Main()
{
int[] numbers = { 10, 23, 45, 68, 90, 11, 12 };
Console.WriteLine("Even Numbers:");
foreach (int num in numbers)
{
if (num % 2 == 0)
Console.WriteLine(num);
}
}
}
Output:
Even Numbers:
10
68
90
12
8. Explain Design Patterns – Conceptual Understanding
Question:
What are Design Patterns? Can you name and explain a few?
Answer:
Design Patterns are proven solutions to common software design problems. They improve code reusability, scalability, and readability.
Common Patterns in C#:
Pattern | Type | Example |
Singleton | Creational | One instance of Logger across app |
Factory | Creational | Creating objects without exposing class logic |
Repository | Structural | Abstracts data access logic |
Strategy | Behavioral | Replacing conditional logic with interchangeable algorithms |
Observer | Behavioral | Notification system when state changes (e.g., Event handling) |
Tip: Knowing when to use them matters more than memorizing them.
These types of real-world interview questions not only evaluate your coding skills but also how you approach problem-solving, communication, and project ownership.
If you're preparing for a .NET Developer interview, revisit:
Core C# programming logic
Entity Framework and SQL queries
API optimization and async handling
Git workflows and team collaboration
Design patterns and architecture
👉 Found this helpful? Follow DevDaily for more developer blogs every week!
✍ Written by Rishabh Mishra
Subscribe to my newsletter
Read articles from Rishabh Mishra directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by

Rishabh Mishra
Rishabh Mishra
Hey, I’m Rishabh — a developer who writes code like poetry and breaks things just to rebuild them better. .NET Full Stack Dev | Razor, C#, MVC, SQL, Angular — my daily playground. I believe in “learning out loud” — so I write about dev struggles, breakthroughs, and the weird bugs that teach the best lessons. From building ERP apps to tinkering with UI/UX — I turn business logic into beautiful experiences. Self-growth > Comfort zone | Debugging is my meditation Let’s turn curiosity into code — one blog at a time.