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

Phase 17 — Distributed Systems

How distributed .NET systems behave and fail: partial failure, latency and consistency models, microservice boundaries, messaging with Service Bus, RabbitMQ and Kafka, reliability patterns, and keeping data consistent across services.

  1. A call to another service timed out. Did the other service do the work? What does that mean for how you write the calling code?
    Beginner Theory Distributed Systems Core Concepts
  2. Why is idempotency called the core tool of distributed systems? Explain naturally idempotent operations versus deduplication, how idempotency keys and dedup storage work in a .NET service, and what goes wrong when two copies of the same request arrive at the same time.

    Idempotency as the answer to retries, duplicates and at-least-once delivery: naturally idempotent operations, idempotency keys, dedup tables with unique constraints in the same transaction as the effect, concurrent duplicates, retention and side effects outside the database.

    Mid-Level Theory Distributed Systems Core Concepts Β· πŸ”— 3 follow-ups Β· πŸ›  1 real-world
  3. How would you test time-dependent code in .NET, such as token expiry, retries with backoff or a scheduled job, without making tests slow or flaky?
    Senior Theory Distributed Systems Core Concepts
  4. What makes a system distributed? Explain the fallacies of distributed computing, and give a .NET example of code that breaks because it believes one of them.

    What a distributed system is, the eight fallacies of distributed computing, and how each shows up as a concrete bug in .NET services that call each other over the network.

    Beginner Theory Distributed Systems Core Concepts Β· πŸ”— 3 follow-ups
  5. What is partial failure in a distributed system? Your service calls another service and the call times out: did the other service do the work? Explain why you can't know, and what that means for how you write the calling code.

    Partial failure and the unknown outcome of a timed-out remote call: why the caller can't tell what happened, and how timeouts, idempotency, status checks and reconciliation make calling code safe.

    Junior Theory Distributed Systems Core Concepts Β· πŸ”— 3 follow-ups
  6. What do the CAP theorem and PACELC actually say? Explain what they don't say, why "pick two of three" is misleading, and how real databases such as SQL Server, Cosmos DB and Redis make the trade-off.

    CAP and PACELC explained precisely: consistency (linearisability) vs availability during a network partition, the latency vs consistency trade-off when there is no partition, common misreadings, and how SQL Server, Cosmos DB and Redis position themselves.

    Intermediate Theory Distributed Systems Core Concepts Β· πŸ”— 2 follow-ups
  7. Explain the main consistency models in distributed data stores: strong (linearisable), read-your-writes, monotonic reads, consistent prefix and eventual. Use Cosmos DB's five consistency levels as an example, and tell me how you would choose one for a feature.

    Consistency models from linearisable to eventual, the session guarantees (read-your-writes, monotonic reads, consistent prefix), how Cosmos DB's Strong, Bounded Staleness, Session, Consistent Prefix and Eventual levels map to them, and how to choose per feature.

    Mid-Level Theory Distributed Systems Core Concepts Β· πŸ”— 3 follow-ups Β· πŸ›  1 real-world
  8. How do distributed locks work, and why are they so easy to get wrong? Compare Redis (including Redlock), SQL Server application locks and Azure Blob leases, explain fencing tokens, and tell me when you would avoid a distributed lock altogether.

    Distributed locks and leases in .NET: Redis SET NX and Redlock, SQL Server sp_getapplock, Azure Blob leases, why locks fail (GC pauses, expiry, clock jumps, failover), fencing tokens, and designs that avoid locks.

    Senior Theory Distributed Systems Core Concepts Β· πŸ”— 3 follow-ups Β· πŸ›  1 real-world
  9. Why can't you order events across machines by their wall-clock timestamps? Explain clock skew and clock jumps, how NTP and the cloud keep time, logical clocks (Lamport, vector, hybrid), and how .NET's TimeProvider and Stopwatch help you write time-safe code.

    Time in distributed systems: clock skew, drift and jumps, NTP and cloud time sync, why timestamps can't order events across machines, Lamport, vector and hybrid logical clocks, and safe time handling in .NET with Stopwatch, DateTimeOffset and TimeProvider.

    Senior Theory Distributed Systems Core Concepts Β· πŸ”— 2 follow-ups Β· πŸ›  1 real-world
  10. Your nightly billing job runs inside an ASP.NET Core service as a BackgroundService. After the service was scaled from one instance to three, some customers were charged twice overnight. Walk me through how you would contain the incident, prove the cause, and fix it so the job is safe however many instances run, using leases and idempotency.

    A real-world incident where a scheduled job in a scaled-out service double-charges customers: containment, proving the cause with logs and traces, leader election with a lease, idempotent charges with a per-period key, moving scheduling out of the web tier, and reconciliation.

    Senior RealWorldScenario Distributed Systems Core Concepts Β· πŸ”— 3 follow-ups Β· πŸ›  1 real-world
  11. What is Conway's law, and how does it affect the way you design or change service boundaries?
    Intermediate Theory Microservices
  12. Should a Kubernetes readiness probe check the service's downstream dependencies, such as its database or other services?
    Mid-Level Theory Microservices
  13. How do you version an event schema so that old and new consumers keep working while messages of both versions are in flight?
    Senior Theory Microservices
  14. What is an error budget, how do you calculate it, and what happens when a team runs out of it?
    Senior Architecture Microservices
  15. Your team is moving a feature out of the monolith into its own microservice. What actually changes for you as a developer when a method call becomes a network call to another service, and what costs do you take on compared with keeping it in the monolith?

    What a microservice is in practice, and the concrete costs of turning in-process calls into network calls: latency, partial failure, no shared transaction, versioning, deployment and observability.

    Junior Theory Microservices Β· πŸ”— 3 follow-ups
  16. How do you find good service boundaries? Explain business capabilities, bounded contexts, data ownership and team ownership, how you test a proposed boundary, and the signs that a boundary is in the wrong place.

    Finding microservice boundaries from business capabilities and bounded contexts, using data and team ownership, testing a boundary with change and call patterns, and recognising a wrong boundary.

    Intermediate Theory Microservices Β· πŸ”— 3 follow-ups Β· πŸ›  1 real-world
  17. How does a service find the address of another service it needs to call? Explain service discovery with DNS, Kubernetes Services, and .NET's Microsoft.Extensions.ServiceDiscovery (as used by Aspire), compare client-side and server-side discovery, and tell me what breaks when discovery goes wrong.

    Service discovery for .NET services: DNS, Kubernetes Services and kube-proxy, Microsoft.Extensions.ServiceDiscovery and Aspire, client-side vs server-side discovery, and failure modes such as stale DNS and uneven load.

    Mid-Level Theory Microservices Β· πŸ”— 3 follow-ups Β· πŸ›  1 real-world
  18. Two of your services read and write the same SQL Server tables. Explain what goes wrong with this shared database setup compared with database per service, and walk me through how you would move to database per service step by step without downtime.

    The shared database anti-pattern versus database per service: schema coupling, hidden invariants, locking and scaling problems, and a step-by-step, zero-downtime migration to separate data ownership.

    Mid-Level Theory Microservices Β· πŸ”— 3 follow-ups Β· πŸ›  1 real-world
  19. How do you stop one service from breaking another when it changes its API or its messages? Explain consumer-driven contract testing with Pact (PactNet), how it differs from end-to-end tests, and the backward compatibility rules you follow for HTTP APIs and message schemas.

    Consumer-driven contract testing with PactNet for HTTP and messages, the Pact Broker and can-i-deploy, comparison with end-to-end tests, and concrete backward compatibility rules for JSON APIs and events.

    Senior Theory Microservices Β· πŸ”— 3 follow-ups Β· πŸ›  1 real-world
  20. What does service ownership mean in a microservices organisation? Explain "you build it, you run it", on-call, per-service SLOs and error budgets, and the role of a platform team, and tell me how you would set this up for a company moving from a central ops team.

    Service ownership in microservices: you build it, you run it, sustainable on-call, SLIs, SLOs and error budgets per service, service catalogues, and platform teams providing paved roads, plus a transition plan from central operations.

    Senior Architecture Microservices Β· πŸ”— 3 follow-ups Β· πŸ›  1 real-world

🌐 Sangam's Webring

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