Bird
0
0

What will be the order of users returned by the API call /api/users?sort=age&direction=asc?

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

What will be the order of users returned by the API call /api/users?sort=age&direction=asc?

AUsers sorted from oldest to youngest
BUsers sorted from youngest to oldest
CUsers sorted by registration date
DUsers sorted randomly
Step-by-Step Solution
Solution:
  1. Step 1: Understand the parameters

    The API sorts by 'age' with direction 'asc' which means ascending order.
  2. Step 2: Interpret ascending order for age

    Ascending order means from smallest to largest, so youngest to oldest.
  3. Final Answer:

    Users sorted from youngest to oldest -> Option B
  4. Quick Check:

    direction=asc means ascending order [OK]
Quick Trick: Asc sorts from smallest to largest [OK]
Common Mistakes:
MISTAKES
  • Mixing up youngest and oldest
  • Assuming sorting by registration date
  • Ignoring direction parameter

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes