Bird
0
0

} What will this query return?

medium📝 query result Q5 of 15
GraphQL - Type Relationships
Given this schema: type Category { id: ID! name: String! products: [Product!]! } type Product { id: ID! name: String! category: Category! } What will this query return? { category(id: "10") { name products { id name } } }
AError due to missing products field
BCategory name with a list of products in that category
COnly category name without products
DCategory name with a single product
Step-by-Step Solution
Solution:
  1. Step 1: Review query and schema

    The query requests category name and nested products with id and name, expecting a list of products.
  2. Step 2: Confirm expected output

    Since products is a list, the query returns category name and a list of products.
  3. Final Answer:

    Category name with a list of products in that category -> Option B
  4. Quick Check:

    Query returns category name and list of products [OK]
Quick Trick: List fields return multiple items in nested queries [OK]
Common Mistakes:
  • Expecting single product instead of list
  • Assuming missing fields cause errors
  • Ignoring nested query structure

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More GraphQL Quizzes