Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to select the user's name in a GraphQL query.
GraphQL
query { user { [1] } } Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Choosing a field that does not exist in the user type.
Using a field that returns a number instead of a string.
✗ Incorrect
The field name is used to fetch the user's name in the query.
2fill in blank
mediumComplete the code to fetch the list of posts with their titles.
GraphQL
query { posts { [1] } } Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Selecting
content instead of title when only titles are needed.Choosing a field that returns an object instead of a string.
✗ Incorrect
The title field fetches the title of each post.
3fill in blank
hardFix the error in the query to fetch user email correctly.
GraphQL
query { user { [1] } } Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using plural or incorrect field names like
emails or userEmail.Guessing field names without checking the schema.
✗ Incorrect
The correct field to fetch the user's email is email.
4fill in blank
hardFill both blanks to optimize the query by selecting only needed fields.
GraphQL
query { user { [1] [2] } } Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Including unnecessary fields like
posts which can slow down the query.Missing important fields like
email when needed.✗ Incorrect
Selecting only name and email fetches just the needed user info, optimizing the query.
5fill in blank
hardFill all three blanks to write a query that fetches post title, author name, and date.
GraphQL
query { posts { [1] author { [2] } [3] } } Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Selecting
content instead of date which can be large.Using wrong author field names.
✗ Incorrect
This query fetches the title of posts, the name of the author, and the date of the post, which are common useful fields.