Bird
0
0

Given the following API call, what items will be returned if the full list is ["a", "b", "c", "d", "e", "f"]?

medium📝 Predict Output Q13 of 15
Rest API - Query Parameters and Filtering

Given the following API call, what items will be returned if the full list is ["a", "b", "c", "d", "e", "f"]?

GET /items?limit=2&offset=3
A["d", "e"]
B["c", "d"]
C["a", "b"]
D["e", "f"]
Step-by-Step Solution
Solution:
  1. Step 1: Understand offset and limit

    Offset 3 means start from the 4th item (0-based index), which is "d".
  2. Step 2: Select 2 items from offset

    Limit 2 means take 2 items starting at "d", so items are "d" and "e".
  3. Final Answer:

    ["d", "e"] -> Option A
  4. Quick Check:

    Start at index 3, take 2 items = ["d", "e"] [OK]
Quick Trick: Offset is start index, limit is count from there [OK]
Common Mistakes:
  • Starting count at 1 instead of 0
  • Taking wrong slice of items
  • Confusing offset and limit roles

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes