Bird
0
0

Which of the following is a valid way to declare an input type in GraphQL?

easy📝 Conceptual Q2 of 15
GraphQL - Mutations
Which of the following is a valid way to declare an input type in GraphQL?
Atype UserInput { name: String, age: Int }
Binput UserInput { name: String, age: Int }
Cscalar UserInput { name: String, age: Int }
Denum UserInput { name, age }
Step-by-Step Solution
Solution:
  1. Step 1: Recall GraphQL syntax for input types

    Input types are declared using the keyword input followed by fields.
  2. Step 2: Identify correct declaration

    input UserInput { name: String, age: Int } uses input keyword correctly; others use wrong keywords.
  3. Final Answer:

    input UserInput { name: String, age: Int } -> Option B
  4. Quick Check:

    Input type syntax = input keyword [OK]
Quick Trick: Use 'input' keyword to declare input types [OK]
Common Mistakes:
  • Using 'type' instead of 'input' for input types
  • Confusing scalar or enum with input types
  • Missing curly braces in declaration

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More GraphQL Quizzes