Bird
0
0

Examine this GraphQL query:

medium📝 Debug Q6 of 15
GraphQL - Basics and Philosophy
Examine this GraphQL query:
{ user { id } }

Why does this query cause under-fetching if the client also needs the user's name and email?
AIt requests too many fields causing over-fetching
BIt does not request the user's name and email fields
CThe query syntax is invalid
DIt uses fragments incorrectly
Step-by-Step Solution
Solution:
  1. Step 1: Understand under-fetching

    Under-fetching occurs when the query misses fields the client needs.
  2. Step 2: Analyze the query

    The query only requests 'id' but the client also needs 'name' and 'email'. Hence, it under-fetches.
  3. Step 3: Evaluate options

    It does not request the user's name and email fields correctly identifies the missing fields. Options B, C, and D are incorrect because the query is valid and does not over-fetch or misuse fragments.
  4. Final Answer:

    It does not request the user's name and email fields -> Option B
  5. Quick Check:

    Missing needed fields? Under-fetching! [OK]
Quick Trick: Missing required fields causes under-fetching [OK]
Common Mistakes:
  • Confusing under-fetching with over-fetching
  • Assuming syntax errors cause under-fetching
  • Thinking fragments cause under-fetching here

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More GraphQL Quizzes