Skills101
← All practice quizzes

Quiz: Design a URL Shortener

5 questionsNo time limitPass: 60%+10 XP on first pass

The classic first system design question, solved step by step: requirements, estimates, API, short-code generation with base62, data model, caching, scaling and trade-offs.

Log in to take the quiz

Free account · see your score, answers and explanations, earn XP

  1. Question 1

    How many different codes do 7 base62 characters give (approximately)?

  2. Question 2

    Why is a URL shortener considered read-heavy?

  3. Question 3

    Which redirect lets you count every click accurately?

  4. Question 4

    What does this print?

    def to_base62(n):
        a = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
        out = ""
        while n:
            n, r = divmod(n, 62)
            out = a[r] + out
        return out or "0"
    print(to_base62(62))
    
  5. Question 5

    What's a good way to make click tracking not slow down redirects?