REST API Design Multiple Choice Quiz 1

  1. What does REST stand for?
    • a) Remote Execution State Transfer
    • b) Representational State Transfer
    • c) Rapid Execution Service Technology
    • d) Resource Extraction and State Transfer
  2. Which HTTP method is idempotent?
    • a) POST
    • b) GET
    • c) PATCH
    • d) OPTIONS
  3. What is the primary purpose of the OPTIONS HTTP method?
    • a) To retrieve a resource
    • b) To update a resource
    • c) To describe the communication options for the target resource
    • d) To delete a resource
  4. Which status code range represents successful responses?
    • a) 100-199
    • b) 200-299
    • c) 300-399
    • d) 400-499
  5. What is HATEOAS?
    • a) A type of authentication protocol
    • b) A caching mechanism
    • c) Hypermedia As The Engine Of Application State
    • d) HTTP And Transfer Engine Over Application Servers
  6. Which of the following is not a key principle of REST architecture?
    • a) Stateless
    • b) Client-Server
    • c) Cacheable
    • d) Object-Oriented
  7. What is the purpose of the Accept header in HTTP requests?
    • a) To specify the media types acceptable for the response
    • b) To indicate the content type of the request body
    • c) To authenticate the client
    • d) To specify the version of the API
  8. Which HTTP method is typically used to update an existing resource?
    • a) GET
    • b) POST
    • c) PUT
    • d) DELETE
  9. What does API versioning primarily aim to achieve?
    • a) Increase security
    • b) Improve performance
    • c) Maintain backward compatibility
    • d) Reduce server load
  10. Which of the following is a benefit of using JSON over XML in REST APIs?
    • a) Better security
    • b) More human-readable
    • c) Supports more data types
    • d) Lighter weight and faster processing
  11. What is the purpose of the ETag header?
    • a) To authenticate requests
    • b) To specify the content type
    • c) To enable caching and conditional requests
    • d) To indicate the API version
  12. Which HTTP status code indicates a successful deletion of a resource?
    • a) 200 OK
    • b) 201 Created
    • c) 204 No Content
    • d) 404 Not Found
  13. What is the main advantage of statelessness in REST?
    • a) Improved security
    • b) Better scalability
    • c) Faster response times
    • d) Simplified client-side development
  14. Which HTTP method is used to retrieve a resource?
    • a) GET
    • b) POST
    • c) PUT
    • d) PATCH
  15. What is the purpose of content negotiation in REST APIs?
    • a) To negotiate the price of API usage
    • b) To select the best representation for a given response
    • c) To negotiate authentication methods
    • d) To determine the API version to use
  16. Which header is used to specify the format of the request body?
    • a) Accept
    • b) Content-Type
    • c) Authorization
    • d) Cache-Control
  17. What is the primary purpose of API documentation?
    • a) To increase API security
    • b) To improve API performance
    • c) To help developers understand and use the API
    • d) To handle API versioning
  18. Which of the following is NOT a common method for API authentication?
    • a) API Keys
    • b) OAuth
    • c) JWT (JSON Web Tokens)
    • d) XML-RPC
  19. What is the purpose of the HEAD HTTP method?
    • a) To retrieve a resource
    • b) To retrieve only the headers that would be returned if the GET method was used
    • c) To update a resource
    • d) To delete a resource
  20. Which status code should be returned when a resource is not found?
    • a) 400 Bad Request
    • b) 401 Unauthorized
    • c) 403 Forbidden
    • d) 404 Not Found