Pagination, Filtering & Sorting — List Endpoints Done Right — Concept Check
Questions on Pagination, Filtering & Sorting — List Endpoints Done Right. Production list endpoints return an envelope (items + total + page), build filters dynamically but safely, whitelist sort fields against injection, and switch to keyset pagination when OFFSET gets slow.
Questions in this quiz
7 questions on Pagination, Filtering & Sorting — List Endpoints Done Right — Concept Check. Work through them here, then start the quiz to answer them and see your score.
1.A developer notices that their endpoint is slow when accessing page 2000 of a large dataset. What is the likely cause?
- AKeyset pagination is not implemented
- BOFFSET pagination is inefficient at deep pages
- CThe server has insufficient memory
- DThe database is not indexed
2.When implementing sorting in a list endpoint, why is it important to use a whitelist for sort fields?
- ATo reduce server load
- BTo prevent SQL injection attacks
- CTo improve database indexing
- DTo ensure all fields are sortable
3.A service uses OFFSET pagination and experiences drifting page boundaries after inserts. What should be done?
- AReduce the page size
- BSwitch to keyset pagination
- CAdd more database indexes
- DIncrease the OFFSET limit
4.A developer wants to filter students by branch and CGPA range. How should this be implemented safely?
- ADirectly concatenate SQL strings
- BUse raw SQL without filtering
- CAllow clients to specify filter logic
- DUse parameterized queries with dynamic filters
5.Why might a client incorrectly assume they can jump to any page with keyset pagination?
- AKeyset pagination does not support arbitrary page jumps
- BKeyset pagination is only for small datasets
- CKeyset allows jumping to any page
- DOFFSET pagination supports arbitrary jumps
6.What is the primary advantage of keyset pagination over OFFSET pagination?
- AIt supports jumping to any page
- BIt is constant-time at any depth
- CIt works better for small datasets
- DIt requires less implementation effort
7.How does the envelope pattern benefit list endpoints?
- AIt reduces the number of database queries
- BIt eliminates the need for pagination
- CIt provides total count and page information
- DIt simplifies client-side rendering