Bird
0
0

Which of the following is the correct way to define a relationship field in a GraphQL type?

easy📝 Syntax Q12 of 15
GraphQL - Type Relationships
Which of the following is the correct way to define a relationship field in a GraphQL type?
Atype Book { author -> Author }
Btype Book { author = Author }
Ctype Book { author: Author }
Dtype Book { author: "Author" }
Step-by-Step Solution
Solution:
  1. Step 1: Recall GraphQL field syntax

    Fields are defined as fieldName: TypeName without extra symbols or quotes.
  2. Step 2: Check each option

    type Book { author: Author } uses correct syntax with colon and type name. Others use invalid symbols or quotes.
  3. Final Answer:

    type Book { author: Author } -> Option C
  4. Quick Check:

    Field syntax = name: Type [OK]
Quick Trick: Use colon (:) between field and type in GraphQL [OK]
Common Mistakes:
  • Using equals (=) instead of colon
  • Using arrows (->) instead of colon
  • Putting type name in quotes

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More GraphQL Quizzes