CS FundamentalsVery hardProduct-company system-design interview

A feed API uses ?offset=20&limit=20 pagination. While a user reads page 1, 5 new items are inserted at the top. What goes wrong on page 2, and what fixes it?

  1. A. Nothing; offsets are stable
  2. B. Page 2 skips 5 items; the fix is a larger limit
  3. C. The API returns 404; the fix is caching
  4. D. 5 items from page 1 appear again on page 2; cursor (keyset) pagination using the last seen item's key avoids it

Correct answer: D. 5 items from page 1 appear again on page 2; cursor (keyset) pagination using the last seen item's key avoids it

New rows shift every offset by 5, so the first 5 items of the new page 2 are the old items 16-20 already seen. Keyset pagination ('items older than id X') is stable under inserts and faster on large tables.

More Software Engineering, Git and Cloud Basics questions

Exams that ask this topic