System Design and Architecture Flashcards
7 cards from real CodeSignal Technical Assessment practice questions. Tap to flip, then mark Knew It or Still Learning — missed cards come back until you master them.
Read the first 7 System Design and Architecture flashcards as text
In a distributed system, which CAP theorem combination is chosen by a system that remains available during a network partition but may return stale data?
Answer: AP (Available and Partition-tolerant)
AP systems sacrifice strong consistency to remain available when partitions occur, returning possibly stale data instead of refusing requests.
You need to aggregate 1 billion events per day into per-user daily counts. Which architecture is most cost-effective when results are only needed by morning?
Answer: Batch MapReduce job running nightly
Nightly batch MapReduce processes the full dataset efficiently in bulk, which is far cheaper than real-time aggregation for non-latency-sensitive daily counts.
What is the main purpose of a write-ahead log (WAL) in a database?
Answer: Ensuring durability by logging changes before applying them
The WAL records every change before it is applied to data pages, allowing recovery to a consistent state after a crash.
An API gateway receives 50,000 requests/sec. Which rate-limiting algorithm smooths traffic most evenly without bursting?
Answer: Leaky bucket
The leaky bucket drains at a constant rate, enforcing a steady outflow regardless of incoming burst patterns.
When sharding a database by user ID, which problem arises if a small number of users generate the vast majority of traffic?
Answer: Hot shard (hotspot) imbalance
Hot shards occur when a few high-traffic keys land on the same shard, causing uneven load that negates sharding benefits.
Which replication strategy ensures the lowest write latency in a distributed database cluster?
Answer: Asynchronous replication — acknowledge after leader writes locally
Asynchronous replication acknowledges writes immediately after the leader persists them, without waiting for followers, minimizing write latency at the cost of potential data loss.
A search feature must return results within 100ms for queries across 500 million documents. Which indexing approach is essential?
Answer: Inverted index
An inverted index maps terms to the documents containing them, enabling sub-millisecond keyword lookups across billions of documents.