0
0
GraphQLquery~10 mins

Args argument 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 an argument named 'id' of type ID in a GraphQL field.

GraphQL
type Query { user([1]: ID!): User }
Drag options to blanks, or click blank then click option'
Aage
Bname
Cemail
Did
Attempts:
3 left
💡 Hint
Common Mistakes
Using a wrong argument name like 'name' or 'email' instead of 'id'.
2fill in blank
medium

Complete the code to define a GraphQL argument with a default value of 10 for 'limit'.

GraphQL
type Query { posts(limit: Int = [1]): [Post] }
Drag options to blanks, or click blank then click option'
A5
B10
C20
Dnull
Attempts:
3 left
💡 Hint
Common Mistakes
Using a default value that is not a number or forgetting the '=' sign.
3fill in blank
hard

Fix the error in the argument definition by completing the code correctly.

GraphQL
type Mutation { updateUser(id: [1], name: String): User }
Drag options to blanks, or click blank then click option'
AString!
BInt
CID!
DBoolean
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'String!' or other types instead of 'ID!' for the 'id' argument.
4fill in blank
hard

Fill both blanks to define a query with arguments 'first' and 'after' for pagination.

GraphQL
type Query { posts(first: [1], after: [2]): PostConnection }
Drag options to blanks, or click blank then click option'
AInt
BString
CBoolean
DFloat
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing up types or using incorrect types for pagination arguments.
5fill in blank
hard

Fill all three blanks to define a mutation with arguments 'id', 'email', and 'active'.

GraphQL
type Mutation { updateUser(id: [1], email: [2], active: [3]): User }
Drag options to blanks, or click blank then click option'
AID!
BString
CBoolean
DInt
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong types or forgetting the non-nullable marker for 'id'.