Bird
0
0

Consider this GraphQL object type:

medium📝 query result Q5 of 15
GraphQL - Schema Definition Language (SDL)
Consider this GraphQL object type:
type Product {
  id: ID
  name: String
  price: Float
}

What will this query return?
{ product { id name } }
AOnly the product's price field
BThe product's id, name, and price fields
CAn error because price is missing
DThe product's id and name fields
Step-by-Step Solution
Solution:
  1. Step 1: Understand query field selection

    GraphQL returns only the fields requested in the query.
  2. Step 2: Analyze the query fields

    The query requests only 'id' and 'name', so 'price' is not returned.
  3. Final Answer:

    The product's id and name fields -> Option D
  4. Quick Check:

    Query returns requested fields only [OK]
Quick Trick: GraphQL returns only fields explicitly requested [OK]
Common Mistakes:
  • Assuming all fields are returned by default
  • Expecting errors for missing fields in query
  • Confusing field names with types

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More GraphQL Quizzes