Bird
0
0

You have 53 items and want to paginate with limit=10. How many pages will you have, and what is the offset for the last page?

hard📝 Application Q15 of 15
Rest API - Query Parameters and Filtering

You have 53 items and want to paginate with limit=10. How many pages will you have, and what is the offset for the last page?

A5 pages, offset 40
B6 pages, offset 50
C6 pages, offset 45
D7 pages, offset 60
Step-by-Step Solution
Solution:
  1. Step 1: Calculate total pages

    Total pages = ceiling of total items / limit = ceil(53 / 10) = 6 pages.
  2. Step 2: Calculate offset for last page

    Offset for last page = limit x (pages - 1) = 10 x (6 - 1) = 50.
  3. Final Answer:

    6 pages, offset 50 -> Option B
  4. Quick Check:

    Pages = 6, offset last = 50 [OK]
Quick Trick: Pages = ceil(total/limit), offset = limit x (pages-1) [OK]
Common Mistakes:
  • Using floor instead of ceiling for pages
  • Calculating offset as limit x pages
  • Ignoring leftover items on last page

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes