Bird
0
0

Consider this REST API server with caching enabled. What will be the output of the following sequence?

medium📝 Predict Output Q13 of 15
Rest API - Caching Strategies
Consider this REST API server with caching enabled. What will be the output of the following sequence?
1. Client requests resource A (not cached)
2. Server processes and caches response for A
3. Client requests resource A again
4. Server returns cached response
What happens at step 4?
AServer returns the cached response instantly without processing
BServer processes resource A again and returns new response
CServer returns an error because cache is empty
DServer delays response to check for updates
Step-by-Step Solution
Solution:
  1. Step 1: Understand caching steps

    At first request, server processes and caches the response. On the second request, the cached response is available.
  2. Step 2: Behavior at repeated request

    Server returns the cached response immediately without reprocessing, speeding up response time.
  3. Final Answer:

    Server returns the cached response instantly without processing -> Option A
  4. Quick Check:

    Cached response served = A [OK]
Quick Trick: Cached data skips processing on repeat requests [OK]
Common Mistakes:
MISTAKES
  • Thinking server recalculates every time
  • Assuming cache is empty on second request
  • Believing server delays to check updates

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes