Bird
0
0

Given this GraphQL query:

medium📝 query result Q4 of 15
GraphQL - Queries
Given this GraphQL query:
{ book(id: 5) { title author { name } } }

What will the query return?
AOnly the book's title
BOnly the author's name
CThe book's title and the author's name
DAn error because nested fields are not allowed
Step-by-Step Solution
Solution:
  1. Step 1: Analyze the query structure

    The query asks for title of the book and nested author field with name.
  2. Step 2: Understand nested field result

    GraphQL returns both requested fields: book title and author's name.
  3. Final Answer:

    The book's title and the author's name -> Option C
  4. Quick Check:

    Nested query returns all requested fields [OK]
Quick Trick: Nested queries return all requested fields together [OK]
Common Mistakes:
  • Assuming only top-level fields return
  • Thinking nested fields cause errors
  • Ignoring nested field data in output

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More GraphQL Quizzes