System Design

CAP Theorem Interview Questions

What is the CAP theorem, and how does it affect system design interviews? — spoken sample answer for Indian interviews.

  • 5Questions with answers
  • 3Difficulty levels

Questions (5)

Browse beginner, intermediate, and advanced questions with answers — hide them when you want to self-test.

Question 1
Interview Intermediate
Question

What is the CAP theorem, and how does it affect system design interviews?

Answer:

CAP says that if the network partitions, a distributed system can keep consistency or availability, not both. It is not 'pick two of three forever'. It is about the partition case. CP systems like etcd or ZooKeeper would rather refuse a request than return a stale leader. AP systems like Cassandra-style stores stay up and repair later. In a real product I do not pick one letter for the whole company. Wallet debit and 'assign this driver' I treat as needing a strong write. Like counts and last-seen I allow eventual. If they push further I mention PACELC: even without a partition you still trade latency versus consistency. I would apply this to one write path in the design, not recite the acronym and stop.

Question 2
Interview Intermediate
Question

Give a real system and say where it sits on CAP during a partition.

Answer:

I would pick a checkout inventory lock. During a network split I would rather refuse a sale than oversell — that is CP for that write. A like-count on a social post can be AP: show a slightly stale number. I would not say 'we pick CA' because during a partition you cannot have both C and A. I use CAP to explain the product choice, not as a slogan. Dynamo-style shopping carts are often AP with merge. Bank ledgers are closer to CP.

Question 3
Interview Advanced
Question

What is PACELC and why do people mention it after CAP?

Answer:

PACELC says: in a Partition, choose A or C; Else, when the network is healthy, choose Latency or Consistency. Even without a partition, a strongly consistent read may wait on replicas. I mention it when they want more than CAP. For a feed I might accept EL — lower latency, eventual reads. For a wallet I would pay EC — extra latency for consistent reads. I would not hide behind the acronym. I would map it to user-visible waits.

Question 4
Interview Advanced
Question

How does leader election relate to consistency?

Answer:

A single leader for a partition serializes writes, which helps consistency. If the leader is unreachable, we either wait — look like CP — or accept another leader and risk split brain. Raft and Paxos exist so a majority agrees who the leader is. I would not run two writers on the same shard without a protocol. I mention fencing tokens so a stale leader cannot keep writing.

Question 5
Interview Beginner
Question

Is DNS AP or CP? Why is that a useful example?

Answer:

DNS is famously available and eventually consistent. Cached records can be stale until TTL. That is a product choice: the internet should resolve names even if some servers disagree. I use DNS when they think every system must be strongly consistent. Then I contrast it with Google Spanner-style writes. The example shows I can classify systems I already use.

Practice with AI mock interviews

Run System Design mock interviews with AI follow-ups, instant feedback, and analytics on AiLx.

Free to start · No credit card required