Bird
0
0

You want to fetch a list of books with their title and author details (name and email). You have a fragment:

hard📝 Application Q15 of 15
GraphQL - Queries
You want to fetch a list of books with their title and author details (name and email). You have a fragment:
fragment AuthorInfo on Author { name email }

Which query correctly uses this fragment to get books with author info?
Aquery { books { title author { ...AuthorInfo() } } }
Bquery { books { title author { AuthorInfo } } }
Cquery { books { title author { ...AuthorInfo on Author } } }
Dquery { books { title author { ...AuthorInfo } } }
Step-by-Step Solution
Solution:
  1. Step 1: Recall correct fragment usage inside nested fields

    Fragments are included with three dots and the fragment name without parentheses or extra keywords.
  2. Step 2: Check each option

    query { books { title author { ...AuthorInfo } } } correctly uses ...AuthorInfo inside author field. Others have syntax errors or extra invalid parts.
  3. Final Answer:

    query { books { title author { ...AuthorInfo } } } -> Option D
  4. Quick Check:

    Use ...FragmentName inside nested fields [OK]
Quick Trick: Use ...FragmentName exactly inside nested fields [OK]
Common Mistakes:
  • Adding parentheses after fragment name
  • Using fragment name as a field
  • Adding 'on Type' inside fragment spread

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More GraphQL Quizzes