📁 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.

HTTP Fundamentals

Requests and responses, headers, body and query string, status codes, and the HTTP methods GET, POST, PUT, PATCH, DELETE, OPTIONS and HEAD as an API contract.

  1. How do you make a POST endpoint safe to retry when the operation is not naturally idempotent, such as taking a payment?
    Junior Theory HTTP Fundamentals
  2. Why might an API return 404 instead of 403 when a user requests another customer's resource, and what are the trade-offs?
    Junior Theory HTTP Fundamentals
  3. What does an HTTP request and response actually look like on the wire? Walk through the start line, headers and body, explain when data belongs in the route, the query string, a header or the body, and how ASP.NET Core exposes each part to your code.

    The anatomy of an HTTP/1.1 request and response, where API data belongs (route, query, header, body) and how HttpContext, HttpRequest and HttpResponse expose it in ASP.NET Core.

    Beginner Theory HTTP Fundamentals Β· πŸ”— 3 follow-ups
  4. Which HTTP method would you use for each operation in an API? Explain GET, POST, PUT, PATCH, DELETE, OPTIONS and HEAD, which are safe and which are idempotent, which may carry a body, and why those properties matter in practice.

    The HTTP methods as an API contract: meaning of each, the safe, idempotent and cacheable properties, body rules, and how retries, caches and proxies rely on them.

    Junior Theory HTTP Fundamentals Β· πŸ”— 2 follow-ups
  5. How do you choose the right HTTP status code in an API? Explain 200 vs 201 (with Location) vs 202 vs 204, 400 vs 422, 401 vs 403, 404 vs 410, when to use 409, 412 and 429, and how 500 differs from 502, 503 and 504.

    Choosing status codes as part of the API contract: success codes, client error distinctions (400/422, 401/403, 404/410, 409, 412, 429) and server/gateway errors (500, 502, 503, 504).

    Junior Theory HTTP Fundamentals Β· πŸ”— 3 follow-ups
  6. Which HTTP headers should every API engineer know? Explain Content-Type and Accept, Authorization, Cache-Control and ETag, Location, Retry-After, traceparent, and the X-Forwarded-* family, and what goes wrong in production when each is missing or trusted blindly.

    The headers that shape an HTTP API contract: content negotiation, authentication, caching and validators, Location, Retry-After, W3C trace context and forwarded headers behind proxies.

    Intermediate Theory HTTP Fundamentals Β· πŸ”— 2 follow-ups
  7. What is the difference between PUT and PATCH? Explain full replacement vs partial update, JSON Patch (RFC 6902) vs JSON Merge Patch (RFC 7396), how you tell a missing field from an explicit null, and show how you implement PATCH in ASP.NET Core on .NET 10.

    PUT as full replacement vs PATCH as partial update, JSON Patch vs JSON Merge Patch, the missing-vs-null problem, and implementing PATCH in ASP.NET Core 10 with System.Text.Json, validation and concurrency.

    Mid-Level Coding HTTP Fundamentals Β· πŸ”— 3 follow-ups Β· πŸ›  1 real-world
  8. How do you design the query string of an API? Explain how to model filters, arrays and ranges, how encoding works, what the practical length limits are, and when a search should be a POST instead of a GET.

    Query string design for APIs: filter, array and range conventions, percent-encoding, URL length limits in Kestrel, IIS, proxies and browsers, binding in ASP.NET Core, and when to switch search to POST.

    Intermediate Theory HTTP Fundamentals Β· πŸ”— 2 follow-ups
  9. After a release, clients of your API start getting 405 Method Not Allowed, 415 Unsupported Media Type or a bare 400 with no body, and the browser app reports that the CORS preflight failed. How do you work out which layer is rejecting the requests, and how do you fix each case?

    Diagnosing method and content-type contract failures (405, 415, empty 400, failed CORS preflight) across clients, gateways and ASP.NET Core, with the tools and fixes for each.

    Mid-Level Debugging HTTP Fundamentals Β· πŸ”— 3 follow-ups Β· πŸ›  1 real-world
  10. What are HEAD and OPTIONS for in an HTTP API? Explain CORS preflight, capability discovery with the Allow header, cheap existence and size checks with HEAD, and what ASP.NET Core does for you automatically versus what you must map yourself.

    The HEAD and OPTIONS methods: semantics, CORS preflight, Allow-based capability discovery, HEAD for existence, size and freshness checks, and how ASP.NET Core routing, CORS and static files handle them.

    Mid-Level Theory HTTP Fundamentals Β· πŸ”— 2 follow-ups Β· πŸ›  1 real-world
  11. Code review: an orders API uses GET /orders/{id}/cancel to cancel an order, returns 200 with {"success": false, "error": "..."} on failures, sends every operation as POST, and has URLs like /api/getOrders, /api/createOrder and /api/deleteOrder. What problems do you find, ranked by severity, and how would you redesign it?

    Reviewing an RPC-style HTTP API that violates method semantics (state change on GET, POST for everything, verbs in URLs) and hides failures behind 200 responses, then redesigning it around resources, correct methods and status codes.

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

🌐 Sangam's Webring

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