Bird
0
0

Given the schema type Query { book: Book } and data { book: { title: "1984", author: "Orwell" } }, what will the default resolver return for the field book?

medium📝 query result Q13 of 15
GraphQL - Resolvers
Given the schema type Query { book: Book } and data { book: { title: "1984", author: "Orwell" } }, what will the default resolver return for the field book?
A{ title: "1984", author: "Orwell" }
B"1984"
Cnull
DError: Resolver not found
Step-by-Step Solution
Solution:
  1. Step 1: Understand default resolver behavior

    The default resolver returns the data object matching the field name if it exists.
  2. Step 2: Match field to data

    The field book matches the data key book which contains the object with title and author.
  3. Final Answer:

    { title: "1984", author: "Orwell" } -> Option A
  4. Quick Check:

    Field book returns matching data object [OK]
Quick Trick: Default resolver returns matching data object for field name [OK]
Common Mistakes:
  • Returning only one property instead of whole object
  • Expecting null if no custom resolver is defined
  • Assuming error if resolver is not explicitly written

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More GraphQL Quizzes