Bird
0
0

You want to design an API for a mobile app that needs flexible data fetching with minimal requests and efficient caching. Which approach is best and why?

hard📝 Application Q15 of 15
GraphQL - Basics and Philosophy
You want to design an API for a mobile app that needs flexible data fetching with minimal requests and efficient caching. Which approach is best and why?
AUse GraphQL because it allows clients to request exactly what they need in one request.
BUse REST because it is simpler and caches well with fixed URLs.
CUse REST because it supports nested queries better than GraphQL.
DUse GraphQL because it requires multiple requests for different data.
Step-by-Step Solution
Solution:
  1. Step 1: Analyze requirements for flexible data fetching and minimal requests

    GraphQL excels at letting clients specify exactly what data they want, reducing multiple requests.
  2. Step 2: Consider caching and efficiency

    While REST is simpler and caches well, GraphQL's single-request flexibility suits mobile apps needing efficient data transfer.
  3. Final Answer:

    Use GraphQL because it allows clients to request exactly what they need in one request. -> Option A
  4. Quick Check:

    Flexible, minimal requests = GraphQL [OK]
Quick Trick: Flexible single-request fetching = GraphQL [OK]
Common Mistakes:
  • Choosing REST for flexibility over GraphQL
  • Thinking GraphQL needs multiple requests
  • Assuming REST handles nested queries better

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More GraphQL Quizzes