Sample questions
Question 1Easy
Strong consistency (linearizability) means:
- Each client sees its own writes only
- Reads eventually return the latest value
- Writes are applied in any order as long as the replicas converge after some delay
- Once a write completes, all later reads see it
Answer: D. Once a write completes, all later reads see it
Explanation
Linearizability makes the system behave like a single copy with operations happening at one instant.
Step-by-step solution
- Linearizability is the strongest single-object consistency model.
- Once a write completes, any later read must see it.
- The system then behaves as one copy.
- So the definition is option D.
Why the other options are wrong
- A. Seeing only your own writes is read-your-writes, a weaker guarantee.
- B. Eventually returning the latest value is eventual consistency.
- C. Any order that converges later is eventual consistency, not linearizability.
Tip: Linearizable: after a write completes, every later read sees it.
Question 2Easy
Read-your-writes consistency ensures:
- Other users cannot read data until the writer logs out of their session
- All users see every update instantly
- A user always sees their own updates afterwards
- Writes never fail
Answer: C. A user always sees their own updates afterwards
Explanation
It is a session guarantee; other users may still see the older value for a while.
Step-by-step solution
- Read-your-writes is a session guarantee.
- After a user writes a value, that user's later reads include the write.
- Other users may still see the older value for a while.
- So a user always sees their own updates afterwards (option C).
Why the other options are wrong
- A. Other users can still read data; the guarantee is only for the writer.
- B. Every user seeing every update instantly is strong consistency.
- D. Writes can still fail; this guarantee is about visibility.
Tip: Read-your-writes is about your own updates being visible to you.
Question 3Easy
Eventual consistency guarantees that:
- No two clients ever see different data
- Replicas converge to the same value if writes stop
- Writes are rejected during network partitions so that replicas never diverge
- Every read returns the latest write
Answer: B. Replicas converge to the same value if writes stop
Explanation
There is no bound on when, only that replicas eventually agree once updates stop.
Step-by-step solution
- Eventual consistency gives no bound on when replicas agree.
- It guarantees that once updates stop, replicas converge to the same value.
- Clients may see different data in the meantime.
- So the guarantee is that replicas converge if writes stop (option B).
Why the other options are wrong
- A. Clients can see different data while replicas are still catching up.
- C. Eventual consistency does not reject writes during partitions by definition.
- D. Every read returning the latest write is strong consistency.
Tip: Eventual consistency: replicas agree once writes stop, with no time bound.
Question 4Easy
In the CAP theorem, 'availability' specifically means:
- The system meets a 99.99% uptime target over a year
- Every request to a non-failed node gets a non-error reply
- Reads always return the latest write
- Data is replicated to at least three nodes
Answer: B. Every request to a non-failed node gets a non-error reply
Explanation
CAP availability is about every live node answering, not an uptime percentage; the answer may be stale.
Step-by-step solution
- In CAP, availability means every request to a working node gets a reply.
- The reply may be an old value, but it is not an error.
- It is not an uptime percentage such as 99.99%.
- So availability means every request to a non-failed node gets a non-error reply (option B).
Why the other options are wrong
- A. A 99.99% uptime target is an SLA measure, not the CAP meaning.
- C. Reads returning the latest write is the consistency property in CAP.
- D. Replicating to three nodes is a design choice, not the CAP meaning of availability.
Tip: CAP availability means every live node answers; it does not promise the latest value.
Question 5Medium
Vector clocks help a distributed database to:
- Detect whether two versions are concurrent or causally ordered
- Synchronise physical clocks precisely
- Encrypt replicated data
- Elect a leader faster during a network partition
Answer: A. Detect whether two versions are concurrent or causally ordered
Explanation
Comparing vector clocks shows whether one update happened before another or whether they conflict.
Step-by-step solution
- A vector clock keeps a counter for each node.
- Comparing two vector clocks shows whether one update came before the other.
- If neither dominates, the updates are concurrent and conflict.
- So vector clocks detect concurrent or causally ordered versions (option A).
Why the other options are wrong
- B. Vector clocks are logical, not physical clock synchronisation.
- C. Vector clocks do not encrypt data.
- D. Vector clocks track causality, not leader election speed.
Tip: Vector clocks answer one question: did update A happen before B, or are they concurrent?
Question 6Medium
Two users book the last seat at the same time. Which guarantee prevents both succeeding?
- Caching the remaining seat count in each app server's memory
- Eventual consistency with last-write-wins
- A strongly consistent, transactional check-and-reserve
- A CDN in front of the booking service
Answer: C. A strongly consistent, transactional check-and-reserve
Explanation
The read-and-reserve must be atomic, e.g. a database transaction or conditional update.
Step-by-step solution
- Two users read the one remaining seat at the same time.
- Both must not be allowed to reserve it.
- A strongly consistent, transactional check-and-reserve makes the check and the update one atomic step.
- So option C prevents both succeeding (option C).
Why the other options are wrong
- A. Each app server's cached seat count can be stale, so two bookings can both pass.
- B. Last-write-wins can keep one booking but may still let both be confirmed.
- D. A CDN does not guard a booking write.
Tip: Use an atomic check-and-update (a transaction or conditional write) to avoid double booking.
Question 7Medium
Strongly consistent reads in a leader-based system are commonly served by:
- The leader, or replicas confirmed up to date
- Any asynchronous replica
- The CDN
- A local cache on each app server that is refreshed every few minutes
Answer: A. The leader, or replicas confirmed up to date
Explanation
Async followers may lag; reading from the leader or a quorum ensures the latest committed data.
Step-by-step solution
- A strongly consistent read must see the latest committed data.
- A leader has that data, and so does a replica confirmed up to date.
- An asynchronous follower may lag behind the leader.
- So strong reads come from the leader or from up-to-date replicas (option A).
Why the other options are wrong
- B. An asynchronous replica can be behind, so it may return stale data.
- C. A CDN caches content and is not the source of committed data.
- D. A local cache refreshed every few minutes can be stale.
Tip: Strong reads go to the leader or to a replica known to be up to date.
Question 8Medium
Why is 'CA' (consistent and available, not partition tolerant) not a real option for a distributed system?
- CA systems are illegal
- Partition tolerance is free once you add TLS
- Availability and consistency are the same thing
- Partitions will happen, so you must decide behaviour when they do
Answer: D. Partitions will happen, so you must decide behaviour when they do
Explanation
You cannot opt out of network failures; only a single-node system can ignore P.
Step-by-step solution
- A distributed system spans a network that can fail.
- Partitions will happen, so partition tolerance cannot be opted out of.
- The design must choose what to do during a partition, consistency or availability.
- So you must decide behaviour when partitions happen (option D).
Why the other options are wrong
- A. CA systems are not illegal; the point is that a distributed one cannot avoid partitions.
- B. TLS does not make partition tolerance free.
- C. Availability and consistency are different properties.
Tip: In a distributed system, P is not optional; the real choice is C or A during a partition.
Question 9Hard
A distributed lock service hands out a lock, but the holder pauses (GC) and its lease expires. Another client gets the lock. How do you stop the old holder's late write?
- Retrying the write twice
- Fencing tokens checked by the storage system
- Longer timeouts on the client
- Using a faster garbage collector
Answer: B. Fencing tokens checked by the storage system
Explanation
Each lock grant carries an increasing token; storage rejects writes with an older token than it has seen.
Step-by-step solution
- The old lock holder paused, so it still thinks it holds the lock.
- The lock service has already granted the lock to a new client.
- Each grant carries an increasing fencing token.
- Storage that rejects writes with an older token stops the late write (option B).
Why the other options are wrong
- A. Retrying the write does not stop the old holder's late write.
- C. Longer timeouts do not stop a paused holder from writing late.
- D. A faster garbage collector does not guarantee the pause never happens.
Tip: Fencing tokens make the storage reject stale lock holders.
Question 10Hard
A database replicates synchronously across regions even with no failures, so writes are slow but always consistent. In PACELC terms it is:
- PA/EL
- PA/EC
- PC/EC
- PC/EL
Answer: C. PC/EC
Explanation
It picks consistency both during partitions (PC) and in normal operation over latency (EC).
Step-by-step solution
- PACELC: if there is a partition, choose availability (A) or consistency (C); else choose latency (L) or consistency (C).
- The system is always consistent, even when there is no failure.
- So it chooses consistency during partitions (PC) and consistency over latency (EC).
- So the answer is PC/EC (option C).
Why the other options are wrong
- A. PA/EL would favour availability and latency, which is not always consistent.
- B. PA/EC favours availability during partitions, but this system stays consistent during them.
- D. PC/EL favours latency normally, but this system pays latency for consistency.
Tip: PACELC: the first pair is the partition choice, the second is the normal choice.
Practise all 21 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 →