Bird
0
0

Consider the GraphQL query:

medium📝 query result Q4 of 15
GraphQL - Queries
Consider the GraphQL query:
{ firstUser: user(id: 10) { email } secondUser: user(id: 20) { email } }

Which of the following best describes the structure of the response?
A{ "firstUser": { "email": "..." }, "secondUser": { "email": "..." } }
B{ "user": [{ "email": "..." }, { "email": "..." }] }
C{ "email": ["...", "..."] }
D{ "firstUserEmail": "...", "secondUserEmail": "..." }
Step-by-Step Solution
Solution:
  1. Step 1: Analyze aliases

    The query uses aliases firstUser and secondUser to rename the user fields.
  2. Step 2: Understand response shape

    The response keys match the aliases, each containing the requested email field.
  3. Final Answer:

    { "firstUser": { "email": "..." }, "secondUser": { "email": "..." } } -> Option A
  4. Quick Check:

    Response keys match aliases exactly [OK]
Quick Trick: Response keys equal aliases used [OK]
Common Mistakes:
  • Expecting array of users under one key
  • Assuming emails are combined in a list
  • Confusing alias names with field names

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More GraphQL Quizzes