CAP Theorem Interview Questions
February 26, 2026 • By Surya Singh • System Design • CAP Theorem • Distributed Systems • Interview
CAP theorem interview questions — consistency, availability, partition tolerance trade-offs.
Key Takeaways
- 1CAP: In a partition, you must choose between Consistency and Availability. Pick two of three in practice.
- 2Consistency: every read sees the latest write. Availability: every request gets a response. Partition tolerance: system works despite network failures.
- 3In practice, partition tolerance is unavoidable (networks fail), so you choose CP or AP.
- 4PACELC extends CAP: if there is a Partition, choose A or C; Else (no partition), choose Latency or Consistency.
The questions below are commonly asked in technical interviews. Each answer is written to help you understand the concept clearly and explain it confidently. Focus on understanding the "why" behind each answer—that is what interviewers care about.
In this guide
Interview Questions & Answers
What does the CAP theorem state?
CAP says that in a distributed system, you cannot simultaneously guarantee all three: Consistency (every read gets the most recent write), Availability (every request receives a response), and Partition tolerance (the system works despite network partitions that prevent nodes from communicating). When a partition occurs, you must choose: either maintain consistency (refuse to respond until you can sync, so you sacrifice availability) or maintain availability (respond with possibly stale data, so you sacrifice consistency). In reality, partitions happen, so designers choose between CP and AP.
What is the difference between CP and AP systems?
CP (Consistency + Partition tolerance): When a partition occurs, the system refuses to serve requests that could return inconsistent data. For example, a strongly consistent database may reject writes or reads until the partition heals. Use when correctness is critical (e.g., financial transactions, inventory). AP (Availability + Partition tolerance): The system keeps serving requests even during a partition, but you might read stale data. Use when availability is more important than immediate consistency (e.g., social feeds, product catalogs). Eventual consistency is a common AP strategy.
Does CAP mean I can only have two of three properties?
CAP is often oversimplified. In normal operation (no partition), you can have consistency and availability. The trade-off occurs only when a partition happens. So "pick two" is a shorthand for "when there is a partition, you must give up one." Also, "availability" in CAP means "every request gets a non-error response," not "high throughput." A CP system can still have high availability when there is no partition. And consistency has nuance: strong vs eventual consistency.
What is PACELC and how does it extend CAP?
PACELC extends CAP. When there is a Partition (P), you choose Availability (A) or Consistency (C)—same as CAP. When there is no partition (Else, E), you choose Latency (L) or Consistency (C). For example, DynamoDB is PA/EL: during a partition it prefers availability; when things are fine, it can trade consistency for lower latency (e.g., read-your-writes vs eventually consistent reads). This captures that even without partitions, you sometimes relax consistency for performance (e.g., reading from a replica instead of the primary).
How does CAP affect my choice of database?
Strong consistency (CP): PostgreSQL, MySQL, MongoDB with majority read concern. Use for payments, inventory, anything where stale reads are unacceptable. Eventual consistency (AP): Cassandra, DynamoDB (with eventually consistent reads), CouchDB. Use for high write throughput, global distribution, or when temporary inconsistency is acceptable. Many systems offer both: you can do a strongly consistent read (slower, from primary) or eventually consistent (faster, from replica). Choose based on your use case's consistency requirements.
Loading...
Related Interview Guides
- All System Design & Scalability Topics
- System Design Interview Questions
- React Interview Questions
- SQL Interview Questions
- Interview Preparation — Start Here
Surya Singh
Azure Solutions Architect & AI Engineer
Microsoft-certified Azure Solutions Architect with 8+ years in enterprise software, cloud architecture, and AI/ML deployment. I build production AI systems and write about what actually works—based on shipping code, not theory.
- Microsoft Certified: Azure Solutions Architect Expert
- Built 20+ production AI/ML pipelines on Azure
- 8+ years in .NET, C#, and cloud-native architecture