Bird
0
0

Given the schema: type Author { id: ID! name: String! books: [Book!]! } type Book { id: ID! title: String! author: Author! } What will this query return? { author(id: "1") { name books { title } } }

medium📝 query result Q4 of 15
GraphQL - Type Relationships
Given the schema: type Author { id: ID! name: String! books: [Book!]! } type Book { id: ID! title: String! author: Author! } What will this query return? { author(id: "1") { name books { title } } }
AAuthor name with a single book title
BOnly author name without books
CAuthor name with a list of book titles written by the author
DError because books field is missing
Step-by-Step Solution
Solution:
  1. Step 1: Analyze query structure

    The query requests author name and nested books with their titles, so it expects a list of books.
  2. Step 2: Understand schema and query result

    Since books is a list, the result will include author name and a list of book titles.
  3. Final Answer:

    Author name with a list of book titles written by the author -> Option C
  4. Quick Check:

    Query returns author name and list of book titles [OK]
Quick Trick: Nested fields return lists if schema defines list type [OK]
Common Mistakes:
  • Expecting a single book instead of list
  • Ignoring nested fields in query
  • Assuming missing fields cause errors

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More GraphQL Quizzes