0
0
GraphQLquery~10 mins

Input types in GraphQL - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to define a GraphQL input type for a user with a name field.

GraphQL
input UserInput { name: [1] }
Drag options to blanks, or click blank then click option'
AFloat
BInt
CBoolean
DString
Attempts:
3 left
💡 Hint
Common Mistakes
Using Int or Boolean for text fields.
Forgetting to specify the type.
2fill in blank
medium

Complete the code to define an input type with an age field that must be an integer.

GraphQL
input PersonInput { age: [1] }
Drag options to blanks, or click blank then click option'
AString
BFloat
CInt
DBoolean
Attempts:
3 left
💡 Hint
Common Mistakes
Using Float for integer values.
Using String for numeric fields.
3fill in blank
hard

Fix the error in the input type by choosing the correct type for the isActive field.

GraphQL
input StatusInput { isActive: [1] }
Drag options to blanks, or click blank then click option'
AInt
BBoolean
CString
DFloat
Attempts:
3 left
💡 Hint
Common Mistakes
Using String or Int for boolean values.
Confusing Boolean with numeric types.
4fill in blank
hard

Fill both blanks to define an input type with a required email field and an optional age field.

GraphQL
input ContactInput { email: [1] age: [2] }
Drag options to blanks, or click blank then click option'
AString!
BString
CBoolean
DInt
Attempts:
3 left
💡 Hint
Common Mistakes
Forgetting the exclamation mark for required fields.
Using Boolean for email field.
5fill in blank
hard

Fill all three blanks to define an input type with a required username, an optional score, and a flag indicating if the user is active.

GraphQL
input UserStatsInput { username: [1] score: [2] isActive: [3] }
Drag options to blanks, or click blank then click option'
AString!
BInt
CBoolean
DFloat
Attempts:
3 left
💡 Hint
Common Mistakes
Using Float for score when integer is expected.
Missing exclamation mark for required username.