Skip to content
Tech Interview Prep
Technical interview guide

CAP Theorem & Consistency Models

Why a distributed system can't have perfect consistency, availability, and partition tolerance all at once, and what real systems trade off.

Read
23 min
Practice MCQs
25
Interview Q&A
25
Edition
v3
Editorial status
Reviewed

Scope: Vendor-neutral distributed-systems principles; current AWS architecture guidance.

Curated: · Written: · Reviewed:

25 questions

MCQ-7A test writes key K = 42 to replica A of an eventually consistent store, then stops all writes. It polls replicas B and C every second for 24 hours. Which observed result would falsify the store's eventual-consistency claim?
MCQ-6Which stale read is a correctness bug rather than a cosmetic issue?
MCQ-8Which conflict resolution strategy silently discards data?
MCQ-14Which write operation merges cleanly under concurrent replication?
MCQ-1A design doc reads: 'We run three replicas across two AWS regions and have selected CA from CAP, so we get consistency and availability without needing partition tolerance.' Which statement is correct?
MCQ-22A service runs one primary and three asynchronous read replicas, A, B and C. A write W commits on the primary at t=0. Replica A applies W at t=40 ms, B at t=180 ms and C at t=600 ms. A gateway round-robins each read across the replicas in the fixed order A, B, C, A, ... A client issues one read of the key W wrote every 100 ms, starting at t=50 ms. Which of the client's first four reads return the pre-write value?
MCQ-5A Dynamo-style store keeps N = 5 replicas per key. A write is acknowledged once W = 3 replicas have stored the value; a read contacts R = 2 replicas and version reconciliation returns the highest version among the replicas it contacted. A client writes v42, receives the acknowledgement, then reads the key and gets v41. Which statement explains that read?
MCQ-17A key-value store keeps five replicas of each key: one in the client's region (1 ms RTT) and four in a remote region (20 ms RTT). Reads are load-balanced across all five, so each read hits one replica chosen at random. Writes use a quorum of three replicas and must keep succeeding when any single replica is unreachable. A write-then-read test returns the previous value in about 40% of runs. Which change makes every read reflect the latest acknowledged write without breaking the write availability requirement?
MCQ-20A Dynamo-style store runs N=3, R=2, W=2. A read returns two responses, and one carries an older version of the key than the other. Which mechanism lets the coordinator heal that divergence as part of this read, and what does it require of the read?
MCQ-15A six-node key-value store uses leaderless quorum replication: a write is committed once it collects 3 acknowledgements, and conflicting writes to the same key are resolved by last-write-wins. A network partition splits the cluster into two groups of three nodes, and clients keep sending writes to both groups. What happens?
MCQ-24A Dynamo-style store keeps each cart under key cart:u42 with N=3, R=1, W=1 and resolves conflicts with last-write-wins on the coordinator's wall clock. A partition isolates node C for 90 seconds. At t=0 a client writes {milk} through node A and gets a success; at t=40 s another client writes {bread} through node C and also gets a success. The partition heals at t=90 s and the replicas reconcile. What does the next read of cart:u42 return, and what do the two clients learn?
MCQ-10A five-node Raft cluster (majority quorum = 3) is split by a network partition into {A, B, C} and {D, E}. D is the leader when the partition begins. A client sends a write to D. What happens to that write?
MCQ-25A 5-node Raft cluster is split by a failed switch: 3 nodes in rack A and 2 in rack B, with no connectivity between the racks. The current leader is in rack B. What happens to write requests during the partition?
MCQ-13A PostgreSQL 16 primary runs with synchronous_commit = 'on' and synchronous_standby_names = 'FIRST 2 (sb1, sb2)'. sb2 is powered down for a disk replacement, and commits on the primary stop completing: they stay blocked until sb2 comes back. Why do commits block?
MCQ-19A payments service runs one primary with a single asynchronous replica. At the moment the primary's host dies, the replica's applied position is 150 ms behind the primary's. A client's transfer was acknowledged by the primary 400 ms before the crash. The replica is promoted. What is true of that transfer?
MCQ-2A 3-node key-value store replicates every key to all three nodes. Writes are acknowledged at W=1 and reads are served at R=1. During a partition that isolates node C, a client writes `balance=90` to node A, then reads `balance` from node C and gets `100`. The store's schema layer rejects any write that would set `balance` below zero. Which statement best describes the system's guarantees at that moment?
MCQ-4A user edits their display name; the write lands on the primary in eu-west-1, and the reload that follows is served by a replica in ap-south-1 that has not applied it yet, so the user sees the old name. Stale reads for other users are acceptable, and the team will not pay for quorum reads or per-operation dependency tracking. Which guarantee fixes this symptom?
MCQ-11Which requirement is causal rather than linearizable?
MCQ-16A user saves a comment and the leader acknowledges the write. Their next request is a page that mixes their comment with other users' recent comments, and the replica that serves it has not yet applied the write, so the comment is missing. Reads outnumber writes 20:1 and the leader cannot absorb them; replica lag is normally under 50 ms but spikes past 10 s during bulk imports. Which mechanism gives this session read-your-writes without making every read globally strong?
MCQ-9A comments API writes each new comment to the primary and returns the new comment's id plus the primary's WAL position, 8,412,900. The client then loads the post page, whose comment count and first page of comments are read from a replica. Replica lag is p99 300 ms, comment reads outnumber writes 20 to 1, the primary sits at 85% CPU, and the page must render within 100 ms. Which change makes the post page reflect the comment that was just written?
MCQ-3A team runs a 3-replica key-value store across three AZs in one region. Monitoring shows no network partition in 90 days. Writes are acknowledged on the leader after it fsyncs its log, then replicated asynchronously to the two followers; p99 write latency is 7 ms and the team wants to keep it. The read path has no cache: every read goes to a replica. Users report that a document they just saved reverts to the old text when they reload the page a moment later. Under PACELC, which diagnosis and fix fit this situation?
MCQ-12A payments service runs on a 3-node Cassandra cluster with replication factor 3 and writes at QUORUM. Each request handler reads the account balance, which must reflect the latest committed write, then reads a recent-activity feed that may lag a few seconds. The feed read currently runs at QUORUM too, costing p99 12 ms against 4 ms at ONE. They want to fix it in the read path alone, without provisioning a new keyspace or session. What should they do?
MCQ-23An inventory service writes reservations to a primary in us-east-1 and serves reads from asynchronously replicated replicas in eu-west-1. After POST /reserve, the client immediately GETs the item to show the remaining count, and that GET is served by a eu-west-1 replica. Replication lag is 200 ms at p99, and 1.2% of reservations display the pre-reservation count, so users double-reserve. The GET must return within 50 ms at p99, and the eu-west-1 to us-east-1 round trip is 85 ms. Which change fixes the stale count without breaking the 50 ms budget?
MCQ-18A team is deciding which operations in their order service must read through the strongly consistent path. The service runs on a multi-region, eventually consistent store. Traffic is 95% reads: order-history pages (60%), product detail pages (34%), and a stock check that gates add-to-cart (1%). Which property of this workload keeps the strongly consistent set small?
MCQ-21A DynamoDB table stores 6 KB items and is provisioned at 400 RCU. A service reads 400 items per second; the table's 400 RCU are fully consumed and it does not throttle. After the team switches those reads from eventually consistent to strongly consistent, the table starts throttling. In DynamoDB, one RCU covers one strongly consistent read per second of an item up to 4 KB, or two eventually consistent reads per second of an item up to 4 KB, and items are rounded up to the next 4 KB. What explains the throttling?