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

πŸ“š .NET Interview Questions

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

  1. How do you build and handle file paths so that a .NET application works on both Windows and Linux? Explain absolute vs relative paths, separators, Path.Combine vs Path.Join, and case sensitivity.

    Cross-platform path handling in .NET: separators, absolute vs relative paths, the current directory, Path.Combine vs Path.Join, case sensitivity and long paths.

    Intermediate Theory File System Β· πŸ”— 2 follow-ups Β· πŸ›  1 real-world
  2. Code review: this endpoint returns a file from the server based on a name in the query string. What is wrong with it, and how would you fix it? ```csharp app.MapGet("/download", (string file) => { var path = Path.Combine("/var/app/reports", file); return Results.File(path, "application/octet-stream"); }); ```

    Path traversal (directory traversal) in a file download endpoint, why Path.Combine does not protect you, and safe patterns including root checks, ID mapping and Zip Slip.

    Senior CodeReview File System Β· πŸ”— 2 follow-ups Β· πŸ›  1 real-world
  3. How do file permissions work on Linux and Windows? Your .NET app works locally but throws UnauthorizedAccessException when writing to a mounted folder in a container. How do you fix it properly?

    Unix permission bits, owners and groups, Windows ACLs, how .NET exposes them, and fixing permission errors for non-root containers with mounted volumes.

    Mid-Level Debugging File System Β· πŸ”— 2 follow-ups Β· πŸ›  1 real-world
  4. What is a Stream in .NET? Explain how FileStream, MemoryStream and wrapper streams like GZipStream fit together, and the common mistakes when reading from a stream.

    The Stream abstraction, backing vs decorator streams, Read semantics, Position and CanSeek, disposal chains, async I/O and when to use StreamReader or Pipelines.

    Mid-Level Theory File System Β· πŸ”— 3 follow-ups Β· πŸ›  1 real-world
  5. Explain the layers of buffering between your .NET code and the disk. What does Flush actually guarantee, and how do you write a file so it survives a crash or power loss?

    Application, FileStream, OS page cache and device buffers; Flush vs Flush(true)/fsync; WriteThrough; atomic write-then-rename; ArrayPool for I/O buffers.

    Senior Theory File System Β· πŸ”— 3 follow-ups Β· πŸ›  1 real-world
  6. "The process cannot access the file because it is being used by another process." How do file locks work on Windows and Linux, how does FileShare affect them, and how do you debug and fix this error?

    Share modes, mandatory vs advisory locking, byte-range locks, how .NET maps FileShare on each OS, finding the process holding a file, and safe cross-process coordination.

    Mid-Level Debugging File System Β· πŸ”— 2 follow-ups Β· πŸ›  1 real-world
  7. What is the difference between sequential and random file access? Why does it matter for performance on HDDs and SSDs, and which .NET APIs (FileOptions, RandomAccess, memory-mapped files) help with each?

    Sequential vs random I/O, device and OS effects (seek time, read-ahead, page cache), FileOptions hints, the RandomAccess API, and memory-mapped files.

    Senior Theory File System Β· πŸ”— 3 follow-ups Β· πŸ›  1 real-world
  8. You need to import a 20 GB CSV file into SQL Server every night from a .NET service running in a container with a 1 GB memory limit. How would you design it?

    Designing a memory-bounded, resumable large-file import: streaming, low-allocation parsing, bounded pipelines, bulk insert, checkpoints and bad-row handling.

    Senior RealWorldScenario File System Β· πŸ”— 3 follow-ups Β· πŸ›  1 real-world
  9. Walk me through what happens, at the network level, when a .NET client calls https://api.example.com/orders/42 and gets a response.

    An end-to-end tour of one HTTPS request: DNS, IP routing, ports, TCP handshake, TLS, HTTP, load balancers and proxies, connection reuse, and where time goes.

    Intermediate Theory Networking Basics Β· πŸ”— 3 follow-ups
  10. What is an IP address? Explain IPv4 vs IPv6, private vs public ranges, subnets and CIDR notation, and NAT, with examples from cloud or container networking.

    IP addressing fundamentals: IPv4 and IPv6, CIDR and subnet sizing, private, loopback and link-local ranges, NAT, and how they show up in cloud VNets and Kubernetes.

    Junior Theory Networking Basics Β· πŸ”— 2 follow-ups
  11. What is the difference between TCP and UDP? When would you choose each, and why does HTTP/3 run over UDP?

    TCP and UDP compared: connections, reliability, ordering, flow and congestion control, head-of-line blocking, typical uses, and QUIC/HTTP/3 in .NET.

    Mid-Level Theory Networking Basics Β· πŸ”— 3 follow-ups Β· πŸ›  1 real-world
  12. What are ports and sockets? Your ASP.NET Core API works on your laptop but nothing answers when you run it in Docker. What is going on?

    Ports, listening vs connected sockets, the 4-tuple, binding to localhost vs all interfaces, container port mapping, and tools to see who is listening.

    Mid-Level Debugging Networking Basics Β· πŸ”— 3 follow-ups Β· πŸ›  1 real-world
  13. How does DNS resolution work? Describe a DNS-related incident you could see in a .NET service in Kubernetes or the cloud, and how you would diagnose it.

    DNS records, recursive resolution, TTLs and caching, how .NET resolves names, connection pooling vs DNS changes, Kubernetes ndots and conntrack issues, and diagnosis tools.

    Senior Debugging Networking Basics Β· πŸ”— 3 follow-ups Β· πŸ›  1 real-world
  14. Explain HTTP from a backend engineer's point of view: methods and idempotency, status codes, important headers, and the practical differences between HTTP/1.1, HTTP/2 and HTTP/3.

    HTTP semantics for API design and operations: safe and idempotent methods, status code classes, caching and content headers, and the evolution from HTTP/1.1 to HTTP/2 and HTTP/3.

    Mid-Level Theory Networking Basics Β· πŸ”— 3 follow-ups Β· πŸ›  1 real-world
  15. How do HTTPS and TLS work? Walk through the TLS 1.3 handshake and certificate validation, and explain how you would fix "The remote certificate is invalid" errors in a .NET service without disabling validation.

    TLS goals, the TLS 1.3 handshake, certificate chains and validation, SNI and ALPN, mutual TLS, and safe diagnosis of certificate errors in .NET.

    Senior Security Networking Basics Β· πŸ”— 3 follow-ups Β· πŸ›  1 real-world
  16. What is the difference between latency, bandwidth and throughput? How do round-trip time and chatty communication affect a .NET service, and how would you improve it?

    Latency, bandwidth and throughput defined; RTT, bandwidth-delay product, Little's law and tail latency; why chatty calls across regions hurt and how batching, caching and placement fix it.

    Senior Theory Networking Basics Β· πŸ”— 3 follow-ups Β· πŸ›  1 real-world
  17. How do firewalls, security groups and network policies work? A .NET service cannot reach a dependency, or its connections drop after being idle. How do you troubleshoot it?

    Stateful vs stateless firewalls, cloud NSGs/security groups, NACLs, WAFs, Kubernetes NetworkPolicy, idle timeouts, and a step-by-step connectivity troubleshooting method.

    Mid-Level Debugging Networking Basics Β· πŸ”— 3 follow-ups Β· πŸ›  1 real-world
  18. What is the difference between a forward proxy and a reverse proxy? Your ASP.NET Core app behind a reverse proxy logs the proxy's IP for every user and gets into an HTTPS redirect loop. What is wrong and how do you fix it safely?

    Forward vs reverse proxies, what they change (TLS, headers, timeouts, buffering), X-Forwarded-* headers and the ForwardedHeaders middleware, outbound proxy settings, and spoofing risks.

    Senior Debugging Networking Basics Β· πŸ”— 3 follow-ups Β· πŸ›  1 real-world
  19. How do load balancers work? Compare layer 4 and layer 7 load balancing, explain health checks, algorithms, sticky sessions and connection draining, and why gRPC traffic can end up on only one pod.

    L4 vs L7 load balancing, balancing algorithms, health checks and readiness, session affinity, graceful shutdown and draining, global load balancing, and long-lived HTTP/2 connection imbalance.

    Senior SystemDesign Networking Basics Β· πŸ”— 3 follow-ups Β· πŸ›  1 real-world
  20. Design the network path for a public .NET API on a cloud platform: from the user's browser to the database. Which components do you put in the path (DNS, CDN/WAF, load balancers, proxies, firewalls, private networking), and what does each one do?

    An end-to-end cloud network design for a public API: global entry, TLS, WAF, L7 routing, private subnets, egress control, private endpoints, and how each choice affects security, latency and operations.

    Staff / Architect SystemDesign Networking Basics Β· πŸ”— 3 follow-ups Β· πŸ›  1 real-world

🌐 Sangam's Webring

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