Bird
0
0

You want to fetch a list of users with their id and name using GraphQL. Which query correctly does this assuming the server has a 'users' field returning a list?

hard📝 Application Q15 of 15
GraphQL - Basics and Philosophy
You want to fetch a list of users with their id and name using GraphQL. Which query correctly does this assuming the server has a 'users' field returning a list?
Aquery { users: id, name }
Bquery { users { id name } }
Cquery { user { id name } }
Dquery users { id name }
Step-by-Step Solution
Solution:
  1. Step 1: Identify the correct root field for multiple users

    The server field for multiple users is 'users', not 'user'.
  2. Step 2: Check query syntax for nested fields

    query { users { id name } } correctly queries 'users' with nested 'id' and 'name' fields inside braces.
  3. Final Answer:

    query { users { id name } } -> Option B
  4. Quick Check:

    Correct root field and nested fields = query { users { id name } } [OK]
Quick Trick: Use plural field for lists, nest fields inside braces [OK]
Common Mistakes:
  • Using singular 'user' for list data
  • Incorrect field alias syntax
  • Omitting braces for nested fields

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More GraphQL Quizzes