API REST API Fundamentals 1 — Questions and Answers
Question 1: Which HTTP method is idempotent and used to fully replace a resource?
- POST
- PUT (Correct answer)
- PATCH
- DELETE
Correct answer: PUT
PUT is idempotent and replaces the entire resource at the specified URI.
Question 2: What HTTP status code indicates a resource was successfully created?
- 200 OK
- 201 Created (Correct answer)
- 204 No Content
- 202 Accepted
Correct answer: 201 Created
201 Created is the standard response when a POST request successfully creates a new resource.
Question 3: Which HTTP status code means the client is not authorized and must authenticate?
- 400
- 403
- 401 (Correct answer)
- 404
Correct answer: 401
401 Unauthorized indicates that authentication is required and has failed or not been provided.
Question 4: What does a 404 HTTP status code indicate?
- Server error
- Redirect required
- Resource not found (Correct answer)
- Request timeout
Correct answer: Resource not found
404 Not Found means the server cannot locate the requested resource at the given URI.
Question 5: Which HTTP method should be used for partial updates to a resource?
- PUT
- POST
- PATCH (Correct answer)
- OPTIONS
Correct answer: PATCH
PATCH is designed for partial modifications to an existing resource.
Question 6: What does REST stand for?
- Remote Endpoint Service Transfer
- Representational State Transfer (Correct answer)
- Resource Entity System Transfer
- Remote Execution State Template
Correct answer: Representational State Transfer
REST stands for Representational State Transfer, an architectural style for distributed hypermedia systems.
Which HTTP method is idempotent and used to fully replace a resource?