REST API Design Multiple Choice Quiz 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
- Which HTTP method is idempotent?
- a) POST
- b) GET
- c) PATCH
- d) OPTIONS
- 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
- Which status code range represents successful responses?
- a) 100-199
- b) 200-299
- c) 300-399
- d) 400-499
- 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
- Which of the following is not a key principle of REST architecture?
- a) Stateless
- b) Client-Server
- c) Cacheable
- d) Object-Oriented
- 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
- Which HTTP method is typically used to update an existing resource?
- a) GET
- b) POST
- c) PUT
- d) DELETE
- What does API versioning primarily aim to achieve?
- a) Increase security
- b) Improve performance
- c) Maintain backward compatibility
- d) Reduce server load
- 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
- 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
- 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
- What is the main advantage of statelessness in REST?
- a) Improved security
- b) Better scalability
- c) Faster response times
- d) Simplified client-side development
- Which HTTP method is used to retrieve a resource?
- a) GET
- b) POST
- c) PUT
- d) PATCH
- 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
- Which header is used to specify the format of the request body?
- a) Accept
- b) Content-Type
- c) Authorization
- d) Cache-Control
- 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
- 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
- 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
- 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