{
  "quiz": [
    {
      "type": "multiple_choice",
      "question": "How does reusing a stored cache response directly reduce the processing load on an origin server?",
      "answerOptions": [
        {
          "text": "It eliminates the need for the origin server to parse requests, query databases, or render template engines.",
          "isCorrect": true,
          "rationale": "When a stored response is reusable, the origin server is bypassed completely, saving the compute resources required to parse routing, restore sessions, query databases, or render templates."
        },
        {
          "text": "It offloads database query parsing directly onto intermediate proxy servers.",
          "isCorrect": false,
          "rationale": "Intermediate proxy servers only store and serve HTTP network responses; they do not execute database queries or application backend logic."
        },
        {
          "text": "It forces the origin server to convert dynamic HTTP requests into static POST operations.",
          "isCorrect": false,
          "rationale": "Caching reuses previously generated responses rather than altering the HTTP methods or backend request handling logic."
        },
        {
          "text": "It automatically compresses server memory logs by redirecting traffic to client browsers.",
          "isCorrect": false,
          "rationale": "Response reusability reduces incoming request traffic on the server, rather than changing server log management or memory compression."
        }
      ],
      "hint": "Consider the backend operations that an origin server bypasses when it does not need to handle an incoming request."
    },
    {
      "type": "multiple_choice",
      "question": "What distinguishes a private cache from a shared cache in HTTP caching?",
      "answerOptions": [
        {
          "text": "A private cache is dedicated to a single client to hold personalized content, whereas a shared cache sits between clients and servers to serve multiple users.",
          "isCorrect": true,
          "rationale": "Private caches (such as browser caches) store responses exclusively for one user to prevent information leakage, whereas shared caches (such as proxies and CDNs) store responses shared among multiple users."
        },
        {
          "text": "A private cache is managed exclusively by CDNs, while a shared cache operates strictly within a user's web browser.",
          "isCorrect": false,
          "rationale": "Browser caches are private caches tied to individual clients, whereas CDNs are managed shared caches."
        },
        {
          "text": "A private cache cannot store cookies, while a shared cache requires cookies to differentiate user content.",
          "isCorrect": false,
          "rationale": "Personalized content in private caches is often controlled by cookies, whereas shared caches must avoid storing personalized cookie-dependent responses to prevent privacy leaks."
        },
        {
          "text": "A private cache strictly ignores expiration headers, whereas a shared cache enforces heuristic caching rules exclusively.",
          "isCorrect": false,
          "rationale": "Both private and shared caches observe freshness standards and caching directives."
        }
      ],
      "hint": "Think about who can access the stored responses in each cache location."
    },
    {
      "type": "multiple_choice",
      "question": "Under what condition will a client engage in heuristic caching?",
      "answerOptions": [
        {
          "text": "When an HTTP response lacks an explicit Cache-Control header but contains headers indicating past modification history.",
          "isCorrect": true,
          "rationale": "HTTP is designed to cache as much as possible, so when explicit directives like max-age are missing, clients estimate freshness based on header history (such as Last-Modified)."
        },
        {
          "text": "When the server sends a Cache-Control: no-store header alongside a past Expires date.",
          "isCorrect": false,
          "rationale": "An explicit no-store directive instructs caches not to store the response under any circumstances."
        },
        {
          "text": "When a user performs a forced browser reload using Pragma: no-cache.",
          "isCorrect": false,
          "rationale": "A force reload intentionally bypasses stored cached responses to obtain an unconditional fresh response from the origin server."
        },
        {
          "text": "When multiple concurrent requests collapse into a single outgoing origin request.",
          "isCorrect": false,
          "rationale": "Request collapse is an optimization technique used by shared caches to consolidate traffic, independent of heuristic caching."
        }
      ],
      "hint": "Consider how HTTP behaves when explicit Cache-Control instructions are omitted from a response."
    },
    {
      "type": "multiple_choice",
      "question": "A shared cache delivers a stored response with Cache-Control: max-age=604800 (1 week) and Age: 86400 (1 day). For how many remaining seconds will the receiving client consider this response fresh?",
      "answerOptions": [
        {
          "text": "518400 seconds",
          "isCorrect": true,
          "rationale": "The remaining freshness lifetime is calculated by subtracting the response's Age (86,400 seconds) from its max-age (604,800 seconds), resulting in 518,400 seconds."
        },
        {
          "text": "604800 seconds",
          "isCorrect": false,
          "rationale": "This represents the total max-age lifetime from initial generation, ignoring the time already spent stored in the shared cache."
        },
        {
          "text": "86400 seconds",
          "isCorrect": false,
          "rationale": "This value reflects the time elapsed since the response was generated, not the remaining duration of freshness."
        },
        {
          "text": "691200 seconds",
          "isCorrect": false,
          "rationale": "This represents the sum of max-age and Age rather than the difference indicating remaining fresh time."
        }
      ],
      "hint": "Calculate the difference between the total maximum age allowed and the time the response has already spent cached."
    },
    {
      "type": "multiple_choice",
      "question": "When both an Expires header and a Cache-Control: max-age directive are present in an HTTP response, how do HTTP/1.1-compliant caches handle them?",
      "answerOptions": [
        {
          "text": "max-age is preferred and overrides the Expires header.",
          "isCorrect": true,
          "rationale": "HTTP/1.1 defines max-age to take precedence over Expires because relative time durations avoid clock synchronization issues and date parsing errors."
        },
        {
          "text": "Expires takes precedence because explicit timestamps supersede relative time intervals.",
          "isCorrect": false,
          "rationale": "Expires dates are prone to implementation bugs and system clock drift, so modern HTTP standards prioritize max-age."
        },
        {
          "text": "The response is treated as conflicting and immediately marked as stale.",
          "isCorrect": false,
          "rationale": "Standard HTTP cache implementations handle the co-existence of both headers smoothly by giving precedence to max-age."
        },
        {
          "text": "The cache falls back to heuristic caching calculation rules.",
          "isCorrect": false,
          "rationale": "Heuristic caching occurs only when explicit freshness directives like max-age or Expires are missing."
        }
      ],
      "hint": "Recall which directive was introduced in HTTP/1.1 to replace explicit date-time parsing."
    },
    {
      "type": "multiple_choice",
      "question": "What is the primary operational effect of returning a Vary: Accept-Language header in an HTTP response?",
      "answerOptions": [
        {
          "text": "It causes the cache to key stored responses using a composite of the response URL and the Accept-Language request header.",
          "isCorrect": true,
          "rationale": "The Vary header informs caches that content negotiation applies, forcing the cache to separate stored variants based on request header values."
        },
        {
          "text": "It forces the client to send a Cache-Control: private directive with every request.",
          "isCorrect": false,
          "rationale": "Vary alters cache keying for content negotiation rather than adding cache-control directives to client requests."
        },
        {
          "text": "It automatically translates uncached response bodies into the primary language of the requesting client.",
          "isCorrect": false,
          "rationale": "Vary instructs caches how to store variants; translation logic remains entirely with the origin server."
        },
        {
          "text": "It prevents shared caches from storing any variation of the requested resource.",
          "isCorrect": false,
          "rationale": "Vary allows caches to safely store multiple distinct language variants for a single URL rather than preventing caching."
        }
      ],
      "hint": "Think about how the cache key is constructed when content negotiation request headers are specified."
    },
    {
      "type": "multiple_choice",
      "question": "What response does an origin server send when a client validates a stale resource using If-None-Match or If-Modified-Since and the resource has NOT changed?",
      "answerOptions": [
        {
          "text": "304 Not Modified status code with no response body.",
          "isCorrect": true,
          "rationale": "A 304 response signals that the cached representation remains valid, sending only headers to minimize transfer size while revalidating the cached content."
        },
        {
          "text": "200 OK status code containing the updated headers and full payload body.",
          "isCorrect": false,
          "rationale": "A 200 OK status with a full body payload is returned only when the resource content has actually changed."
        },
        {
          "text": "204 No Content status code, which invalidates the stale response in the client.",
          "isCorrect": false,
          "rationale": "A 204 status code denotes a successful request with no payload, whereas 304 specifically revalidates stale cached responses."
        },
        {
          "text": "412 Precondition Failed status code requiring an unconditional request.",
          "isCorrect": false,
          "rationale": "A 412 status code indicates a precondition failure during state-changing or conditional execution, not a cache revalidation match."
        }
      ],
      "hint": "Focus on the status code and payload structure when the server confirms the client's cached copy is up to date."
    },
    {
      "type": "multiple_choice",
      "question": "How does Cache-Control: no-cache differ from Cache-Control: no-store?",
      "answerOptions": [
        {
          "text": "no-cache permits storing the response but forces revalidation before reuse, whereas no-store forbids storing the response anywhere.",
          "isCorrect": true,
          "rationale": "no-cache forces caches to send a conditional validation request to the server before reusing a stored response, while no-store prevents storing the response in any cache."
        },
        {
          "text": "no-cache prevents storing responses in browser caches, whereas no-store prevents storing responses in shared proxy caches.",
          "isCorrect": false,
          "rationale": "Both directives apply to both private and shared caches; the distinction is storage prohibition versus revalidation requirements."
        },
        {
          "text": "no-cache immediately deletes pre-existing stored responses, whereas no-store allows stale historical responses to be reused.",
          "isCorrect": false,
          "rationale": "no-store prevents new responses from being stored but does not delete already-stored responses, while no-cache requires revalidation before reusing any stored response."
        },
        {
          "text": "no-cache is used exclusively for HTML pages, whereas no-store is required for static subresources.",
          "isCorrect": false,
          "rationale": "Both directives can be applied to any HTTP resource depending on privacy and freshness requirements."
        }
      ],
      "hint": "Differentiate between permission to store content versus permission to reuse content without checking the server."
    },
    {
      "type": "multiple_choice",
      "question": "Which HTTP headers are characteristically included in a request sent by major browsers during a user-initiated force reload?",
      "answerOptions": [
        {
          "text": "Pragma: no-cache and Cache-Control: no-cache",
          "isCorrect": true,
          "rationale": "Force reloads send Cache-Control: no-cache (along with Pragma: no-cache for backward compatibility) without conditional headers like If-None-Match, ensuring an unconditional fetch from the origin."
        },
        {
          "text": "Cache-Control: max-age=0 and conditional headers like If-None-Match",
          "isCorrect": false,
          "rationale": "Sending max-age=0 along with conditional headers is characteristic of a standard browser reload, which validates cached content rather than forcing an unconditional fetch."
        },
        {
          "text": "Cache-Control: private, immutable",
          "isCorrect": false,
          "rationale": "immutable is a response directive sent by servers to prevent revalidation during reloads, not a client request header."
        },
        {
          "text": "Clear-Site-Data: cache and Age: 0",
          "isCorrect": false,
          "rationale": "Clear-Site-Data is an origin server response header used to clear browser cache storage, not a request header sent by clients."
        }
      ],
      "hint": "Consider how a browser communicates to the origin server that it wants to bypass all intermediate and browser caches without sending conditional tags."
    },
    {
      "type": "multiple_choice",
      "question": "What limitation exists when an origin server attempts to update or purge a resource that was previously cached in a browser with a long max-age?",
      "answerOptions": [
        {
          "text": "The origin server loses control of that URL because subsequent requests are served locally by the browser without contacting the server.",
          "isCorrect": true,
          "rationale": "Because fresh cached responses are served locally by the browser without reaching the origin server, the server cannot update the client until max-age expires or the user manually clears the cache."
        },
        {
          "text": "The origin server can send an asynchronous DELETE method to automatically clear browser memory caches remotely.",
          "isCorrect": false,
          "rationale": "Standard HTTP caching specifications do not define a way to explicitly delete or push purges to browser caches remotely once a fresh response is stored."
        },
        {
          "text": "Returning Cache-Control: no-store on a new response automatically purges older cached entries for that URL.",
          "isCorrect": false,
          "rationale": "no-store prevents new responses from being cached, but it does not remove previously stored responses for that same URL."
        },
        {
          "text": "Browsers automatically purge long max-age resources every 24 hours regardless of specified age directives.",
          "isCorrect": false,
          "rationale": "Responses with long max-age directives remain stored and valid in the browser cache until their specified duration expires, unless cleared manually."
        }
      ],
      "hint": "Think about whether requests for cached URLs even reach the server before expiration."
    },
    {
      "type": "multiple_choice",
      "question": "What occurs during request collapse within a shared cache when multiple identical requests arrive simultaneously?",
      "answerOptions": [
        {
          "text": "The shared cache forwards a single request to the origin server and reuses the resulting response for all waiting clients.",
          "isCorrect": true,
          "rationale": "Request collapse optimizes shared cache traffic by consolidating concurrent identical requests into a single request to the origin, sharing the result among all requesting clients."
        },
        {
          "text": "The shared cache rejects all concurrent incoming requests with a 429 Too Many Requests status code.",
          "isCorrect": false,
          "rationale": "Request collapse handles incoming concurrent requests by fulfilling them with a single origin call, rather than rejecting traffic."
        },
        {
          "text": "The shared cache automatically converts all incoming requests into conditional requests containing If-Modified-Since.",
          "isCorrect": false,
          "rationale": "Request collapse consolidates incoming requests into a single fetch, regardless of conditional headers."
        },
        {
          "text": "The shared cache transforms the response header into Cache-Control: private to prevent shared storage.",
          "isCorrect": false,
          "rationale": "Request collapse is a shared cache performance mechanism; applying Cache-Control: private would explicitly prevent sharing."
        }
      ],
      "hint": "Consider what a shared proxy or CDN does when several users request the exact same uncached URL at the exact same instant."
    },
    {
      "type": "multiple_select",
      "question": "Which of the following strategies represent recommended best practices for managing static subresources versus main HTML resources?",
      "answerOptions": [
        {
          "text": "Serve static subresources using cache-busted URLs (containing a version or hash) and long max-age values (such as 1 year).",
          "isCorrect": true,
          "rationale": "Subresources with content hashes or version numbers in their URLs can be safely cached for long periods because updates automatically produce distinct, new URLs."
        },
        {
          "text": "Serve main HTML resources with Cache-Control: no-cache alongside ETag or Last-Modified headers.",
          "isCorrect": true,
          "rationale": "Main HTML document URLs cannot be easily cache-busted, so requiring revalidation with no-cache ensures clients always fetch the latest content while utilizing lightweight 304 revalidation when unchanged."
        },
        {
          "text": "Serve main HTML resources with Cache-Control: public, max-age=31536000 to completely offload origin server traffic.",
          "isCorrect": false,
          "rationale": "Caching main HTML resources for long durations without revalidation prevents clients from receiving page updates released on the origin server."
        },
        {
          "text": "Apply Cache-Control: no-store liberally across all static subresources to maximize security.",
          "isCorrect": false,
          "rationale": "Liberally applying no-store removes performance benefits, increases server bandwidth, and disables useful platform features like the browser back/forward cache."
        }
      ],
      "hint": "Contrast subresources (which can use version/hash strings in their URLs) with main resources (whose URLs cannot easily change).",
      "hasAllOfTheAbove": false,
      "hasNoneOfTheAbove": false
    }
  ],
  "topics": {
    "covered": [
      "HTTP Cache Fundamentals and Server Offloading Benefits",
      "Private Caches vs Shared Caches",
      "Heuristic Caching Conditions",
      "Cache Age and Freshness Lifetime Calculations",
      "Expires vs Cache-Control max-age Preference Rules",
      "Content Negotiation with the Vary Header",
      "Cache Validation using Conditional Requests (ETag and Last-Modified)",
      "Cache Control Directives (no-cache vs no-store)",
      "Browser Reloads and Force Reload Header Behaviors",
      "Limitations in Deleting Stored Browser Responses",
      "Request Collapse in Shared Caches",
      "Common Caching Patterns for Subresources and Main HTML Resources"
    ],
    "followUp": [
      "CDN-Cache-Control and Standardization of Proxy Directives",
      "Managed Cache Control via Service Workers and Cache API",
      "QPACK Compression of Common Cache-Control Field Values",
      "Back/Forward Cache (bfcache) Mechanics during History Navigations"
    ]
  }
}
