Bird
Raised Fist0
HLDsystem_design~20 mins

Consistency models (strong, eventual) in HLD - Practice Problems & Coding Challenges

Choose your learning style10 modes available
Challenge - 5 Problems
🎖️
Consistency Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Understanding Strong Consistency
In a distributed database with strong consistency, what guarantee does the system provide when a client reads data after a write operation?
AThe client always reads the most recent write, ensuring no stale data is returned.
BThe client may read stale data if the write has not propagated to all replicas yet.
CThe client reads data from a random replica without any ordering guarantees.
DThe client reads data only from the primary node, ignoring replicas.
Attempts:
2 left
💡 Hint
Think about what 'strong consistency' means for read-after-write behavior.
🧠 Conceptual
intermediate
2:00remaining
Eventual Consistency Behavior
In an eventually consistent system, what is true about the data read by clients immediately after a write operation?
AClients always read the latest write immediately after it happens.
BClients might read stale data temporarily, but all replicas will converge eventually.
CClients cannot read data until all replicas confirm the write.
DClients read data only from the replica that processed the write.
Attempts:
2 left
💡 Hint
Consider what 'eventual' means in terms of data synchronization over time.
❓ Architecture
advanced
2:30remaining
Designing a System for Strong Consistency
Which architectural component is essential to ensure strong consistency in a distributed key-value store?
AA caching layer that serves stale data for faster reads.
BA background process that asynchronously syncs replicas after writes.
CA load balancer that directs reads to any available replica.
DA consensus protocol like Paxos or Raft to coordinate writes across replicas.
Attempts:
2 left
💡 Hint
Think about how replicas agree on the order of writes.
❓ scaling
advanced
2:30remaining
Scaling Eventual Consistency Systems
What is a common tradeoff when scaling an eventually consistent distributed database to many replicas?
ATemporary data inconsistency across replicas during replication delays.
BIncreased write latency due to synchronous replication to all replicas.
CReduced read throughput because all reads must go to the primary node.
DComplete data loss risk if one replica fails.
Attempts:
2 left
💡 Hint
Consider what happens when many replicas update asynchronously.
❓ tradeoff
expert
3:00remaining
Choosing Consistency Models for a Global Application
A global social media platform wants to balance user experience and data correctness. Which consistency model should it choose and why?
AStrong consistency only for writes, eventual consistency for reads.
BStrong consistency to ensure all users see the exact same data immediately, sacrificing latency.
CEventual consistency to provide low latency and availability, accepting temporary stale data.
DNo consistency guarantees to maximize throughput and ignore data correctness.
Attempts:
2 left
💡 Hint
Think about user experience in a global system with many users and locations.

Practice

(1/5)
1. Which statement best describes strong consistency in distributed systems?
easy
A. All users see the same data immediately after an update.
B. Data updates are delayed and may differ temporarily between users.
C. Data is never synchronized between nodes.
D. Users see different versions of data permanently.

Solution

  1. Step 1: Understand strong consistency definition

    Strong consistency means every read returns the most recent write, so all users see the same data instantly.
  2. Step 2: Compare options with definition

    All users see the same data immediately after an update. matches this definition exactly, while others describe delayed or inconsistent views.
  3. Final Answer:

    All users see the same data immediately after an update. -> Option A
  4. Quick Check:

    Strong consistency = immediate data sync [OK]
Hint: Strong consistency means instant data visibility everywhere [OK]
Common Mistakes:
  • Confusing strong consistency with eventual consistency
  • Thinking data can be permanently inconsistent
  • Assuming delays are allowed in strong consistency
2. Which of the following is a correct characteristic of eventual consistency?
easy
A. No synchronization happens between nodes.
B. All nodes update simultaneously with no delay.
C. Data is always consistent after every write operation.
D. Data updates propagate over time and become consistent eventually.

Solution

  1. Step 1: Recall eventual consistency meaning

    Eventual consistency means updates may take time to reach all nodes, but eventually all nodes will have the same data.
  2. Step 2: Match options to definition

    Data updates propagate over time and become consistent eventually. correctly states that data updates propagate over time and become consistent eventually.
  3. Final Answer:

    Data updates propagate over time and become consistent eventually. -> Option D
  4. Quick Check:

    Eventual consistency = delayed but eventual sync [OK]
Hint: Eventual consistency means data sync happens over time [OK]
Common Mistakes:
  • Assuming immediate synchronization in eventual consistency
  • Confusing no synchronization with eventual consistency
  • Thinking eventual consistency means permanent inconsistency
3. Consider a distributed database using eventual consistency. If a user updates a record on one node, what is the expected behavior immediately after the update?
medium
A. Other nodes may temporarily show the old record until synchronization completes.
B. All other nodes instantly reflect the updated record.
C. The update is rejected until all nodes confirm availability.
D. The record is deleted from all nodes except the updated one.

Solution

  1. Step 1: Analyze eventual consistency update behavior

    In eventual consistency, updates propagate asynchronously, so other nodes may temporarily have stale data.
  2. Step 2: Evaluate options against this behavior

    Other nodes may temporarily show the old record until synchronization completes. correctly states that other nodes may show old data until synchronization finishes.
  3. Final Answer:

    Other nodes may temporarily show the old record until synchronization completes. -> Option A
  4. Quick Check:

    Eventual consistency = temporary stale reads [OK]
Hint: Eventual consistency allows temporary stale data [OK]
Common Mistakes:
  • Expecting instant update on all nodes
  • Confusing update rejection with consistency model
  • Assuming data deletion on other nodes
4. A system claims to provide strong consistency but users report seeing outdated data after updates. What is the most likely cause?
medium
A. The system uses synchronous replication correctly.
B. The system is actually using eventual consistency under the hood.
C. Users are refreshing their data too often.
D. The network is too fast causing data to update too quickly.

Solution

  1. Step 1: Understand strong consistency guarantees

    Strong consistency guarantees all users see the latest data immediately after update.
  2. Step 2: Analyze why outdated data appears

    If users see outdated data, the system likely does not enforce strong consistency, possibly using eventual consistency instead.
  3. Final Answer:

    The system is actually using eventual consistency under the hood. -> Option B
  4. Quick Check:

    Outdated data means no strong consistency [OK]
Hint: Outdated data means strong consistency is not enforced [OK]
Common Mistakes:
  • Blaming network speed for outdated data
  • Assuming user refresh frequency causes inconsistency
  • Confusing synchronous replication with eventual consistency
5. You are designing a global e-commerce platform. Which consistency model should you choose for the inventory stock count to ensure customers never buy more items than available, and why?
hard
A. Eventual consistency, because it improves performance and availability.
B. No consistency model is needed for inventory data.
C. Strong consistency, because it guarantees all users see the latest stock count immediately.
D. Use eventual consistency with no synchronization.

Solution

  1. Step 1: Identify critical data requirements

    Inventory stock count must be accurate to prevent overselling, requiring immediate data correctness.
  2. Step 2: Choose consistency model based on requirements

    Strong consistency ensures all users see the latest stock count instantly, preventing overselling.
  3. Final Answer:

    Strong consistency, because it guarantees all users see the latest stock count immediately. -> Option C
  4. Quick Check:

    Critical data needs strong consistency [OK]
Hint: Critical data needs strong consistency for accuracy [OK]
Common Mistakes:
  • Choosing eventual consistency for critical stock data
  • Ignoring consistency needs for inventory
  • Assuming no consistency is acceptable
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard