Bird
0
0

A developer sets the response header as Cache-Control: max-age=abc. What is the likely result?

medium📝 Debug Q14 of 15
Rest API - Request and Response Format
A developer sets the response header as Cache-Control: max-age=abc. What is the likely result?
AThe browser caches the response for 'abc' seconds
BThe server returns a syntax error
CThe browser ignores the Cache-Control header and does not cache
DThe browser caches the response indefinitely
Step-by-Step Solution
Solution:
  1. Step 1: Analyze max-age value validity

    The max-age directive requires a numeric value in seconds. 'abc' is invalid.
  2. Step 2: Understand browser behavior on invalid Cache-Control

    Browsers typically ignore invalid Cache-Control headers and treat the response as non-cacheable.
  3. Final Answer:

    The browser ignores the Cache-Control header and does not cache -> Option C
  4. Quick Check:

    Invalid max-age causes no caching [OK]
Quick Trick: max-age must be a number, else ignored [OK]
Common Mistakes:
MISTAKES
  • Thinking server returns error for header syntax
  • Assuming browser caches with invalid value
  • Confusing max-age with other headers

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes