Fragments let you define a set of fields once and include them in multiple queries/mutations with ...FragmentName. This avoids repeating the same field selections and keeps operations maintainable.
2 / 15
Persisted queries improve performance and security because:
Persisted queries: clients pre-register operations with the server (often at build time) and send a small ID instead of the full query string. This reduces bandwidth, prevents clients from running unregistered queries, and improves security.
3 / 15
GraphQL solves the over-fetching problem by:
Over-fetching (REST returns all fields; client uses only a few) is a key REST pain point. GraphQL clients declare exactly what they need in the selection set — the server resolves only those fields, reducing bandwidth.
4 / 15
GraphQL introspection allows:
Introspection is a built-in GraphQL feature (queries starting with __schema, __type) that lets clients discover the API's structure dynamically. Tools like GraphiQL and code generators rely on introspection — it is often disabled in production for security.
5 / 15
Which sentence correctly uses GraphQL variables?
Variables let clients pass dynamic values (e.g., an ID, a filter) into an operation: query GetOrder($id: ID!) { order(id: $id) { ... } }. This prevents query string manipulation and allows queries to be cached by the server.
6 / 15
Alice (Senior Developer) comments on a PR draft:
"I'm seeing that this request is pulling *all* user details – including the billing information. Shouldn't we be using a fragment to only retrieve what we need for this specific feature? It seems like an unnecessary load on the API."
The question tests understanding of fragment usage in optimizing GraphQL queries. Fragments allow developers to precisely define what data is requested from the backend, preventing over-fetching and minimizing unnecessary network traffic. Alice's comment highlights a core benefit – reducing load on the API and improving performance.
7 / 15
Ben (Junior Developer) is writing a Slack message to his team:
'I'm trying to use GraphQL variables in the request, but I'm getting an error saying the variable isn't resolving. I think it might be related to how the gateway handles complex queries.'
This question explores the relationship between GraphQL variables and the API Gateway. Variable resolution relies on the gateway's ability to interpret dynamic values within a query. The gateway often needs configuration or specific handling for complex queries involving variables; therefore, Ben's observation is accurate.
8 / 15
Chloe (API Engineer) responds to a team report detailing increased API latency:
'To investigate this, I've examined the GraphQL requests. It appears that many clients are requesting fields from deeply nested objects in our product catalog schema. This is a classic case of over-fetching.'
This scenario tests understanding of over-fetching in GraphQL. Over-fetching occurs when a query requests more data than required from a schema – this directly contributes to increased latency and bandwidth usage. Chloe's observation accurately identifies the root cause of the reported API issues.
9 / 15
David (Lead Developer) is documenting a new feature in a PR description:
'We're using GraphQL to fetch user data. To ensure flexibility and maintainability, we've defined a custom query that uses fragments to isolate the required fields for each specific use case – for example, retrieving only the user's name and email address for profile display.'
This question assesses understanding of how to articulate the benefits of GraphQL fragments within a PR description. Fragments are crucial for tailoring data retrieval and improving performance by avoiding over-fetching; David's explanation correctly highlights this key advantage.
10 / 15
Emily (DevOps Engineer) is monitoring API request metrics:
'I'm seeing a high number of requests to the `/products` endpoint. It appears many clients are sending queries with identical fields – suggesting a lack of data filtering in our GraphQL client.'
This scenario examines a common problem – redundant queries. When clients send identical GraphQL queries without filtering or using fragments, it leads to unnecessary API calls and increased load. Emily's observation correctly identifies this inefficiency and its potential impact.
11 / 15
Alice (Senior Developer) comments on a PR draft:
"I'm seeing that this request is pulling *all* user details – including the billing information. Shouldn't we be using a fragment to only retrieve what we need for this specific feature? It seems like an unnecessary load on the API."
The question tests understanding of fragment usage in optimizing GraphQL queries. Fragments allow developers to precisely define what data is requested from the backend, preventing over-fetching and minimizing unnecessary network traffic. Alice's comment highlights a core benefit – reducing load on the API and improving performance.
12 / 15
Ben (Junior Developer) is writing a Slack message to his team:
'I'm trying to use GraphQL variables in the request, but I'm getting an error saying the variable isn't resolving. I think it might be related to how the gateway handles complex queries.'
This question explores the relationship between GraphQL variables and the API Gateway. Variable resolution relies on the gateway's ability to interpret dynamic values within a query. The gateway often needs configuration or specific handling for complex queries involving variables; therefore, Ben's observation is accurate.
13 / 15
Chloe (API Engineer) responds to a team report detailing increased API latency:
'To investigate this, I've examined the GraphQL requests. It appears that many clients are requesting fields from deeply nested objects in our product catalog schema. This is a classic case of over-fetching.'
This scenario tests understanding of over-fetching in GraphQL. Over-fetching occurs when a query requests more data than required from a schema – this directly contributes to increased latency and bandwidth usage. Chloe's observation accurately identifies the root cause of the reported API issues.
14 / 15
David (Lead Developer) is documenting a new feature in a PR description:
'We're using GraphQL to fetch user data. To ensure flexibility and maintainability, we've defined a custom query that uses fragments to isolate the required fields for each specific use case – for example, retrieving only the user's name and email address for profile display.'
This question assesses understanding of how to articulate the benefits of GraphQL fragments within a PR description. Fragments are crucial for tailoring data retrieval and improving performance by avoiding over-fetching; David's explanation correctly highlights this key advantage.
15 / 15
Emily (DevOps Engineer) is monitoring API request metrics:
'I'm seeing a high number of requests to the `/products` endpoint. It appears many clients are sending queries with identical fields – suggesting a lack of data filtering in our GraphQL client.'
This scenario examines a common problem – redundant queries. When clients send identical GraphQL queries without filtering or using fragments, it leads to unnecessary API calls and increased load. Emily's observation correctly identifies this inefficiency and its potential impact.
This module has 15 multiple-choice exercises, each with instant feedback and a full explanation of the correct answer.
Is this exercise free to use?
Yes. Every exercise on CoderSlingo, including this one, is free to use with no account, sign-up, or paywall.
Do I need to create an account to do these exercises?
No account is required. Just click an option to answer — your score for this session is tracked automatically in the progress bar above.
What happens if I choose the wrong answer?
You'll immediately see which answer was correct, plus a full explanation covering the vocabulary and reasoning behind it — mistakes are where most of the learning happens.
Can I retry the exercises if I want a higher score?
Yes — use the "Try again" button on the results screen to reset and go through all the questions again.
Is my progress saved if I close the page?
No. Progress is tracked only for your current visit; reloading or leaving the page resets the counter. This keeps the exercise simple and account-free.
Where can I find more GraphQL & API Gateway Language exercises?
Browse the full GraphQL & API Gateway Language hub for related drills, or check the "Next up" link below to continue with a connected topic.
How is this different from reading an article on the same topic?
Articles explain vocabulary and concepts in prose; this exercise tests and reinforces that vocabulary through active recall with immediate feedback — the two work best together.
Who writes these exercises?
Every exercise is written by the CoderSlingo team, drawing on real workplace English used in IT roles, then reviewed for accuracy and clarity.