Skills101
← All practice quizzes

Quiz: Design a Rate Limiter

5 questions · new set on every retakeNo time limitPass: 60%+10 XP on first pass

Build the three classic rate-limiting algorithms in Python, see exactly where the fixed window leaks a double burst, and design a rate limiter shared by many servers with Redis.

Log in to take the quiz

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

  1. Question 1

    Which algorithm lets a client send a short burst and then limits it to a steady average rate?

  2. Question 2

    What does this print?

    tokens, cap, rate, last = 2, 2, 1, 0
    out = []
    for t in [0, 0, 0, 1]:
        tokens = min(cap, tokens + (t - last) * rate)
        last = t
        if tokens >= 1:
            tokens -= 1
            out.append("Y")
        else:
            out.append("N")
    print("".join(out))
    
  3. Question 3

    A limit of 5 per minute uses fixed windows. What is the most requests a client can get through in about 2 seconds?

  4. Question 4

    What is the main cost of the sliding window log algorithm?

  5. Question 5

    Ten API servers each keep their own in-memory counter for a "100 per minute" limit. What can happen?

🎯 Today’s placement challenge — 10 questions, no login. Can you score 10/10?Take today’s challenge →