0
0
GraphQLquery~10 mins

Automatic query optimization 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 select the user's name in a GraphQL query.

GraphQL
query { user { [1] } }
Drag options to blanks, or click blank then click option'
Aemail
Bage
Cid
Dname
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.
2fill in blank
medium

Complete 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'
Atitle
Bcontent
Cauthor
Ddate
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.
3fill in blank
hard

Fix the error in the query to fetch user email correctly.

GraphQL
query { user { [1] } }
Drag options to blanks, or click blank then click option'
Aemails
Bemail
Cmail
DuserEmail
Attempts:
3 left
💡 Hint
Common Mistakes
Using plural or incorrect field names like emails or userEmail.
Guessing field names without checking the schema.
4fill in blank
hard

Fill 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'
Aid
Bname
Cemail
Dposts
Attempts:
3 left
💡 Hint
Common Mistakes
Including unnecessary fields like posts which can slow down the query.
Missing important fields like email when needed.
5fill in blank
hard

Fill 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'
Atitle
Bname
Cdate
Dcontent
Attempts:
3 left
💡 Hint
Common Mistakes
Selecting content instead of date which can be large.
Using wrong author field names.