Interview Q&A / System Design

INTERVIEW Q&A · 70 QUESTIONS

System Design interview questions

Caching, scaling, databases and classic design problems for beginners.

  1. How would you design a URL shortener like bit.ly?

    Store a mapping from a short code to the long URL. Generate codes with a counter encoded in base62 (or random codes with a collision check), keep the mapping in a key-value store, put a cache in front for fast redirects, and return a 301 or 302 redirect. Add rate limits, expiry and analytics as extras.

    IntermediateIn-depth3 min read
  2. What is a message queue and why would you use one?

    A message queue lets one service drop a message and move on, while another service picks it up and processes it later. It decouples services, absorbs traffic spikes, makes slow work asynchronous and retries failures. Examples are RabbitMQ, Amazon SQS and Kafka (a log-based alternative).

    IntermediateIn-depth4 min read
  3. What is the CAP theorem, in simple words?

    The CAP theorem says that when a network partition splits a distributed system, it must choose between consistency (every read sees the latest write or gets an error) and availability (every request gets a non-error response, possibly stale). Partitions can't be ruled out, so the real choice is CP or AP during a partition.

    IntermediateIn-depth4 min read