🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: Design a Rate Limiter: all 15 questions

Quiz: Design a Rate Limiter · Question 12 of 15

What does this print? (code)

What does this print?

previous, current = 40, 12
fraction_into_window = 0.3
estimate = current + (1 - fraction_into_window) * previous
print(round(estimate))
  1. A.52
  2. B.24
  3. C.40
  4. D.12
Answer & explanation

Correct answer: 40

The sliding window counter estimate is 12 + 0.7 × 40 = 40.

Can you get the rest right without peeking?

Take the timed Quiz: Design a Rate Limiter quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →