LEARN BUILD GROW TOGETHER
DEVELOPER LEARNING HUB
Learn. Build. Grow Together.

Practical tutorials, real-world examples and interview preparation.

.NETC#SQL SERVERANGULAR
Home /.NET /50 Scenario-Based .NET Developer Interview Questions (4–6 Years Experience)

50 Scenario-Based .NET Developer Interview Questions (4–6 Years Experience)


With 4–6 years of experience in .NET development, interviewers expect candidates to understand more than programming syntax and framework fundamentals. They want to know how you handle real-world development challenges, troubleshoot production issues, optimize application performance, and make technical decisions.

This question bank contains 50 scenario-based interview questions for mid-level .NET developers, covering C#, ASP.NET Core Web API, Entity Framework Core, SQL Server, Angular integration, security, architecture, and deployment.

Section 1: C# and .NET Core Scenarios

  1. You have a method that processes thousands of records, but it is taking too much time. How would you identify the bottleneck and optimize the method?

  2. Your application uses multiple services, and one service depends on another service. How would you manage dependency injection and avoid tightly coupled classes?

  3. You have registered a service as Singleton, but it depends on a Scoped service. What problem could occur, and how would you fix it?

  4. A method performs multiple independent API calls sequentially. How would you improve its execution time using asynchronous programming?

  5. Your application is consuming more memory over time. How would you investigate possible memory leaks in a .NET application?

  6. You need to process a large CSV file containing millions of records. Would you load the entire file into memory or process it in chunks? Explain your approach.

  7. An exception occurs in a background service, and the service stops processing. How would you handle exceptions and ensure the worker continues safely?

  8. You have multiple classes implementing the same interface, and different consumers require different implementations. How would you resolve the correct implementation through dependency injection?

Section 2: ASP.NET Core Web API Scenarios

  1. Your API receives thousands of requests within a short period, and the server becomes slow. How would you investigate and improve API performance?

  2. A client submits the same POST request multiple times because of network retries. How would you prevent duplicate database records?

  3. Your API takes 10 seconds to return a response. How would you determine whether the delay is caused by the database, business logic, or an external API?

  4. You need to implement global exception handling across all controllers. How would you design it?

  5. Your API is accessed by an Angular application hosted on a different domain, but browser requests are failing due to CORS. How would you troubleshoot and resolve this?

  6. You need to restrict an API so that a particular user cannot make more than 100 requests per minute. How would you implement this?

  7. An API endpoint returns all records from a table containing millions of rows. How would you redesign the endpoint to improve performance?

  8. Your application needs to support multiple API versions without breaking existing clients. How would you implement API versioning?

  9. An API is working correctly in development but returning HTTP 500 errors in production. How would you investigate the issue?

  10. You need to call a third-party API, but sometimes it takes too long to respond or becomes unavailable. How would you implement timeout, retry, and failure-handling mechanisms?

Section 3: Entity Framework Core and SQL Server Scenarios

  1. An EF Core query is taking several seconds to execute, even though the table contains only a few thousand records. How would you investigate and optimize it?

  2. Your application executes hundreds of SQL queries when retrieving a list of customers and their orders. How would you identify and resolve the N+1 query problem?

  3. You need to retrieve data for reporting purposes, but you do not need to update the retrieved entities. How would you optimize the EF Core query?

  4. Two users update the same record simultaneously. How would you prevent one user's changes from silently overwriting the other's changes?

  5. Your application needs to insert records into three related tables. If inserting into the third table fails, the first two inserts should also be rolled back. How would you implement this?

  6. A stored procedure returns thousands of records, and you need to consume its result in an ASP.NET Core Web API. How would you implement this using EF Core or Dapper?

  7. Your application has a large database, and a migration changes an important table. How would you plan and execute the migration safely in production?

  8. A SQL query performs well with a small dataset but becomes very slow when the table grows. What would you investigate in SQL Server?

  9. You need to retrieve only selected columns from a database instead of loading complete entities. How would you implement this in EF Core?

  10. Your application frequently reads the same reference data, such as countries, states, and categories. How would you reduce repeated database calls?

Section 4: Authentication, Authorization, and Security Scenarios

  1. Your Angular application sends a JWT token to an ASP.NET Core API, but the API returns 401 Unauthorized. How would you troubleshoot the issue?

  2. A user can successfully log in but can access an API endpoint that should be restricted to administrators. How would you investigate and fix the authorization issue?

  3. Your application has different permissions for users belonging to different departments. Would you use role-based or policy-based authorization? Explain your design.

  4. You need to implement refresh tokens so that users do not have to log in again whenever their access token expires. How would you design this mechanism?

  5. Your API accepts uploaded files from users. How would you protect the application against malicious or oversized file uploads?

  6. A developer accidentally exposes database credentials in appsettings.json in a public repository. What steps would you take to secure the credentials and prevent similar incidents?

  7. Your application is vulnerable to SQL injection because it builds SQL queries using string concatenation. How would you fix the issue?

  8. An API endpoint contains sensitive information in its response, even though the user is authenticated. How would you ensure that users can access only the data they are authorized to see?

Section 5: Angular and .NET Full-Stack Integration Scenarios

  1. Your Angular application calls an ASP.NET Core Web API, but the API response is not displayed correctly. How would you troubleshoot the issue across the frontend and backend?

  2. An Angular form submits invalid data even though frontend validation is implemented. How would you ensure that the backend also validates the submitted data?

  3. Your Angular application sends multiple HTTP requests when a user clicks the submit button only once. How would you identify and prevent duplicate submissions?

  4. You have implemented an HTTP interceptor to attach JWT tokens, but some API requests are still missing the Authorization header. How would you investigate this?

  5. An API returns HTTP 401 after a user's token expires. How would you handle token expiration and redirect the user appropriately without creating an infinite retry loop?

  6. Your Angular application has multiple pages that display the same user information. How would you avoid calling the same API repeatedly and manage shared data?

  7. Your Angular application works locally, but API calls fail after deploying the frontend and backend to separate servers. What configuration and deployment settings would you investigate?

Section 6: Architecture, Logging, Background Processing, and Deployment

  1. Your application needs to send email notifications after a successful order. Would you send the email directly inside the API request or process it in the background? Explain your approach.

  2. A background job must process thousands of pending records, but the application may restart while processing. How would you design reliable processing?

  3. Your application is deployed across multiple servers, and users report inconsistent behavior. How would you investigate issues involving shared state, caching, and server configuration?

  4. You need to trace a request across multiple APIs and background services. How would you implement correlation IDs and distributed tracing?

  5. Your application has become difficult to maintain because controllers contain database queries, validation, and business logic. How would you refactor the application?

  6. Your API works correctly on your development machine but fails after deployment to IIS. How would you troubleshoot environment variables, hosting configuration, permissions, and connection strings?

  7. Your organization wants to scale an existing monolithic .NET application to handle increasing traffic. How would you evaluate options such as horizontal scaling, caching, asynchronous processing, and microservices?

Important Note

These questions are designed for .NET developers with approximately 4–6 years of experience. They emphasize practical problem-solving, debugging, performance optimization, secure API development, database management, and full-stack integration.

During an interview, don't just explain which technology you would use. Explain:

  • What problem you would investigate first.

  • Why you would choose a particular solution.

  • What alternatives you considered.

  • How you would handle failures and edge cases.

  • How you would verify that your solution works.

Real project examples from your own experience will make your answers much stronger.


Skills Tutorials – Learn • Build • Grow Together

Continue learning with our tutorials and interview preparation series.