Bird
0
0

Given a GraphQL single endpoint receiving this query:

medium📝 query result Q4 of 15
GraphQL - Basics and Philosophy
Given a GraphQL single endpoint receiving this query:
{ book(id: "5") { title author } }
What will the server return?
AThe title and author of the book with id 5
BAn error because multiple fields are requested
COnly the book id without title or author
DA list of all books ignoring the id
Step-by-Step Solution
Solution:
  1. Step 1: Analyze the query structure

    The query requests the book with id 5 and asks for title and author fields.
  2. Step 2: Understand GraphQL response

    The server returns exactly the requested fields for the specified id.
  3. Final Answer:

    The title and author of the book with id 5 -> Option A
  4. Quick Check:

    GraphQL returns requested fields = Title and author [OK]
Quick Trick: GraphQL returns only requested fields for given id [OK]
Common Mistakes:
  • Thinking multiple fields cause errors
  • Assuming server returns all fields by default
  • Believing id is ignored in query

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More GraphQL Quizzes