HOME
Are you familiar with Rest API and want to test your understanding? This post has 25 useful Rest API multiple-choice questions (quiz) to self-test your knowledge of Rest API.
You can find the questions for the below-mentioned answers in this post –
Rest API Multiple Choice Questions – MCQ1
Answers
1) 2) Representational State Transfer
2) 2) HTTP
3) 4) Request Header
4) 3) Both (1) and (2)
5) 2) 404
Here is a brief explanation of the different status codes
– 401: Unauthorized – The request requires user authentication.
– 402: Payment Required – This status code is reserved for future use.
– 403: Forbidden – The server understood the request but refuses to authorize it.
– 404: Not Found – The server can’t find the requested page.
6) 1) 500
Here’s a brief explanation of the different status codes:
– 500: Internal Server Error – The server encountered an unexpected condition that prevented it from fulfilling the request.
– 501: Not Implemented – The server either does not recognize the request method, or it lacks the ability to fulfill the request.
– 502: Bad Gateway – The server received an invalid response from the upstream server while trying to fulfill the request.
– 504: Gateway Timeout – The server, while acting as a gateway or proxy, did not receive a timely response from the upstream server.
7) 3) Success
8) 1) CREATE
CREATE is not an HTTP method. The standard HTTP methods include:
– GET: Retrieve data from a server.
– POST: Send data to a server to create a resource.
– PUT: Update or create a resource on the server with the provided data.
– DELETE: Remove a resource from the server.
– OPTIONS: Describe the communication options for the target resource.
– HEAD: Similar to GET but without the response body.
– PATCH: Apply partial modifications to a resource.
– TRACE: Perform a message loop-back test along the path to the target resource.
– CONNECT: Establish a tunnel to the server identified by the target resource.
9) 1) POST
10) 2) PUT
11) 1) /{resource}/{resource-id}/{sub-resource}/{sub-resource-id}
12) 2) Created
13) 1) GET, POST, PUT, DELETE
14) 2) DELETE
15) 1) GET /users/{id}
It clearly indicates the resource (/users) and the specific item of that resource ({id}).
16) 1) 403
403: Forbidden – This status indicates that the server understands the request but refuses to authorize it.
404: Not Found – Indicates that the requested resource could not be found on the server.
406: Not Acceptable – Indicates that the server cannot generate a response that is acceptable to the client based on the accept headers sent in the request
409: Conflict – Indicates that the request could not be completed due to a conflict with the current state of the resource, such as a version control conflict.
17) 3) The resource requested has been found and moved temporarily to new URL location.
18) 4) Informational
19) 2) PUT updates the entire resource, while PATCH updates only specific fields of a resource
20) 2) It defines the format of the request payload
21) 3) It provides authentication credentials for accessing protected resources
22) 2) The property that a method can be called multiple times without different outcomes
23) 2) To retrieve the communication options available on a resource or server
24) 3) curl
25) 4) no-cache/no-store