0
0
GraphQLquery~10 mins

Type definitions 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 type named User with an id field.

GraphQL
type User { id: [1] }
Drag options to blanks, or click blank then click option'
AString
BInt
CID!
DBoolean
Attempts:
3 left
💡 Hint
Common Mistakes
Using String instead of ID for unique identifiers.
Forgetting the exclamation mark to make the field required.
2fill in blank
medium

Complete the code to add a name field of type String to the User type.

GraphQL
type User { id: ID! name: [1] }
Drag options to blanks, or click blank then click option'
AInt
BBoolean
CID
DString!
Attempts:
3 left
💡 Hint
Common Mistakes
Using ID instead of String for text fields.
Omitting the exclamation mark if the field is required.
3fill in blank
hard

Fix the error in the type definition by completing the field type for age.

GraphQL
type User { id: ID! age: [1] }
Drag options to blanks, or click blank then click option'
AString
BInt
CFloat
DBoolean
Attempts:
3 left
💡 Hint
Common Mistakes
Using String for numeric fields.
Using Float when decimals are not needed.
4fill in blank
hard

Fill both blanks to define a Post type with title and published fields.

GraphQL
type Post { title: [1] published: [2] }
Drag options to blanks, or click blank then click option'
AString!
BBoolean!
CInt
DID
Attempts:
3 left
💡 Hint
Common Mistakes
Using Int for title instead of String.
Not marking fields as required with exclamation marks.
5fill in blank
hard

Fill all three blanks to define a Comment type with id, content, and likes fields.

GraphQL
type Comment { id: [1] content: [2] likes: [3] }
Drag options to blanks, or click blank then click option'
AID!
BString!
CInt
DBoolean
Attempts:
3 left
💡 Hint
Common Mistakes
Using Boolean for likes instead of Int.
Forgetting exclamation marks for required fields.