Bird
0
0

What will the API return when called with /api/users?active=true&role=admin?

medium📝 Predict Output Q5 of 15
Rest API - URL and Resource Design

What will the API return when called with /api/users?active=true&role=admin?

AOnly active users, ignoring role
BAll users regardless of status or role
COnly users with admin role, ignoring active status
DUsers who are active and have the admin role
Step-by-Step Solution
Solution:
  1. Step 1: Analyze the query parameters active=true and role=admin

    Both parameters filter the users: active must be true and role must be admin.
  2. Step 2: Understand combined filtering logic

    Both filters apply together, so only users matching both conditions are returned.
  3. Final Answer:

    Users who are active and have the admin role -> Option D
  4. Quick Check:

    Multiple filters combine with AND logic [OK]
Quick Trick: Multiple query filters combine with AND by default [OK]
Common Mistakes:
MISTAKES
  • Assuming filters work independently (OR)
  • Ignoring one of the parameters
  • Thinking it returns all users

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes