0
0
GraphQLquery~10 mins

Why GraphQL exists - Test Your Understanding

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 { user(id: "1") { [1] } }
Drag options to blanks, or click blank then click option'
Apassword
Bage
Cemail
Dname
Attempts:
3 left
💡 Hint
Common Mistakes
Choosing fields that are not related to the user's name.
2fill in blank
medium

Complete the code to request only the needed fields in a GraphQL query.

GraphQL
query { product(id: "5") { id [1] } }
Drag options to blanks, or click blank then click option'
Aprice
Bdescription
Cstock
Dall
Attempts:
3 left
💡 Hint
Common Mistakes
Requesting all fields at once, which GraphQL does not support with 'all'.
3fill in blank
hard

Fix the error in the GraphQL query to fetch a user's email.

GraphQL
query { user(id: "2") { [1] } }
Drag options to blanks, or click blank then click option'
Aemail
Bemails
Cmail
DuserEmail
Attempts:
3 left
💡 Hint
Common Mistakes
Using plural or incorrect field names like 'emails' or 'mail'.
4fill in blank
hard

Fill both blanks to complete a GraphQL mutation that updates a user's name.

GraphQL
mutation { updateUser(id: "3", input: { name: [1] }) { [2] } }
Drag options to blanks, or click blank then click option'
A"Alice"
Bname
Cid
D"Bob"
Attempts:
3 left
💡 Hint
Common Mistakes
Not quoting the new name or requesting wrong fields in the response.
5fill in blank
hard

Fill all three blanks to complete a GraphQL query fetching a post's title and author's name.

GraphQL
query { post(id: [1]) { [2] author { [3] } } }
Drag options to blanks, or click blank then click option'
A"10"
Btitle
Cname
Dcontent
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong id format or requesting wrong fields like 'content' instead of 'title'.