HTTP u0026 REST basics Quiz

Test your knowledge of HTTP and REST basics, including essential status codes, idempotency, and pagination concepts. This quiz helps reinforce best practices and common usage in web APIs and client-server communication.

  1. HTTP Status Codes

    Which HTTP status code indicates that a request has succeeded and returned the requested resource, such as in a typical GET request?

    1. 404 Found
    2. 200 OK
    3. 301 Moved
    4. 500 Success
  2. 404 Error Meaning

    When an API returns a 404 status code, what does it most commonly signify?

    1. The resource was not found
    2. The request timed out
    3. The content has moved
    4. The server is unavailable
  3. Definition of Idempotency

    In RESTful APIs, what does it mean for an HTTP method to be idempotent?

    1. It returns multiple responses
    2. It can only create new resources
    3. It always changes server state
    4. Multiple identical requests have the same effect as a single one
  4. Safe Methods in HTTP

    Which HTTP method is considered safe because it does not modify any resource on the server?

    1. DELETE
    2. PATCH
    3. GET
    4. POST
  5. Use of 201 Created

    When should an API respond with a 201 Created status code?

    1. When a resource cannot be found
    2. When a new resource has been successfully created
    3. When a request is forbidden
    4. When a resource is deleted
  6. Pagination Purpose

    What is the main purpose of implementing pagination in a REST API that lists items?

    1. Allow multiple users to modify the resource simultaneously
    2. Increase the security of the API
    3. Limit the amount of data returned in a single response
    4. Ensure data is encrypted during transfer
  7. Pagination Parameters

    Which two common query parameters are used to control pagination in an API endpoint?

    1. type and id
    2. page and limit
    3. sort and filter
    4. token and status
  8. PUT vs POST Idempotency

    Which HTTP method is typically idempotent when updating a resource, such as updating user data?

    1. PUT
    2. TRACE
    3. CONNECT
    4. POST
  9. 400 Bad Request

    What does the 400 Bad Request status code indicate in an HTTP response?

    1. The server cannot process the request due to invalid input
    2. The authentication failed
    3. The request was redirected
    4. The resource already exists
  10. DELETE Method Idempotency

    If you send the same DELETE request multiple times to remove the same resource in a REST API, what is the expected behavior according to idempotency rules?

    1. A server error will occur after the first attempt
    2. Only the first request deletes the resource; subsequent ones do nothing
    3. Every request will fail after the first
    4. Each request will create a new resource