0
0
Rest APIprogramming~20 mins

Cache-Control header directives in Rest API - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Cache-Control Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
Predict Output
intermediate
2:00remaining
What is the effect of this Cache-Control header?
Given the HTTP response header:
Cache-Control: no-store

What will the browser do with the response?
AThe browser will cache the response but revalidate it on every request.
BThe browser will cache the response and serve it without revalidation until it expires.
CThe browser will store the response only if it is marked as public.
DThe browser will not store the response in any cache and will fetch it fresh every time.
Attempts:
2 left
💡 Hint
Think about what 'no-store' means for caching behavior.
Predict Output
intermediate
2:00remaining
What is the output of this Cache-Control header?
Consider this HTTP response header:
Cache-Control: max-age=3600, must-revalidate

What does this mean for the cached response?
AThe response can be served from cache for 3600 seconds, but after that it must be revalidated before use.
BThe response must be revalidated with the server before every use, ignoring max-age.
CThe response can be served from cache for up to 3600 seconds without checking with the server.
DThe response is cached indefinitely and never revalidated.
Attempts:
2 left
💡 Hint
Consider how max-age and must-revalidate work together.
🔧 Debug
advanced
2:00remaining
Identify the error in this Cache-Control header
A developer wrote this Cache-Control header:
Cache-Control: max-age=abc, public

What error will this cause?
AThe header will cache the response for 0 seconds.
BThe header will cause a server error and the response will not be sent.
CThe header will be ignored because max-age value is invalid (not a number).
DThe header will cache the response indefinitely because max-age is ignored.
Attempts:
2 left
💡 Hint
Check the format required for max-age values.
🧠 Conceptual
advanced
2:00remaining
Which Cache-Control directive allows shared caches but prevents private caches?
Which Cache-Control directive below allows caching by shared caches (like proxies)?
Aprivate
Bpublic
Cno-cache
Dno-store
Attempts:
2 left
💡 Hint
Think about which directive marks a response as cacheable by any cache.
Predict Output
expert
2:00remaining
What is the number of directives in this Cache-Control header?
Count the number of valid directives in this Cache-Control header:
Cache-Control: no-cache, max-age=600, private, must-revalidate, proxy-revalidate
A5
B4
C3
D6
Attempts:
2 left
💡 Hint
Count each directive separated by commas.