Bird
0
0

Which of the following is the correct syntax to start a mutation with an input variable named input of type CreateUserInput!?

easy📝 Syntax Q12 of 15
GraphQL - Mutations
Which of the following is the correct syntax to start a mutation with an input variable named input of type CreateUserInput!?
Amutation createUser($input: CreateUserInput!) { ... }
Bquery createUser(input: CreateUserInput!) { ... }
Cmutation createUser(input CreateUserInput!) { ... }
Dmutation createUser($input CreateUserInput!) { ... }
Step-by-Step Solution
Solution:
  1. Step 1: Recall mutation syntax with variables

    Variables in GraphQL mutations start with $ and have a colon before the type.
  2. Step 2: Check each option

    mutation createUser($input: CreateUserInput!) { ... } correctly uses $input: CreateUserInput!. Others miss $ or colon.
  3. Final Answer:

    mutation createUser($input: CreateUserInput!) { ... } -> Option A
  4. Quick Check:

    Variables need $ and colon [OK]
Quick Trick: Variables start with $ and use colon before type [OK]
Common Mistakes:
  • Omitting $ before variable name
  • Missing colon between variable and type
  • Using query instead of mutation keyword

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More GraphQL Quizzes