Practice
1. A distributed database requires that every write is confirmed by a majority of replicas before acknowledging success to the client. Which replication strategy best fits this requirement?
easy
Solution
Step 1: Identify replication strategy matching majority confirmation
Synchronous replication with quorum writes requires majority replicas to acknowledge before success.Step 2: Eliminate asynchronous and single-leader without ack
Asynchronous replication and single-leader without acknowledgments do not guarantee majority confirmation before success.Final Answer:
Option C -> Option CQuick Check:
Quorum writes ensure majority ack before success [check]
Hint: Quorum writes wait for majority acks before success [OK]
Common Mistakes:
2. In the task scheduler's execution flow, at Step 4 the Worker Node polls the distributed priority queue for the next task. What happens if the task's scheduled time has not yet arrived?
easy
Solution
Step 1: Understand Worker Node behavior at Step 4
The Worker Node must respect the scheduled execution time; executing early (A) violates correctness; re-queuing (B) risks duplicate tasks; skipping (C) ignores the task indefinitely.Step 2: Identify failure handling
Marking the task as failed (D) triggers retry or alert mechanisms, ensuring no premature execution and visibility into scheduling issues.Final Answer:
Option A -> Option AQuick Check:
Premature tasks are failed to prevent early execution [check]
Hint: Fail early if task scheduled time not reached [check]
Common Mistakes:
3. A system must handle 1 million writes per second with flexible schema and eventual consistency. Which database technology best fits this requirement?
easy
Solution
Step 1: Identify write throughput and schema flexibility needs
Relational DBs struggle with 1M writes/sec and rigid schemas; graph DBs optimize for relationships, not write scale.Step 2: Evaluate NoSQL document store capabilities
NoSQL document stores support horizontal sharding and flexible schemas, enabling high write throughput with eventual consistency.Final Answer:
Option A -> Option AQuick Check:
NoSQL document stores scale horizontally for high writes [check]
Hint: High writes + flexible schema -> NoSQL document store [check]
Common Mistakes:
4. To handle personalized ranking at scale, should the system use a centralized ranking service with a global user profile store or a distributed ranking service co-located with Trie shards holding local user profiles? Consider latency and data freshness constraints.
medium
Solution
Step 1: Analyze latency and freshness trade-offs
Centralized ranking with global profiles (A) adds network latency; caching (C) adds complexity and stale data risk.Step 2: Evaluate distributed ranking with local profiles
Distributed ranking co-located with Trie shards (B) reduces latency by local data access, tolerating eventual consistency for freshness.Final Answer:
Option B -> Option BQuick Check:
Distributed ranking + local profiles -> low latency, eventual consistency [check]
Hint: Local profiles with distributed ranking reduce latency despite stale data [check]
Common Mistakes:
5. In an asynchronous messaging system, what exactly breaks if the message queue component is removed?
medium
Solution
Step 1: Understand queue's role in message deduplication and buffering
Queues often provide deduplication and buffering to ensure exactly-once or at-least-once delivery.Step 2: Consequence of removing the queue
Without the queue, messages may be duplicated due to lack of deduplication and buffering mechanisms.Final Answer:
Option B -> Option BQuick Check:
Removing queue causes message duplication due to missing deduplication [check]
Hint: No queue means no deduplication, causing duplicates [check]
Common Mistakes:
