Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to fetch user data with GraphQL.
GraphQL
query { user(id: [1]) { name email } } Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using an unquoted number for the ID causes errors.
✗ Incorrect
The user ID must be a string in quotes in GraphQL queries.
2fill in blank
mediumComplete the code to request posts with their titles and authors.
GraphQL
query { posts { title [1] { name } } } Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using incorrect field names causes no data to return.
✗ Incorrect
The field to get the author of a post is usually called 'author'.
3fill in blank
hardFix the error in the query to avoid requesting too much data.
GraphQL
query { users { id name [1] } } Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Requesting full post content and comments causes slow queries.
✗ Incorrect
Requesting only the post titles reduces data size and improves performance.
4fill in blank
hardFill both blanks to limit query results and improve performance.
GraphQL
query { posts(limit: [1]) { title author { name } [2] } } Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Not limiting results or requesting too many nested fields slows queries.
✗ Incorrect
Limiting posts to 5 and requesting only comments text helps keep queries fast.
5fill in blank
hardFill all three blanks to create an efficient query with filters.
GraphQL
query { posts(filter: { authorId: [1], published: [2] }) { title [3] } } Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using unquoted IDs or requesting unnecessary fields causes slow queries.
✗ Incorrect
Filtering posts by author ID and published status, and requesting comments text, keeps queries focused and efficient.