Bird
0
0

Given this GraphQL query:

medium📝 query result Q13 of 15
GraphQL - Basics and Philosophy
Given this GraphQL query:
query { book(id: "1") { title author { name } } }
What data will the client receive?
A{ "book": { "title": "1984", "author": { "name": "George Orwell" } } }
B{ "book": { "title": "1984" } }
C{ "title": "1984", "author": "George Orwell" }
D{ "book": { "name": "George Orwell" } }
Step-by-Step Solution
Solution:
  1. Step 1: Analyze the query fields

    The query asks for book with id "1", requesting title and nested author name.
  2. Step 2: Match query fields to response structure

    The response includes book object with title and author object containing name.
  3. Final Answer:

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

    Nested fields return nested objects [OK]
Quick Trick: Nested fields return nested objects in response [OK]
Common Mistakes:
  • Expecting flat objects for nested fields
  • Missing nested author object
  • Ignoring requested fields in response

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More GraphQL Quizzes