Bird
0
0

Given a REST API endpoint /api/users?page=3&limit=5, which users will be returned if the dataset is ordered by ID starting at 1?

medium📝 Predict Output Q4 of 15
Rest API - Pagination Patterns
Given a REST API endpoint /api/users?page=3&limit=5, which users will be returned if the dataset is ordered by ID starting at 1?
AUsers with IDs 11 to 15
BUsers with IDs 6 to 10
CUsers with IDs 16 to 20
DUsers with IDs 1 to 5
Step-by-Step Solution
Solution:
  1. Step 1: Calculate start index for page 3

    Each page has 5 users. Page 1: IDs 1-5, Page 2: IDs 6-10, so Page 3 starts at ID 11.
  2. Step 2: Determine range of IDs for page 3

    Page 3 includes IDs 11 to 15 (5 users).
  3. Final Answer:

    Users with IDs 11 to 15 -> Option A
  4. Quick Check:

    Page 3 with limit 5 = IDs 11-15 [OK]
Quick Trick: Page number times limit minus limit plus one = start ID [OK]
Common Mistakes:
  • Starting count at zero instead of one
  • Mixing up page numbers and offsets
  • Selecting wrong ID ranges

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes