📁 Sangam Dhakal - Portfolio v2.0 - Netscape Navigator 4.0
_
□
×

πŸ“š .NET Interview Questions

1325 questions for senior .NET engineer interviews, each with a 30-second answer, the full answer, a deep dive, the follow-ups interviewers ask next, and real-world production problems.

API Performance

Pagination and response size, compression, connection pooling, HTTP/2 and HTTP/3, gRPC, batching and avoiding chatty APIs in ASP.NET Core 10.

  1. Why does response size matter so much for API latency? Explain how pagination, projection and compression shrink a response, why payload size hurts most on mobile networks, and how you would measure the gain.

    Covers how payload size drives API latency, and reducing it with pagination, projection (purpose-built DTOs), compression and omitting nulls, with measurement on real networks.

    Intermediate Theory API Performance Β· πŸ”— 3 follow-ups
  2. How does connection pooling work for outbound HTTP and SQL calls in .NET? Explain how HttpClient and SocketsHttpHandler pool connections, why PooledConnectionLifetime matters, how SQL Server connection pooling works in Microsoft.Data.SqlClient, and what pool exhaustion looks like.

    Covers HTTP connection pooling in SocketsHttpHandler (lifetimes, per-server limits, HTTP/2), IHttpClientFactory, SqlClient connection pooling (Max Pool Size, pool keys, leaks) and the symptoms of pool exhaustion.

    Mid-Level Theory API Performance Β· πŸ”— 3 follow-ups Β· πŸ›  1 real-world
  3. What do HTTP/2 and HTTP/3 change for API performance? Explain multiplexing, header compression and head-of-line blocking at the HTTP and TCP level, how you enable each in Kestrel and HttpClient on .NET 10, and when they make a measurable difference.

    Covers HTTP/2 multiplexing and HPACK, TCP head-of-line blocking, HTTP/3 over QUIC (QPACK, 0-RTT, connection migration), enabling them in Kestrel and HttpClient on .NET 10, and when the gain is real.

    Mid-Level Theory API Performance Β· πŸ”— 3 follow-ups Β· πŸ›  1 real-world
  4. Your mobile app makes 25 API calls to render one screen, and some of your services call each other dozens of times per request. How do you fix chatty APIs? Compare batching, aggregate endpoints, a backend for frontend and gRPC streaming, and explain how you decide.

    Covers diagnosing chatty client and service-to-service communication and reducing round trips with aggregate endpoints, batch APIs, BFFs, gRPC streaming, data ownership changes and caching, with the trade-offs of each.

    Senior Architecture API Performance Β· πŸ”— 3 follow-ups Β· πŸ›  1 real-world
  5. Show me how you would remove N+1 calls to a downstream API. Write a batch endpoint, a client that chunks IDs into batches, and a bounded-concurrency fallback with Parallel.ForEachAsync for an API that has no batch support, and explain how you would prove it is faster.

    Covers replacing per-item downstream calls with a batch endpoint, chunking with Enumerable.Chunk, bounded parallelism with Parallel.ForEachAsync and MaxDegreeOfParallelism, partial failures, and measuring the gain.

    Mid-Level Coding API Performance Β· πŸ”— 3 follow-ups Β· πŸ›  1 real-world
  6. Under load, your ASP.NET Core API on Azure App Service starts failing calls to an external payment API and to other services with intermittent connection timeouts and SocketExceptions, while CPU and memory look fine. How do you diagnose connection or SNAT port exhaustion, and how do you fix it?

    Covers diagnosing outbound connection exhaustion: per-call HttpClient, unbounded MaxConnectionsPerServer, request queueing, and Azure SNAT port exhaustion, using dotnet-counters, App Service diagnostics and netstat, and fixing it with connection reuse, NAT Gateway and private endpoints.

    Senior Debugging API Performance Β· πŸ”— 3 follow-ups Β· πŸ›  1 real-world
  7. Code review: an order-details endpoint creates a new HttpClient for every call, calls the customer, product and shipping services one item at a time in a loop, blocks on .Result, and returns the full EF Core entity graph to the client. What problems do you find, ranked by severity, and how would you rewrite it?

    A code review of an ASP.NET Core endpoint and API client covering per-call HttpClient, sync-over-async, sequential N+1 downstream calls, missing timeouts and cancellation, and over-fetching by returning the entity graph, with a ranked rewrite.

    Senior CodeReview API Performance Β· πŸ”— 3 follow-ups Β· πŸ›  1 real-world

🌐 Sangam's Webring

βͺ Previous 🏠 Main Next ⏩
πŸ’¬ Chat with me