Bird
0
0

Which of the following is the correct way to check a per-user rate limit in pseudocode?

easy📝 Syntax Q12 of 15
Rest API - Rate Limiting and Throttling
Which of the following is the correct way to check a per-user rate limit in pseudocode?
Aif requests_from_user > limit: block_request()
Bif requests_from_ip > limit: block_request()
Cif user_ip == limit: block_request()
Dif user == limit: block_request()
Step-by-Step Solution
Solution:
  1. Step 1: Identify per-user check

    Per-user limits check how many requests a user has made, so the condition should compare requests_from_user to the limit.
  2. Step 2: Verify correct syntax

    The correct syntax is to compare requests_from_user > limit and block if true.
  3. Final Answer:

    if requests_from_user > limit: block_request() -> Option A
  4. Quick Check:

    Check user requests count > limit [OK]
Quick Trick: Per-user means check requests_from_user variable [OK]
Common Mistakes:
  • Using IP variable for per-user limit
  • Comparing user or IP directly to limit
  • Using equality instead of greater than

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes