CAP & Consistency Questions with Answers

20 practice questions on CAP & Consistency (NoSQL & MongoDB) with answers and step-by-step solutions. Try 10 samples below, then practise all 20 free in the AptiNest app.

Sample questions

Question 1Easy

BASE properties are often contrasted with:

  1. CAP
  2. ACID
  3. SQL
  4. REST

Answer: B. ACID

Explanation

BASE (Basically Available, Soft state, Eventual consistency) is the NoSQL counterpart to ACID.

Step-by-step solution

  1. BASE vs ACID.

Why the other options are wrong

  • A. CAP is a distributed systems theorem, not the contrast for BASE.
  • C. SQL is a query language, not the model BASE is set against.
  • D. REST is an API style, not the consistency model BASE is set against.

Question 2Easy

In the CAP theorem, what does the 'P' stand for?

  1. Persistence of data
  2. Partition tolerance
  3. Performance tuning
  4. Parallelism of nodes

Answer: B. Partition tolerance

Explanation

P is the ability to keep working despite network partitions between nodes.

Step-by-step solution

  1. The CAP theorem names three properties: Consistency, Availability and Partition tolerance.
  2. The P is for partition tolerance: the system keeps working when the network splits.
  3. So the answer is option B.

Why the other options are wrong

  • A. Durability is not one of the CAP letters.
  • C. Performance tuning is not part of the CAP theorem.
  • D. Parallelism of nodes is not one of the CAP letters.

Tip: CAP is Consistency, Availability and Partition tolerance; partitions are unavoidable in distributed systems.

Question 3Easy

ACID's letter 'I' stands for:

  1. Integrity
  2. Indexing
  3. Isolation
  4. Interaction

Answer: C. Isolation

Explanation

ACID: Atomicity, Consistency, Isolation, Durability.

Step-by-step solution

  1. Expand ACID.

Why the other options are wrong

  • A. Integrity is not the I; ACID's C is consistency.
  • B. Indexing is not part of ACID.
  • D. Interaction is not an ACID property.

Question 4Easy

The 'BASE' acronym used for many NoSQL systems contrasts with:

  1. CAP
  2. ACID
  3. CRUD
  4. SQL

Answer: B. ACID

Explanation

BASE (Basically Available, Soft state, Eventual consistency) is the relaxed counterpart to ACID.

Step-by-step solution

  1. BASE stands for Basically Available, Soft state, Eventual consistency.
  2. ACID ensures Atomicity, Consistency, Isolation, Durability in databases.
  3. BASE is a relaxed alternative to ACID properties in NoSQL systems.
  4. ACID guarantees strong consistency and reliability in transactions.
  5. Therefore, BASE contrasts with ACID in database systems.

Why the other options are wrong

  • A. CAP is a theorem about three properties of distributed systems; BASE is the term paired against ACID.
  • C. CRUD is the four basic data operations, not a set of transaction guarantees.
  • D. SQL is a query language, not a set of consistency guarantees that BASE is set against.

Tip: Remember BASE is used in NoSQL for scalability, while ACID is for SQL databases.

Question 5Medium

Which read concern returns only data acknowledged by a majority and thus safe from rollback?

  1. majority
  2. local
  3. available
  4. linearizable only for single node

Answer: A. majority

Explanation

majority returns data durable across most members.

Step-by-step solution

  1. Safe from rollback.

Why the other options are wrong

  • B. local may be rolled back.
  • C. The available read concern does not guarantee majority-acknowledged data.
  • D. linearizable is a different, stronger read concern for single-document reads on the primary; it is not the majority-acknowledged level asked for.

Question 6Medium

A system that rejects some requests during a partition to avoid returning stale data is favouring:

  1. Availability over consistency (AP)
  2. Neither C nor A
  3. Only latency
  4. Consistency over availability (CP)

Answer: D. Consistency over availability (CP)

Explanation

Refusing requests keeps all answers consistent at the cost of availability.

Step-by-step solution

  1. Rejecting requests ensures data stays consistent across the system.
  2. Consistency is prioritized over allowing some unavailable services.
  3. This matches the CP model where consistency is favoured over availability.

Why the other options are wrong

  • A. Favouring availability over consistency is AP, which keeps answering even with stale data.
  • B. The system does pick one during a partition; it is not neither, since it chooses consistency here.
  • C. Latency is not the trade-off CAP describes; the choice here is consistency versus availability.

Tip: In a partition, choose CP to keep data consistent.

Question 7Medium

In MongoDB, which write concern gives acknowledgement only after a majority of replica set members have the write?

  1. w: 0, which sends the write without acknowledgement
  2. w: 'majority'
  3. w: 1, which waits only for the primary
  4. j: false, which skips the journal

Answer: B. w: 'majority'

Explanation

Majority write concern waits for most members, protecting against rollback after failover.

Step-by-step solution

  1. Pick the option that names majority.

Why the other options are wrong

  • A. w:0 means no acknowledgement.
  • C. w:1 waits only for the primary.
  • D. j relates to journaling.

Question 8Medium

What does 'eventual consistency' guarantee?

  1. Without new writes, replicas eventually converge
  2. Every read sees the latest write immediately and always
  3. Writes are never lost even without replication
  4. All nodes always hold identical data at every instant

Answer: A. Without new writes, replicas eventually converge

Explanation

Replicas may briefly diverge but converge over time.

Step-by-step solution

  1. Eventual consistency allows replicas to catch up after delays.
  2. New writes are not needed for convergence.
  3. Replicas eventually show the same data without new writes.
  4. This matches option A exactly.

Why the other options are wrong

  • B. Reads that always see the latest write is strong consistency, not eventual consistency.
  • C. Writes can still be lost without replication or acknowledgement; eventual consistency does not promise that.
  • D. Replicas can differ at any moment; identical data at every instant is strong consistency.

Tip: Remember: eventual consistency means data converges later, not immediately.

Question 9Hard

Which statement about the CAP theorem is correct?

  1. Under a partition, C and A cannot both be kept
  2. A system can always provide all three guarantees together
  3. CAP says that network partitions never occur
  4. CAP applies only to single-node databases

Answer: A. Under a partition, C and A cannot both be kept

Explanation

CAP states that under a partition you must sacrifice either consistency or availability.

Step-by-step solution

  1. CAP says that when a network partition happens, a system cannot keep both consistency and availability.
  2. So a system cannot always give all three guarantees together.
  3. The correct statement is option A.

Why the other options are wrong

  • B. CAP says all three cannot always be kept together during a partition.
  • C. CAP assumes partitions can happen; it does not say they never occur.
  • D. CAP applies to distributed systems with several nodes, not single-node databases.

Tip: CAP is a choice under partition: consistency or availability, not both, while partition tolerance is kept.

Question 10Hard

In a Dynamo-style system with N replicas, read quorum R and write quorum W, strong read-your-write consistency is guaranteed when:

  1. R + W < N
  2. R = W = 1
  3. R + W > N
  4. R + W = 1

Answer: C. R + W > N

Explanation

If R + W > N, read and write sets overlap in at least one replica holding the latest value.

Step-by-step solution

  1. A read quorum R and write quorum W overlap when R + W is greater than N.
  2. Overlap means every read touches at least one replica holding the latest write.
  3. So strong read-your-write consistency needs R + W > N, which is option C.

Why the other options are wrong

  • A. If R + W is less than N, the sets may not overlap, so reads can be stale.
  • B. R = W = 1 overlaps only when N is 1.
  • D. R + W = 1 is far too small to overlap for N greater than 1.

Tip: Check the overlap with R + W > N; for N = 3, use R = 2 and W = 2.

Practise all 20 questions free

The full question bank with timed practice, progress tracking and Vidya, your AI tutor. Free, no ads.

Open this topic in the app →

Related topics

See all NoSQL & MongoDB topics · All topics