REST API Design Multiple Choice Quiz 2
- What is the main difference between PUT and PATCH methods?
- a) PUT is for creating resources, PATCH is for updating
- b) PUT updates the entire resource, PATCH updates part of the resource
- c) PUT is idempotent, PATCH is not
- d) PUT is safer than PATCH
- Which of the following is NOT a benefit of using REST?
- a) Scalability
- b) Flexibility
- c) Stateful communication
- d) Improved performance
- What is the purpose of the Location header in an HTTP response?
- a) To indicate the location of the API documentation
- b) To specify where a newly created resource can be found
- c) To redirect the client to a different API endpoint
- d) To specify the physical location of the server
- Which HTTP method should be used to create a new resource when the client is choosing the URI?
- a) POST
- b) PUT
- c) PATCH
- d) GET
- What does CORS stand for in the context of web APIs?
- a) Create, Open, Read, Send
- b) Cross-Origin Resource Sharing
- c) Client-Oriented Response System
- d) Cached Object Request Service
- Which of the following is a valid way to version an API?
- a) Using URL path versioning
- b) Using query parameters
- c) Using custom headers
- d) All of the above
- What is the purpose of the If-Match header?
- a) To specify the desired response format
- b) To implement conditional requests based on the ETag
- c) To indicate the API version
- d) To authenticate the request
- Which HTTP status code indicates that a request was accepted for processing, but the processing has not been completed?
- a) 200 OK
- b) 201 Created
- c) 202 Accepted
- d) 204 No Content
- What is the main purpose of using hypermedia controls in REST APIs?
- a) To improve security
- b) To reduce network latency
- c) To provide dynamic navigation through the API
- d) To compress API responses
- Which of the following is NOT a common format for API responses?
- a) JSON
- b) XML
- c) HTML
- d) YAML
- What is the purpose of the Cache-Control header?
- a) To specify how long a response should be considered fresh
- b) To indicate the total size of the response
- c) To specify the compression algorithm used
- d) To authenticate the client
- Which HTTP method is used to delete a resource?
- a) GET
- b) POST
- c) PUT
- d) DELETE
- What is the main advantage of using OAuth for API authentication?
- a) Simplicity
- b) Speed
- c) Delegated authorization
- d) Built-in encryption
- Which status code should be returned when the server is undergoing maintenance?
- a) 403 Forbidden
- b) 404 Not Found
- c) 503 Service Unavailable
- d) 504 Gateway Timeout
- What is the purpose of API rate limiting?
- a) To increase API security
- b) To prevent abuse and ensure fair usage
- c) To improve API performance
- d) To implement API versioning
- Which of the following is NOT a REST constraint?
- a) Client-Server
- b) Stateless
- c) Cacheable
- d) Remote Procedure Call
- What is the main purpose of using ETags?
- a) To encrypt API responses
- b) To compress API responses
- c) To enable caching and prevent simultaneous updates
- d) To specify the API version
- Which HTTP method is used to update a resource when the client is sending only the changes?
- a) GET
- b) POST
- c) PUT
- d) PATCH
- What is the purpose of the Accept-Language header?
- a) To specify the desired response language
- b) To indicate the language of the request body
- c) To authenticate the client
- d) To specify the API version
- Which of the following is a benefit of using HATEOAS?
- a) Improved security
- b) Faster response times
- c) Increased scalability
- d) Reduced coupling between client and server