Practice
1. A database needs to support range queries on a large numeric column with frequent inserts and updates. Which indexing method best supports efficient range scans while maintaining balanced tree structure?
easy
Solution
Step 1: Identify index type for range queries
B-Tree indexes maintain sorted order of keys, enabling efficient range scans by traversing leaf nodes sequentially.Step 2: Eliminate other options
Hash indexes do not preserve order, so range queries require scanning all buckets. Composite indexes optimize multi-column equality but don't inherently improve single-column range scans. Bitmap indexes are efficient for low-cardinality columns, not large numeric ranges.Final Answer:
Option C -> Option CQuick Check:
B-Tree supports ordered traversal for range queries [check]
Hint: B-Tree keeps keys sorted for range queries [check]
Common Mistakes:
2. In a distributed lock system using ZooKeeper, at step 4 the client attempts to acquire the lock by creating an ephemeral sequential node. What happens if the client crashes immediately after creating this node but before confirming lock ownership?
easy
Solution
Step 1: Understand ephemeral node semantics
Ephemeral nodes in ZooKeeper are automatically deleted when the client session ends (e.g., crash), preventing deadlocks (A) and stale locks.Step 2: Trace lock ownership after crash
Since the ephemeral node is deleted, the next client waiting for the lock will be notified, but the lock is not immediately transferred (D) until they acquire it explicitly.Final Answer:
Option A -> Option AQuick Check:
Ephemeral node deletion on client crash -> lock released [check]
Hint: Ephemeral nodes vanish on client crash, freeing locks [check]
Common Mistakes:
3. If the Kafka cluster responsible for photo upload event streaming goes down, what exactly breaks in the system?
medium
Solution
Step 1: Understand Kafka's role in event streaming
Kafka streams photo upload events to downstream processors like metadata extraction and feed generation.Step 2: Trace failure impact
If Kafka is down, photo uploads still succeed because upload service writes to storage directly. Feed generation depends on Kafka events for stories update; without Kafka, stories updates stop, but feed generation for photos continues from DB. Metadata extraction is delayed but not necessarily indefinite. Notifications are handled separately.Final Answer:
Option B -> Option BQuick Check:
Kafka outage stops stories update but feed photo generation continues [check]
Hint: Kafka outage blocks stories update, feed photos still served [check]
Common Mistakes:
4. At 10x scale, which component in a content negotiation versioning system is most likely to become the bottleneck, and why?
hard
Solution
Step 1: Identify component handling content negotiation
The API gateway parsesAcceptheaders to route requests to correct versioned backend.Step 2: Analyze scaling impact
Parsing headers is CPU-intensive and cannot leverage caching well, causing gateway CPU to saturate first at high request volumes.Step 3: Compare other components
Backends scale horizontally; CDNs struggle but can be configured; client SDKs are not server bottlenecks.Final Answer:
Option B -> Option BQuick Check:
Gateway CPU parsing Accept headers saturates first at scale [check]
Hint: Gateway CPU parsing Accept headers saturates first [check]
Common Mistakes:
5. At 10x scale, which component in the real-time ML inference system is most likely to fail first and why?
hard
Solution
Step 1: Analyze scaling bottlenecks
Model storage (A) scales with caching; Kafka (C) can be scaled by adding partitions; load balancers (D) scale horizontally.Step 2: Identify CPU bottleneck in inference
Prediction API servers (B) perform CPU/GPU-bound inference; scaling is limited by hardware and model complexity, causing first failure under 10x load.Final Answer:
Option D -> Option DQuick Check:
Inference servers hit CPU/GPU limits before storage or Kafka scale [check]
Hint: Inference servers hit CPU/GPU bottleneck before other components [OK]
Common Mistakes:
