Bird
0
0

Given the GraphQL query:

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

What fields will the server return for each product?
AThe product id, name, and price
BOnly the product id
CAll product fields including id, name, price, and description
DNo fields, the query is invalid
Step-by-Step Solution
Solution:
  1. Step 1: Analyze the query field selection

    The query explicitly requests the fields id, name, and price inside product.
  2. Step 2: Understand GraphQL response behavior

    GraphQL returns only the requested fields, not extra fields like description.
  3. Final Answer:

    The product id, name, and price -> Option A
  4. Quick Check:

    Returned fields = Requested fields only [OK]
Quick Trick: Server returns only requested fields [OK]
Common Mistakes:
  • Assuming all fields are returned by default
  • Thinking query is invalid due to missing fields
  • Expecting only one field returned

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More GraphQL Quizzes