Bird
0
0

Which of the following is the correct syntax to define an input argument named input of type UserInput in a mutation?

easy📝 Syntax Q3 of 15
GraphQL - Mutations
Which of the following is the correct syntax to define an input argument named input of type UserInput in a mutation?
AupdateUser(input: UserInput): User
BupdateUser(input UserInput): User
CupdateUser(input: UserInput!) : User
DupdateUser(input = UserInput): User
Step-by-Step Solution
Solution:
  1. Step 1: Understand GraphQL argument syntax

    Arguments are defined as name: Type, with optional ! for required.
  2. Step 2: Analyze options

    updateUser(input: UserInput!) : User correctly uses input: UserInput! meaning input is required. Others have syntax errors or missing colon.
  3. Final Answer:

    updateUser(input: UserInput!) : User -> Option C
  4. Quick Check:

    Argument syntax = name: Type! [OK]
Quick Trick: Use colon and ! for required input arguments [OK]
Common Mistakes:
  • Omitting colon between name and type
  • Using equals sign instead of colon
  • Missing ! for required arguments

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More GraphQL Quizzes