0
0
GraphQLquery~10 mins

Query complexity analysis 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 query that fetches a user's name.

GraphQL
query GetUserName { user(id: 1) { [1] } }
Drag options to blanks, or click blank then click option'
Aname
Bage
Cemail
Daddress
Attempts:
3 left
💡 Hint
Common Mistakes
Choosing a field that does not exist in the user type.
Selecting a field that fetches unrelated data.
2fill in blank
medium

Complete the code to add a nested field to fetch the user's posts titles.

GraphQL
query GetUserPosts { user(id: 1) { name posts { [1] } } }
Drag options to blanks, or click blank then click option'
Adate
Bcontent
Ctitle
Dcomments
Attempts:
3 left
💡 Hint
Common Mistakes
Selecting content instead of title when only titles are needed.
Choosing unrelated fields like comments.
3fill in blank
hard

Fix the error in the query by selecting the correct field to limit the number of posts fetched.

GraphQL
query GetLimitedPosts { user(id: 1) { posts([1]: 5) { title } } }
Drag options to blanks, or click blank then click option'
Amax
Bcount
Csize
Dlimit
Attempts:
3 left
💡 Hint
Common Mistakes
Using count or max which are not valid argument names here.
Using size which is not recognized by the schema.
4fill in blank
hard

Fill both blanks to create a query that fetches users with their posts filtered by a minimum number of likes.

GraphQL
query GetPopularPosts { users { name posts(filter: { likes: { [1]: [2] } }) { title } } }
Drag options to blanks, or click blank then click option'
Agt
B10
Clt
D5
Attempts:
3 left
💡 Hint
Common Mistakes
Using lt when filtering for popular posts.
Choosing a too low number that doesn't filter effectively.
5fill in blank
hard

Fill all three blanks to write a query that fetches posts with title, author name, and comments count greater than 5.

GraphQL
query GetDetailedPosts { posts(filter: { comments: { [1]: [2] } }) { [3] author { name } } }
Drag options to blanks, or click blank then click option'
Agt
B5
Ctitle
Dcontent
Attempts:
3 left
💡 Hint
Common Mistakes
Using content instead of title when only the title is requested.
Using incorrect operators like lt in the filter.