Practice
1. A payment system must ensure that duplicate payment requests from clients do not result in multiple charges. Which component is primarily responsible for handling idempotency in this scenario?
easy
Solution
Step 1: Identify idempotency enforcement point
The transaction processing service must track unique request IDs to prevent duplicate charges, as it controls payment execution.Step 2: Eliminate other options
The load balancer cannot reliably detect duplicates due to statelessness; the database unique constraints cannot cover all idempotency cases; client SDK retries are unreliable and cannot guarantee global idempotency.Final Answer:
Option D -> Option DQuick Check:
Transaction service stores request IDs -> prevents duplicate processing [check]
Hint: Idempotency enforced where payment logic executes [check]
Common Mistakes:
2. In the file sync system's upload flow, at Step 4 the Delta Upload Worker receives chunk hashes from the client. What does the worker do when it finds a chunk hash already stored on the server?
easy
Solution
Step 1: Trace Delta Upload Worker behavior at Step 4
When the worker finds a chunk hash already stored, it skips re-uploading the chunk to save bandwidth and marks it as present.Step 2: Eliminate incorrect behaviors
Requesting resend wastes bandwidth; deleting existing chunks breaks deduplication; re-chunking is unrelated to upload step.Final Answer:
Option A -> Option AQuick Check:
Delta Upload Worker skips existing chunks to avoid redundant upload [check]
Hint: Skip chunks with known hashes to save bandwidth [check]
Common Mistakes:
3. A system must handle millions of read requests per second with minimal latency, while writes are less frequent but must remain consistent. Which component best handles the read load without impacting write performance?
easy
Solution
Step 1: Identify read-heavy load handling
Read replicas offload read queries from the primary, reducing contention and latency.Step 2: Evaluate other options
Use a single primary SQL database with read-write locks to serialize access serializes access, causing bottlenecks; Use a distributed cache with eventual consistency for all reads and writes sacrifices consistency; Implement synchronous replication to all nodes and direct reads to any node synchronous replication increases write latency.Final Answer:
Option C -> Option CQuick Check:
Read replicas serve reads without blocking writes [check]
Hint: Read replicas scale reads, primary handles writes [check]
Common Mistakes:
4. For a real-time multiplayer game server requiring low latency and high throughput, which architecture is more appropriate and why?
medium
Solution
Step 1: Identify real-time requirements
Low latency and high throughput require persistent connections to push updates instantly.Step 2: Evaluate architectures
Stateless REST APIs add overhead per request; message queues add latency; batch processing delays updates. Stateful WebSocket servers maintain persistent connections enabling real-time communication.Final Answer:
Option A -> Option AQuick Check:
WebSocket supports persistent low-latency connections [check]
Hint: Persistent connections enable real-time low-latency updates [check]
Common Mistakes:
5. If the message queue (e.g., Kafka) between the upload service and transcoding pipeline fails, what exactly breaks in the video processing flow?
medium
Solution
Step 1: Trace failure impact of message queue outage
The queue decouples upload and transcoding. Without it, upload service cannot enqueue transcoding jobs. Uploads succeed but transcoding workers receive no tasks, so no processed videos are generated. Blocking upload (B) is incorrect because upload is asynchronous. Duplicate transcoding (A) is unrelated. View count errors (D) happen downstream, not due to queue failure.Step 2: Confirm exact failure mode
Uploads accepted but stuck before transcoding is the precise failure.Final Answer:
Option A -> Option AQuick Check:
Queue failure causes transcoding jobs to be lost, no processed videos [check]
Hint: Queue failure means no transcoding jobs dispatched [check]
Common Mistakes:
