Bird
0
0

Given the query:

medium📝 query result Q4 of 15
GraphQL - Queries
Given the query:
{ user { id name } }

What data will the server return?
AAll fields of the user including <code>id</code> and <code>name</code>
BOnly the user's <code>id</code> and <code>name</code> fields
COnly the user's <code>name</code> field
DAn error because <code>id</code> and <code>name</code> cannot be requested together
Step-by-Step Solution
Solution:
  1. Step 1: Analyze the query fields requested

    The query explicitly asks for id and name fields of user.
  2. Step 2: Understand GraphQL response behavior

    The server returns only the requested fields, no more, no less.
  3. Final Answer:

    Only the user's id and name fields -> Option B
  4. Quick Check:

    Returned data matches requested fields = Only the user's id and name fields [OK]
Quick Trick: Server returns only requested fields in query [OK]
Common Mistakes:
  • Assuming server returns all user fields
  • Thinking requesting multiple fields causes error
  • Believing only one field can be requested

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More GraphQL Quizzes