HTTP u0026 REST basics Quiz

Test your understanding of HTTP and REST basics with this quiz covering status codes, idempotency, and pagination concepts. Perfect for beginners seeking to assess or reinforce their foundational knowledge in web APIs.

  1. HTTP Status Codes: Successful Requests

    Which HTTP status code indicates that a request was successful and that the server returned the requested data, such as when accessing a resource GET /articles/1?

    1. 302 Found
    2. 500 Error
    3. 404 Not Found
    4. 200 OK
  2. HTTP Status Codes: Resource Created

    When a new resource is successfully created through a POST request, which HTTP status code should typically be returned?

    1. 401 Unauthorized
    2. 204 No Content
    3. 304 Modified
    4. 201 Created
  3. Understanding Idempotency

    Which HTTP method is considered idempotent, meaning that making the same request multiple times yields the same result on the server?

    1. POST
    2. PATCH
    3. PUT
    4. CONNECT
  4. HTTP Status Codes: Client Error

    Which status code should a server respond with if a requested resource, like /user/9999, does not exist?

    1. 404 Not Found
    2. 202 Accepted
    3. 301 Redirect
    4. 502 Bad Gateway
  5. Safe vs Unsafe Methods

    Which HTTP method is considered 'safe' because it does not modify resources, such as retrieving user information with GET /users/123?

    1. DELETE
    2. GET
    3. MERGE
    4. POST
  6. Pagination in REST APIs

    When retrieving a large list of results, which technique helps to return only a subset of data, often using parameters like limit and offset?

    1. Pagination
    2. Broadcasting
    3. Encryption
    4. Replication
  7. HTTP Status Codes: No Content

    After a successful DELETE API call that removes a resource, which status code is commonly returned to indicate success with no response body?

    1. 407 Proxy Auth Required
    2. 403 Forbidden
    3. 204 No Content
    4. 423 Locked
  8. Idempotency in HTTP Methods

    If sending the same DELETE request multiple times results in the same state, what property does the DELETE method exhibit?

    1. Idempotency
    2. Serialization
    3. Deprecation
    4. Security
  9. HTTP Status Codes: Redirection

    Which HTTP status code is used to inform the client that a resource has been temporarily moved to another URL (e.g., /old-page to /new-page)?

    1. 504 Timeout
    2. 302 Found
    3. 418 I'm a teapot
    4. 202 Delayed
  10. Pagination Parameters

    When implementing pagination, which two query parameters are typically used together to control the number and range of results returned by GET /products?

    1. host and port
    2. type and size
    3. value and id
    4. limit and offset