Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete 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'
Attempts:
3 left
💡 Hint
Common Mistakes
Using String instead of ID for unique identifiers.
Forgetting the exclamation mark to make the field required.
✗ Incorrect
The ID! type is used for unique identifiers and the exclamation mark means it is required.
2fill in blank
mediumComplete 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'
Attempts:
3 left
💡 Hint
Common Mistakes
Using ID instead of String for text fields.
Omitting the exclamation mark if the field is required.
✗ Incorrect
The String! type means the name field is a required string.
3fill in blank
hardFix 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'
Attempts:
3 left
💡 Hint
Common Mistakes
Using String for numeric fields.
Using Float when decimals are not needed.
✗ Incorrect
The Int type is used for whole numbers like age.
4fill in blank
hardFill 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'
Attempts:
3 left
💡 Hint
Common Mistakes
Using Int for title instead of String.
Not marking fields as required with exclamation marks.
✗ Incorrect
The title is a required string and published is a required boolean.
5fill in blank
hardFill 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'
Attempts:
3 left
💡 Hint
Common Mistakes
Using Boolean for likes instead of Int.
Forgetting exclamation marks for required fields.
✗ Incorrect
The id is a required ID, content is required text, and likes is an integer count.