Bird
Raised Fist0

Given the API endpoint /products?page=2&limit=5 and a total of 12 products, how many products will be returned in the response?

medium📝 Predict Output Q13 of Q15
Rest API - Pagination Patterns
Given the API endpoint /products?page=2&limit=5 and a total of 12 products, how many products will be returned in the response?
A2
B7
C5
D12
Step-by-Step Solution
Solution:
  1. Step 1: Calculate items per page

    The limit is 5, so each page should have up to 5 products.
  2. Step 2: Determine products on page 2

    Page 1 has products 1-5, page 2 has products 6-10, so page 2 returns 5 products.
  3. Final Answer:

    5 -> Option C
  4. Quick Check:

    limit = 5 products per page [OK]
Quick Trick: Page 2 with limit 5 returns 5 items if available [OK]
Common Mistakes:
MISTAKES
  • Counting all 12 products instead of page limit
  • Assuming leftover products on page 2
  • Confusing page number with total items

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes