Bird
0
0

Which of the following is the correct way to define a GraphQL schema field that uses a default resolver?

easy📝 Syntax Q12 of 15
GraphQL - Resolvers
Which of the following is the correct way to define a GraphQL schema field that uses a default resolver?
Atype Query { user: User() }
Btype Query { user: User @customResolver }
Ctype Query { user: User }
Dtype Query { user: User -> resolver }
Step-by-Step Solution
Solution:
  1. Step 1: Identify correct schema syntax

    GraphQL schema fields are defined as fieldName: Type without extra syntax for default resolvers.
  2. Step 2: Analyze options

    type Query { user: User } uses correct syntax. Options B, C, and D include invalid or non-standard syntax.
  3. Final Answer:

    type Query { user: User } -> Option C
  4. Quick Check:

    Default resolver needs simple field: Type syntax [OK]
Quick Trick: Default resolvers need simple field: Type syntax in schema [OK]
Common Mistakes:
  • Adding parentheses after type name
  • Using custom directives without definition
  • Using arrow or other symbols in schema

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More GraphQL Quizzes