System Design interview questions

20 questions from the System Design: Architecture, Scale and Trade-offs course, each with the correct answer and an explanation. Try to answer before you open the answer.

Module 1: Foundations

1. A service gets 8.6M requests/day evenly. Roughly what is the average QPS?

  1. ~1 QPS
  2. ~1,000 QPS
  3. ~100 QPS
  4. ~10,000 QPS
Show answer

Answer: ~100 QPS

8.6M / 86,400s ≈ 100 QPS average; peak would be higher.

Lesson: Back-of-the-Envelope Estimation

Module 2: Building Blocks

2. Which eviction policy removes the entry unused for the longest time?

  1. FIFO
  2. Random
  3. MRU (most recently used)
  4. LRU
Show answer

Answer: LRU

LRU (Least Recently Used) evicts the coldest entry by last access time.

Lesson: Caching

3. Your database is bottlenecked on write throughput. What helps most?

  1. Shard the data
  2. Add read replicas
  3. Add a bigger cache
  4. Switch to a larger CDN
Show answer

Answer: Shard the data

Replicas and caches scale reads. Sharding spreads writes across nodes.

Lesson: Replication & Sharding

Module 3: Scale & Reliability

4. Why must consumers of an at-least-once queue be idempotent?

  1. Messages may arrive out of order
  2. The same message may be delivered more than once
  3. Messages can be lost
  4. Queues always reorder messages by size
Show answer

Answer: The same message may be delivered more than once

Retries and redeliveries mean duplicates; idempotent handling makes them harmless.

Lesson: Message Queues

Module 4: Architecture Patterns

5. CQRS separates a system's model into which two paths?

  1. Cache vs database
  2. Sync vs async
  3. Reads (queries) vs writes (commands)
  4. Frontend vs backend
Show answer

Answer: Reads (queries) vs writes (commands)

CQRS (Command Query Responsibility Segregation) uses a write model optimized for commands and a separate, often denormalized, read model optimized for queries.

Lesson: Event-Driven Architecture & CQRS

Module 5: Consistency & Coordination

6. In Raft, when is a log entry considered committed?

  1. As soon as the leader writes it
  2. Once every node has replicated it
  3. Only when a client reads it
  4. Once a majority of nodes have replicated it
Show answer

Answer: Once a majority of nodes have replicated it

Majority (quorum) commitment lets Raft tolerate a minority of node failures while staying correct.

Lesson: Leader Election & Idempotency

Module 6: Messaging Deep Dive

7. Most real-world 'exactly-once' systems are actually built from which combination?

  1. At-least-once delivery + idempotent consumers
  2. At-most-once delivery + retries
  3. A single global lock
  4. Two-phase commit across every service
Show answer

Answer: At-least-once delivery + idempotent consumers

Delivering at least once and then deduping on the consumer side is the practical way most systems achieve exactly-once effect.

Lesson: Delivery Guarantees

Module 7: Resilience

8. Which algorithm enforces a strictly constant output rate, smoothing out bursts entirely?

  1. Token bucket
  2. Leaky bucket
  3. Fixed window counter
  4. Sliding window log
Show answer

Answer: Leaky bucket

Leaky bucket processes at a fixed rate no matter how bursty the input is, unlike token bucket which allows saved-up bursts through.

Lesson: Rate Limiting Algorithms, Deep Dive

Module 8: Data & Indexing

9. Reading data you just wrote, immediately after, is most at risk of appearing missing when reading from:

  1. The primary
  2. A local cache you just wrote
  3. A read replica
  4. The CDN edge
Show answer

Answer: A read replica

Replication lag means a replica may not yet have the write that just committed on the primary.

Lesson: Scaling Reads and Partitioning Strategies

Module 10: Security Basics for System Design

10. What does 'encryption in transit' protect against, that 'encryption at rest' does not?

  1. Someone stealing the physical disk
  2. A compromised database backup
  3. A weak password policy
  4. Someone intercepting data as it travels over the network
Show answer

Answer: Someone intercepting data as it travels over the network

TLS protects data moving between client and server or between services; at-rest encryption protects stored data on disk. You need both.

Lesson: Authentication, Authorization & Encryption

Module 11: Design Practice

11. Which algorithm naturally permits a short burst above the steady rate?

  1. Token bucket
  2. Fixed window counter
  3. Leaky bucket (as a queue)
  4. Sliding window log with no cap
Show answer

Answer: Token bucket

Accumulated tokens let a client spend several at once, up to the bucket cap.

Lesson: Design a Rate Limiter

12. Why replicate each cache shard rather than relying on the origin database on a node failure?

  1. Replication is required by law
  2. Without it, losing a shard sends a flood of misses straight to the database
  3. Replication makes writes faster
  4. Replicas remove the need for eviction
Show answer

Answer: Without it, losing a shard sends a flood of misses straight to the database

A cold shard means every request for its keys becomes a miss, hammering the database until it's warm again — replicas avoid that cliff.

Lesson: Design a Distributed Cache

13. Which is a non-functional requirement?

  1. Users can post a message
  2. Users can edit a profile
  3. p99 latency under 200ms
  4. Users can search orders
Show answer

Answer: p99 latency under 200ms

Non-functional requirements describe quality: latency, availability, scale.

Lesson: Design a Ride-Sharing Matching System

14. Roughly what average QPS is 86.4M requests per day?

  1. 10
  2. 100
  3. 10,000
  4. 1,000
Show answer

Answer: 1,000

A day has about 86,400 seconds, so 86.4M / 86,400 ≈ 1,000 QPS.

Lesson: Design a Ride-Sharing Matching System

15. What does cache-aside do on a cache miss?

  1. The app loads from the database and fills the cache
  2. The cache calls the database itself
  3. The request fails
  4. The database writes to the CDN
Show answer

Answer: The app loads from the database and fills the cache

In cache-aside the application owns loading and populating the cache.

Lesson: Design a Ride-Sharing Matching System

16. Which problem does consistent hashing mainly solve?

  1. Slow TLS handshakes
  2. Massive key remapping when nodes change
  3. Duplicate messages
  4. SQL injection
Show answer

Answer: Massive key remapping when nodes change

Only a small share of keys move when a node joins or leaves.

Lesson: Design a Ride-Sharing Matching System

17. Why do at-least-once consumers need to be idempotent?

  1. Messages are always lost
  2. Queues are encrypted
  3. Messages can be delivered more than once
  4. Ordering is guaranteed
Show answer

Answer: Messages can be delivered more than once

Retries cause duplicates, so repeating work must be safe.

Lesson: Design a Ride-Sharing Matching System

18. In a network partition, a CP system will…

  1. Return stale data to everyone
  2. Ignore the partition
  3. Add more replicas automatically
  4. Reject some requests to stay consistent
Show answer

Answer: Reject some requests to stay consistent

CP chooses consistency over availability during a partition.

Lesson: Design a Ride-Sharing Matching System

19. What does a circuit breaker do?

  1. Stops calling a failing dependency to prevent cascades
  2. Encrypts traffic
  3. Caches responses forever
  4. Shards the database
Show answer

Answer: Stops calling a failing dependency to prevent cascades

It fails fast so one slow dependency does not take down callers.

Lesson: Design a Ride-Sharing Matching System

20. What should you do first in a design interview?

  1. Draw the database schema
  2. Clarify requirements, users and scale
  3. Pick a cloud provider
  4. List every technology
Show answer

Answer: Clarify requirements, users and scale

Requirements and scale drive every later decision.

Lesson: Design a Ride-Sharing Matching System

← Back to the course