Recall & Review
beginner
What is the basic structure of a GraphQL query?
A GraphQL query starts with the keyword
query (optional), followed by curly braces { } containing the fields you want to fetch.Click to reveal answer
beginner
How do you request specific fields in a GraphQL query?
Inside the curly braces, list the exact field names you want to get from the server. For example,
{ name age } fetches only the name and age fields.Click to reveal answer
beginner
Can you explain what happens if you omit the
query keyword in a GraphQL request?The
query keyword is optional. If omitted, the server treats the request as a query by default.Click to reveal answer
intermediate
What is the purpose of nested fields in a GraphQL query?
Nested fields let you fetch related data in one request. For example, <code>{ user { name email } }</code> fetches the user's <code>name</code> and <code>email</code> inside the <code>user</code> object.Click to reveal answer
intermediate
How do you name a GraphQL query and why?
You can name a query by writing
query MyQueryName { ... }. Naming helps with debugging and caching.Click to reveal answer
What keyword starts a GraphQL query?
✗ Incorrect
GraphQL queries start with the keyword
query, although it is optional.How do you specify which fields to retrieve in a GraphQL query?
✗ Incorrect
Fields are listed inside curly braces
{ } to specify what data to fetch.Is the
query keyword mandatory in GraphQL queries?✗ Incorrect
The
query keyword is optional; the server assumes a query if omitted.What does this GraphQL query fetch?
{ user { name email } }✗ Incorrect
It fetches the
name and email fields inside the user object.Why would you name a GraphQL query?
✗ Incorrect
Naming queries helps tools identify and cache them, and makes debugging easier.
Describe the basic syntax of a GraphQL query and how you select fields.
Think about how you ask for specific data from a friend.
You got /4 concepts.
Explain why naming a GraphQL query can be useful.
Consider how names help organize and find things later.
You got /3 concepts.