Test your understanding of HTTP methods and status codes with this beginner-friendly quiz. Learn to identify key HTTP operations and recognize the meaning of common status codes in web communication.
Which HTTP method is used to retrieve data from a server without modifying any resources?
Explanation: The GET method requests data from a server and does not modify the resource. POST is used to submit data, possibly creating or modifying resources. UPDATE is not a standard HTTP method; the correct method is PUT or PATCH for updating. DELETE is used to remove resources from the server.
If a web server responds with status code 404, what does it indicate?
Explanation: A 404 status code means the requested resource could not be found on the server. 'Request successful' applies to code 200. 'Server error' is usually represented by codes starting with 5, such as 500. 'Redirection' is indicated by codes in the 300 range, not 404.
Which HTTP status code signals that the request was successful and a new resource was created?
Explanation: Status code 201 means 'Created', indicating the request succeeded and resulted in the creation of a resource. 400 represents a bad request due to client error. 202 means 'Accepted' but not necessarily completed. 401 means 'Unauthorized', related to authentication issues.
When should you use the HTTP DELETE method in a REST API example?
Explanation: The DELETE method is designed to remove or delete a specified resource from the server. Uploading a new file is commonly done with POST or PUT. Retrieving multiple records uses the GET method. Fetching website icons does not require DELETE and would use GET.
A client receives a 403 status code after requesting a webpage. What does this mean?
Explanation: A 403 status code indicates that the server understood the request but refuses to authorize it. 'Resource moved permanently' corresponds to 301. 'Request timed out' would be 408. 'Server is under maintenance' is generally represented by 503.
Which HTTP method should you use to submit form data that creates or updates a resource?
Explanation: POST is the standard method for submitting form data to create or update a resource on the server. FETCH and LOOK are not valid HTTP methods; FETCH is used in JavaScript APIs, not in HTTP. REMOVE is also incorrect; DELETE is the right method for deletions.
If a server sends back a 500 status code, what does it most likely mean?
Explanation: A 500 status code means an internal server error occurred, indicating something went wrong on the server side. 'Success' is shown by code 200. 'Unauthorized' uses code 401. 'Moved temporarily' refers to status code 302.
What does the HTTP PUT method generally do when applied to a resource at a specific URL?
Explanation: PUT is used to update an existing resource or create it if it does not already exist at the specified URL. DELETE is for removal, not for creation or updating. Retrieving resource headers is typically done with the HEAD method. Initiating a server reboot is outside the scope of HTTP methods.
Which HTTP status code indicates that a request requires user authentication?
Explanation: The 401 status code means 'Unauthorized' and implies the request needs valid user authentication. 301 means 'Moved Permanently', not related to authentication. 200 is 'OK', meaning successful operation. 418 is a playful code, 'I'm a teapot', and is not generally used.
In which situation is the HTTP HEAD method commonly used?
Explanation: The HEAD method retrieves headers for a resource, letting a client check metadata such as content length without downloading the body. Creating resources is for POST or PUT. Deleting uses DELETE. Reloading a server isn't done through HTTP methods.