Practice
1. In a primary-replica replication system, at step 4 the replica receives a batch of write-ahead log entries from the primary. What is the replica's exact state after applying these entries?
easy
Solution
Step 1: Trace replica behavior at step 4
Replica applies WAL entries to its local store to catch up with primary.Step 2: Understand acknowledgment timing
Replica acknowledges primary only after applying entries to ensure durability and consistency.Final Answer:
Option B -> Option BQuick Check:
Replica applies then acknowledges -> ensures data durability [check]
Hint: Apply WAL entries before ack -> durability ensured [check]
Common Mistakes:
2. A search engine must quickly update document scores as new documents arrive and queries are frequent. Which component is best suited to efficiently compute term frequency and inverse document frequency in real-time?
easy
Solution
Step 1: Identify real-time scoring needs
Relational DBs with full-text indexing (A) are slower for frequent updates; batch recomputation (C) is too delayed for real-time queries.Step 2: Evaluate indexing and update efficiency
In-memory inverted index with incremental TF-IDF updates (B) supports fast updates and queries; key-value stores (D) lack indexing for relevance scoring.Final Answer:
Option A -> Option AQuick Check:
In-memory inverted index enables fast incremental TF-IDF updates [check]
Hint: In-memory inverted index enables fast TF-IDF updates [check]
Common Mistakes:
3. For detecting anomalies in high-volume metric streams with low latency, which architecture is better suited and why?
medium
Solution
Step 1: Analyze latency and volume constraints
High-volume streams require low-latency detection to be actionable.Step 2: Match architecture to constraints
Streaming anomaly detection with windowed models processes data continuously, enabling near real-time alerts, unlike batch or polling which add latency.Final Answer:
Option C -> Option CQuick Check:
Streaming windowed models -> low latency anomaly detection [check]
Hint: High volume + low latency -> streaming anomaly detection [check]
Common Mistakes:
4. For a social network with users having highly variable follower counts (from tens to millions), which fan-out architecture best balances write latency and read latency?
medium
Solution
Step 1: Analyze pure push fan-out (A)
Push to all followers synchronously causes huge write amplification for celebrities, increasing write latency and storage.Step 2: Analyze pure pull fan-out (C)
Pull reduces write cost but increases read latency and complexity for users with many followers.Step 3: Evaluate hybrid fan-out (B)
Hybrid pushes to users with many followers (to reduce read latency) and pulls for users with few followers (to reduce write amplification), balancing both latencies.Step 4: Evaluate push only for active users (D)
Activity-based push doesn't address follower count skew effectively.Final Answer:
Option C -> Option CQuick Check:
Hybrid fan-out balances write and read latency by follower count [check]
Hint: Hybrid fan-out balances write/read latency by follower count [check]
Common Mistakes:
5. For storing aggregated logs with fast query response and cost efficiency, which storage architecture is best when logs are mostly write-once and rarely updated?
medium
Solution
Step 1: Analyze log storage requirements
Logs are write-once, large volume, and require fast analytical queries.Step 2: Evaluate columnar data warehouse
Columnar stores optimize for append-only writes and fast scans, reducing cost and improving query speed.Final Answer:
Option C -> Option CQuick Check:
Columnar warehouse -> optimized for append-only and analytics [check]
Hint: Columnar storage excels at append-only analytics [check]
Common Mistakes:
