Sample questions
Question 1Easy
What does Cache-Control: max-age=3600 tell a cache?
- The response is fresh for 3600 seconds
- The response must be refetched after 3600 requests
- The response may be stored for up to 3600 KB
- The response expires 3600 minutes after midnight
Answer: A. The response is fresh for 3600 seconds
Explanation
max-age is a freshness lifetime in seconds.
Step-by-step solution
- Max-age sets a freshness lifetime in seconds.
- The value 3600 means one hour.
- During that time a cache may use the copy without asking the server.
- So the correct answer is the response is fresh for 3600 seconds.
Why the other options are wrong
- B. Max-age counts seconds, not requests.
- C. Max-age is a time, not a size limit.
- D. Max-age is counted from the response time, not from midnight.
Tip: Max-age is always seconds: 3600 is one hour, 31536000 is one year.
Question 2Easy
What does Cache-Control: no-cache actually mean?
- Only the CDN may cache it, never the browser
- It may be stored but must be revalidated
- The response is cached forever without checks
- The response must never be stored anywhere
Answer: B. It may be stored but must be revalidated
Explanation
Despite the name, no-cache allows storage but requires revalidation with the origin each time; no-store is the one that forbids storage.
Step-by-step solution
- No-cache allows a cache to store the response.
- But before each use, the cache must revalidate with the origin.
- The name is misleading: it does not mean no caching.
- So the correct answer is it may be stored but must be revalidated.
Why the other options are wrong
- A. No-cache is not limited to the CDN; browsers can store it too.
- C. No checks means the response is cached forever; no-cache always checks.
- D. A response that must never be stored is no-store.
Tip: No-cache = store and check every time; no-store = never store.
Question 3Easy
What is the main job of a content delivery network (CDN) for a website?
- Replaces the need for an origin server entirely
- Stores user passwords securely for the app
- Serves content from servers close to users
- Compiles front-end code during deployment
Answer: C. Serves content from servers close to users
Explanation
A content delivery network caches content on edge servers around the world, lowering latency and origin load.
Step-by-step solution
- A CDN is a network of edge servers spread around the world.
- It caches content on servers close to the user.
- This lowers latency and reduces load on the origin.
- So the correct answer is serving content from servers close to users.
Why the other options are wrong
- A. A CDN still relies on an origin server for content it does not have.
- B. Passwords are not a CDN's job; they belong in the app backend.
- D. Compiling front-end code happens in the build step, not in a CDN.
Tip: CDN = cache near the user; origin server stays the source of truth.
Question 4Easy
What does Cache-Control: no-store mean?
- Store it but always revalidate before use
- Store it for one hour and then delete it
- Store it only in the browser cache
- Do not store the response in any cache
Answer: D. Do not store the response in any cache
Explanation
no-store forbids caching entirely; it suits sensitive responses.
Step-by-step solution
- Cache-Control sets rules for storing responses.
- No-store tells every cache not to keep the response.
- Use it for sensitive responses such as banking pages.
- So the correct answer is do not store the response in any cache.
Why the other options are wrong
- A. Store and revalidate is no-cache, not no-store.
- B. Deleting after an hour is not a meaning of no-store.
- C. Browser-only storage is private, not no-store.
Tip: No-store = never store; no-cache = store but always revalidate.
Question 5Medium
What does s-maxage in Cache-Control control?
- The number of seconds before a session ends
- Freshness lifetime in CDNs and proxies
- The maximum size of the cached response
- Freshness lifetime in the browser only
Answer: B. Freshness lifetime in CDNs and proxies
Explanation
s-maxage applies to shared caches (proxies, CDNs) and overrides max-age there.
Step-by-step solution
- Cache-Control max-age applies to all caches.
- s-maxage applies only to shared caches such as proxies and CDNs.
- When present, it overrides max-age for those shared caches.
- So the correct answer is the freshness lifetime in CDNs and proxies.
Why the other options are wrong
- A. Session length is not controlled by Cache-Control.
- C. The cache size of a response is not set by s-maxage.
- D. The browser ignores s-maxage; it is for shared caches.
Tip: s- prefix in Cache-Control means shared caches only (CDNs, proxies).
Question 6Medium
Why do build tools add a content hash to filenames such as app.3f9a2c.js?
- So it can be cached long-term; new content gets a new URL
- So that each user downloads a unique copy of the file
- So that the browser can verify the file was not tampered with
- So that the CDN can compress the file more effectively
Answer: A. So it can be cached long-term; new content gets a new URL
Explanation
A changed file gets a new URL, so it can safely be served with a long max-age and immutable without stale-cache issues.
Step-by-step solution
- A content hash changes whenever the file content changes.
- A changed file therefore gets a new URL.
- Old URLs can stay cached for a long time without serving stale code.
- So the correct answer is long-term caching, since new content gets a new URL.
Why the other options are wrong
- B. Users all receive the same file; the hash is not per user.
- C. A content hash is not a security signature and does not verify tampering.
- D. The hash does not change compression; it changes the URL.
Tip: Hashed filenames let you use max-age=31536000, immutable safely.
Question 7Medium
What does Cache-Control: private mean?
- The response can be cached by CDNs only
- The response is never cached by anything
- Only the browser may cache it, not CDNs
- The response is encrypted and needs a key
Answer: C. Only the browser may cache it, not CDNs
Explanation
private responses (e.g. user-specific pages) may be stored by the browser but not by CDNs or proxies.
Step-by-step solution
- Private means the response is for a single user.
- The browser may store it.
- Shared caches such as CDNs and proxies must not store it.
- So the correct answer is only the browser may cache it, not CDNs.
Why the other options are wrong
- A. It is the opposite: CDNs are the ones excluded.
- B. Private still allows browser caching, so it is not never cached.
- D. Private is about who may cache, not about encryption.
Tip: private = browser only; public = any cache; use private for user-specific pages.
Question 8Medium
What HTTP status does a server return when a conditional request finds the resource unchanged?
- 204 No Content
- 302 Found (redirect to cache)
- 200 OK
- 304 Not Modified
Answer: D. 304 Not Modified
Explanation
304 tells the client to use its cached copy; no body is sent.
Step-by-step solution
- A conditional request sends If-None-Match or If-Modified-Since.
- If the resource has not changed, the server responds without a body.
- The status for that is 304 Not Modified.
- So the correct answer is 304 Not Modified.
Why the other options are wrong
- A. 204 means success with no body, but not for an unchanged cached resource.
- B. 302 is a redirect, not a cache check result.
- C. 200 sends the full resource body, which is not used when unchanged.
Tip: 304 Not Modified = use your cached copy; no body is sent.
Question 9Hard
Which header combination is typical for a hashed static asset like /assets/app.3f9a2c.js?
- Cache-Control: no-cache, private
- Cache-Control: no-store
- Cache-Control: public, max-age=31536000, immutable
- Cache-Control: max-age=0, must-revalidate, private
Answer: C. Cache-Control: public, max-age=31536000, immutable
Explanation
The filename changes whenever content changes, so the URL can be cached for a year and marked immutable to skip revalidation.
Step-by-step solution
- The hashed filename changes when content changes.
- So the URL can be cached for a year.
- Immutable tells the browser not to revalidate during that time.
- So the correct answer is public, max-age=31536000, immutable.
Why the other options are wrong
- A. No-cache forces revalidation, which wastes the benefit of hashed names.
- B. No-store stops all caching of the file.
- D. Max-age=0 with must-revalidate forces a check on every use.
Tip: Hashed static assets: public, max-age=31536000, immutable.
Question 10Hard
A site serves index.html with Cache-Control: max-age=31536000 and deploys new hashed JS files. What problem appears?
- Users download the new JS but with the old CSS
- Users keep old HTML pointing at old JS
- Nothing; long max-age on HTML is best practice
- The CDN refuses to serve files with long max-age
Answer: B. Users keep old HTML pointing at old JS
Explanation
The HTML is the entry point that references hashed assets; caching it for a year means users never see new deployments. HTML is usually no-cache or short-lived.
Step-by-step solution
- index.html is the entry point that names the hashed JS files.
- With max-age one year, browsers keep the old index.html.
- The old HTML points at old JS files, so users miss the new deployment.
- So the correct answer is users keeping old HTML that points at old JS.
Why the other options are wrong
- A. The HTML decides which JS and CSS load, so the mismatch is not about old CSS alone.
- C. A long max-age on HTML is not best practice; HTML should be no-cache or short-lived.
- D. CDNs do not refuse long max-age.
Tip: Hashed assets can be cached for a year, but the HTML entry point should be no-cache or short-lived.
Practise all 13 questions free
The full question bank with timed practice, progress tracking and Vidya, your AI tutor. Free, no ads.
Open this topic in the app →