HTTP Status Codes Fundamentals Quiz Quiz

Explore essential HTTP status codes and their meanings with practical scenarios. Designed for web professionals and learners seeking to understand basics like redirects, errors, and successful responses in the context of HTTP communications.

  1. Identifying a Successful Request

    When a client successfully retrieves a web page from a server, which HTTP status code is typically returned to indicate success?

    1. 200 OK
    2. 404 Not Found
    3. 500 Internal Server
    4. 301 Moved

    Explanation: The 200 OK status code signifies that the request was successful and the server returned the requested content. 404 Not Found is used when the resource cannot be located. 500 Internal Server represents a generic server-side error, not success. 301 Moved is used for permanent URL redirection, not for successful content retrieval.

  2. Understanding 'Not Found'

    You visit a URL and see a message saying the page does not exist; what HTTP status code should the server send in this scenario?

    1. 404 Not Found
    2. 302 Found
    3. 201 Created
    4. 401 Unauthorized

    Explanation: 404 Not Found is used when the requested resource is unavailable on the server. 401 Unauthorized means authentication is required. 201 Created is used when a new resource has been successfully created, not when something is missing. 302 Found is for temporary redirects, not missing pages.

  3. Meaning of 301 Status Code

    Which HTTP status code indicates that a webpage has been permanently moved to a new URL?

    1. 500 Server Error
    2. 400 Bad Request
    3. 301 Moved Permanently
    4. 202 Accepted

    Explanation: 301 Moved Permanently tells browsers and bots to update their bookmarks, as the page has a new permanent URL. 400 Bad Request signals a problem with the client's request. 500 Server Error points to server failures, and 202 Accepted is used when a request has been received for processing but not yet completed.

  4. Temporary Redirects

    If a website wants to temporarily redirect users to another page, which HTTP status code is the most appropriate?

    1. 200 OK
    2. 302 Found
    3. 410 Gone
    4. 403 Forbidden

    Explanation: 302 Found is used for temporary redirection, suggesting that the resource is currently elsewhere but may return. 403 Forbidden means access is denied, not redirected. 200 OK implies a successful operation with no redirection. 410 Gone indicates permanent removal of the resource.

  5. Unauthorized Access

    A user attempts to access a protected resource without logging in; which status code should the server respond with?

    1. 401 Unauthorized
    2. 404 Not Found
    3. 202 Accepted
    4. 429 Too Many Requests

    Explanation: 401 Unauthorized is used when authentication is required before allowing access to a resource. 429 Too Many Requests deals with rate limiting, not authentication. 202 Accepted signals successful request receipt, not authentication issues. 404 Not Found is for missing resources, not when authentication is lacking.

  6. Forbidden Resource

    If a server refuses to fulfill a valid request due to insufficient permissions, what is the correct HTTP status code?

    1. 403 Forbidden
    2. 304 Not Modified
    3. 503 Service Unavailable
    4. 201 Created

    Explanation: 403 Forbidden informs the client that, while the server understood the request, it refuses to authorize it. 503 Service Unavailable signals server downtime or overload. 201 Created is unrelated, used after resource creation. 304 Not Modified is for caching scenarios, not permission issues.

  7. Bad Request Meaning

    Which status code is appropriate when the server cannot process a request because it is malformed or contains invalid syntax?

    1. 400 Bad Request
    2. 402 Payment Required
    3. 502 Bad Gateway
    4. 307 Temporary Redirect

    Explanation: 400 Bad Request applies when the server detects a problem in the client's request formatting or syntax. 402 Payment Required is reserved for future use and is rarely implemented. 502 Bad Gateway is related to gateway or proxy errors, not client syntax. 307 Temporary Redirect involves temporary redirection logic.

  8. Server Error Identification

    If something goes wrong on the server side while handling a valid request, what status code will indicate a general server error?

    1. 403 Forbidden
    2. 500 Internal Server Error
    3. 304 Not Modified
    4. 204 No Content

    Explanation: 500 Internal Server Error signals a generic server-side problem encountered during handling. 204 No Content means the request was successful, but there is no content to return. 304 Not Modified is for caching and shows nothing has changed. 403 Forbidden is for client access denial, not server faults.

  9. Resource Creation Response

    After successfully creating a new user account via an API, which HTTP status code should be returned to signify the resource has been made?

    1. 400 Bad Request
    2. 401 Unauthorized
    3. 404 Not Found
    4. 201 Created

    Explanation: 201 Created confirms successful creation of a new resource, which fits when a new user account is made. 400 Bad Request indicates a malformed request. 404 Not Found is for missing resources, and 401 Unauthorized points to authentication issues, not successful creation.

  10. Too Many Requests

    When a client sends too many requests in a short period, which status code is used to signal rate limiting?

    1. 100 Continue
    2. 405 Method Not Allowed
    3. 429 Too Many Requests
    4. 500 Internal Server Error

    Explanation: 429 Too Many Requests notifies clients that they have exceeded their allowed request limit. 405 Method Not Allowed specifies that the HTTP method is inappropriate for the endpoint. 500 Internal Server Error is a general-purpose error for server faults, not rate limiting. 100 Continue is used in a different context to indicate interim responses.