C# Interview

Senior .NET Practical Scenarios

C# interview questions covering senior .net practical scenarios.

10 Questions Filter by level

Interview questions

Open a question for the full answer, code and interview guidance.

10 Results
191
SeniorAdvanced

A database query is slow. How would you troubleshoot it?

Start by measuring the query and inspecting the generated SQL. Determine whether the delay is in the application, network, connection pool, database execution, or result materialization.

192
SeniorAdvanced

An ASP.NET Core API is using too much memory. What would you investigate?

First use memory metrics, dumps, traces, and a profiler to determine what objects are consuming memory and whether usage is expected, retained, or leaking through references.

193
SeniorAdvanced

How would you handle errors consistently across an ASP.NET Core API?

Use centralized exception handling instead of duplicating broad try/catch blocks in every controller.

194
SeniorAdvanced

How would you prevent duplicate records when two requests arrive at the same time?

Application-level existence checks alone are insufficient because two concurrent requests can both pass the check before either inserts a row.

195
SeniorAdvanced

How would you process a large number of records without exhausting memory?

Avoid loading the complete dataset into memory with an unrestricted ToList.

196
SeniorAdvanced

How would you design a thread-safe in-memory cache?

Prefer established caching abstractions such as IMemoryCache instead of implementing a cache from scratch.

197
SeniorAdvanced

How would you make an external API call reliable in a production C# application?

Use HttpClient through IHttpClientFactory or another managed client strategy instead of creating and disposing a new HttpClient for every request.

198
SeniorAdvanced

How would you secure secrets and connection strings in an ASP.NET Core application?

Secrets should not be hard-coded in C# files or committed to source control.

199
SeniorAdvanced

How would you improve the maintainability of a large C# codebase?

Start with clear module boundaries, meaningful naming, consistent coding conventions, and classes with focused responsibilities.

200
SeniorAdvanced

Describe the key practices you would follow when building a production-level C# application.

A production C# application should combine correct software design, security, performance, reliability, observability, and maintainability.