Bird
0
0

Given this HTTP response header:

medium📝 Predict Output Q4 of 15
Rest API - Request and Response Format
Given this HTTP response header:
Cache-Control: max-age=60
ETag: "12345"

If the client sends a request with If-None-Match: "12345" after 30 seconds, what will the server most likely respond?
AHTTP 404 Not Found
BHTTP 200 OK with full content
CHTTP 304 Not Modified
DHTTP 500 Internal Server Error
Step-by-Step Solution
Solution:
  1. Step 1: Check cache freshness with max-age

    max-age=60 means the cached content is fresh for 60 seconds; 30 seconds is within this period.
  2. Step 2: Understand ETag and If-None-Match usage

    The client sends If-None-Match with the same ETag, so the server knows the client has the latest version.
  3. Step 3: Determine server response

    Since content is fresh and unchanged, server responds with 304 Not Modified to save bandwidth.
  4. Final Answer:

    HTTP 304 Not Modified -> Option C
  5. Quick Check:

    ETag match + fresh cache = 304 Not Modified [OK]
Quick Trick: ETag match with fresh cache returns 304 Not Modified [OK]
Common Mistakes:
MISTAKES
  • Assuming server always sends full content
  • Ignoring max-age freshness period
  • Confusing 404 or 500 with caching behavior

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes