HTTP u0026 REST Fundamentals: Understanding Status Codes, Headers, and Network Tools Quiz

Test your knowledge of HTTP and REST basics with questions on status codes, headers, caching mechanisms like ETag, CORS, and request timing using the Network panel. Perfect for beginners who want to grasp essential web communication concepts and troubleshooting skills.

  1. Identifying a Successful Request

    Which HTTP status code indicates that a GET request has completed successfully and the resource is returned as expected?

    1. 404 Not Found
    2. 500 Error
    3. 301 Moved Permanently
    4. 200 OK

    Explanation: The status code 200 OK means the request succeeded, and the server returned the requested resource. A 404 Not Found code means the resource was not found. 500 Error is a server error, and 301 Moved Permanently indicates the resource has moved to a new URL. Only 200 OK denotes a normal, successful retrieval.

  2. Purpose of Response Headers

    In an HTTP response, what is the main purpose of headers such as 'Content-Type' and 'Cache-Control'?

    1. They encrypt the response body
    2. They store cookies directly
    3. They compress the response automatically
    4. They provide metadata about the response

    Explanation: Response headers like 'Content-Type' and 'Cache-Control' supply metadata about how the body should be handled. They don’t encrypt or compress the response themselves, though they can indicate such features. Storing cookies uses the 'Set-Cookie' header, which is separate from those mentioned.

  3. Meaning of 404 Status

    When you see a 404 status code in the Network panel after requesting a URL, what does it indicate about the request?

    1. Data was sent successfully
    2. The server timed out
    3. The server cannot find the requested resource
    4. Authentication is required

    Explanation: A 404 status code means the requested URL doesn't exist on the server. Authentication required corresponds to codes like 401. Timeout errors appear with codes like 504. 200 or 201 statuses would indicate data was sent or received successfully.

  4. Function of ETag

    What is the main role of the 'ETag' HTTP response header in web caching?

    1. To specify accepted languages
    2. To identify a specific version of a resource
    3. To establish session cookies
    4. To indicate the type of encoding used

    Explanation: ETag helps identify the unique version of a resource and plays a critical role in conditional caching. It doesn’t define encoding (which is handled by Content-Encoding), accepted languages (Accept-Language), or manage cookies (Set-Cookie). ETag specifically helps optimize cache validation.

  5. Understanding CORS Preflight

    In the context of CORS, which HTTP method triggers a preflight request observed in the Network panel?

    1. PUT
    2. POST
    3. OPTIONS
    4. GET

    Explanation: The OPTIONS method is used for CORS preflight requests, allowing the browser to determine if the actual request is safe. POST, GET, and PUT are standard methods for sending data but do not initiate preflight checks by themselves. Only OPTIONS is used for this special purpose.

  6. Reading Response Time

    In the Network panel, what does the 'Time' column typically indicate for a completed HTTP request?

    1. The total duration from request sent to response received
    2. The server's local time
    3. The average load of the server
    4. The time zone of the client

    Explanation: The 'Time' column shows how long the request took from start to finish. It doesn’t indicate time zones or the server's local time, nor does it reflect server load. Its purpose is to highlight network timing details for performance analysis.

  7. Purpose of Access-Control-Allow-Origin

    Which HTTP response header is crucial for allowing cross-origin requests in CORS?

    1. Access-Control-Allow-Origin
    2. Cache-Control
    3. Set-Cookie
    4. Content-Encoding

    Explanation: Access-Control-Allow-Origin is essential for controlling cross-origin resource sharing. Cache-Control manages caching behavior, Content-Encoding specifies how the response is encoded, and Set-Cookie relates to client-side cookie storage. Only Access-Control-Allow-Origin is tied directly to CORS.

  8. Identifying 304 Not Modified

    What does a 304 Not Modified status code mean when a browser receives it after making a request with an 'If-None-Match' header?

    1. There is a syntax error in the request
    2. Access is forbidden by the server
    3. The cached version may be used because the resource has not changed
    4. The resource was created successfully

    Explanation: A 304 Not Modified tells the browser that the previously cached resource is still valid. Forbidden access returns a 403 code, syntax errors yield a 400 code, and successful creation is indicated by 201 Created. Only 304 signals effective caching and no need to download again.

  9. Recognizing a POST Request

    In the Network panel, what distinguishes an HTTP POST request from a GET request?

    1. GET is not visible in the Network panel
    2. POST usually has a request body and often changes server data
    3. POST requests never use headers
    4. POST requests always result in 404 errors

    Explanation: POST methods typically send data in the request body and may modify server-side data. POST requests can and often do use headers. GET is visible in the Network panel, and POST does not always result in errors—it is a normal method for sending data.

  10. Reading the Content-Type Header

    If a server responds with 'Content-Type: application/json', what does this convey to the client?

    1. The response body is formatted as JSON data
    2. The response contains only text
    3. The response is always encrypted
    4. The response must be cached forever

    Explanation: The Content-Type header tells clients the nature of the data in the response, in this case, JSON. It does not indicate encryption or caching. Also, JSON can contain both textual and numerical data, not just plain text.

  11. Effect of 403 Forbidden

    What does an HTTP 403 status code indicate when seen in the Network panel?

    1. The request timed out
    2. The server understood the request but refuses to fulfill it
    3. The client sent too many requests
    4. The resource is missing

    Explanation: A 403 code means the server knows what you’re asking but denies permission, typically due to security policies. A missing resource would be a 404 code. Timeout gives a 504 code, and too many requests would be a 429 code. 403 is specifically about forbidden access.

  12. Purpose of Cache-Control

    What does the 'Cache-Control: no-cache' directive instruct the browser to do with the response?

    1. Compress the resource before sending
    2. Always revalidate the resource with the server before using it
    3. Allow any site to make a request
    4. Never allow access to the resource

    Explanation: The no-cache value means the browser must confirm with the server before using a cached copy. It doesn’t block access, compress the response, or affect cross-origin requests. Only cache revalidation is affected by this header.

  13. Timing and Performance Insight

    Which part of the Network panel helps developers evaluate how long it takes for a resource to be downloaded after the server starts sending data?

    1. Response Header
    2. Status Code
    3. Content Download time
    4. Request Method

    Explanation: Content Download time specifically shows how long it takes to download the actual content, post-server response. Request Method denotes the HTTP verb, Status Code is about HTTP result, and Response Header describes metadata. Only Content Download time measures this aspect of performance.

  14. Purpose of the OPTIONS Method

    What is the primary role of the HTTP OPTIONS method as visible in network debugging tools?

    1. To discover allowed HTTP methods on a resource
    2. To upload files
    3. To cache resources
    4. To delete a resource

    Explanation: OPTIONS is designed to list which HTTP methods are permitted by a server for a given resource. Uploading is handled by POST or PUT, deleting by DELETE, and caching is managed by headers rather than methods. OPTIONS is for method discovery and validation.

  15. CORS Error Indicator

    If a web page’s request is blocked due to CORS, which message do you typically see in the Network panel?

    1. Page not found
    2. SSL certificate expired
    3. Resource modified locally
    4. CORS policy: No 'Access-Control-Allow-Origin' header

    Explanation: A failure to find the Access-Control-Allow-Origin header leads to CORS-related errors, often displaying a message about CORS policy. Other errors like SSL or 404 are unrelated, and 'Resource modified locally' is not a standard message for CORS issues.

  16. Identifying Request Headers

    When inspecting a request in the Network panel, under which category would you find 'User-Agent', 'Accept', and 'Authorization'?

    1. Cookies
    2. Status Codes
    3. Request Headers
    4. Response Headers

    Explanation: These headers are all sent by the client as part of the request. Response Headers are sent by the server. Status Codes represent server responses. Cookies may be listed separately, but these specific fields are part of Request Headers.