Web Programming Web APIs and REST 1 — Questions and Answers
Question 1: What does REST stand for in web development?
- Remote Execution State Transfer
- Representational State Transfer (Correct answer)
- Resource Endpoint State Technology
- Remote Execution Syntax Transfer
Correct answer: Representational State Transfer
REST stands for Representational State Transfer, an architectural style for distributed hypermedia systems using HTTP methods to manage resources.
Question 2: Which HTTP method is used to retrieve data from a server without modifying it?
- POST
- PUT
- GET (Correct answer)
- PATCH
Correct answer: GET
The GET method requests a representation of a specified resource and should only retrieve data, never modifying the resource.
Question 3: What HTTP status code indicates a successful request?
- 404
- 500
- 301
- 200 (Correct answer)
Correct answer: 200
HTTP status code 200 (OK) indicates that the request has succeeded and the server has returned the requested resource.
Question 4: What is the purpose of the HTTP POST method?
- Retrieve a resource
- Delete a resource
- Submit data to create a new resource (Correct answer)
- Update a partial resource
Correct answer: Submit data to create a new resource
The POST method submits data to the server to create a new resource, with the data included in the request body.
Question 5: Which HTTP header is used to specify the format of the request or response body?
- Accept-Language
- Authorization
- Content-Type (Correct answer)
- Cache-Control
Correct answer: Content-Type
The Content-Type header indicates the media type (e.g., application/json) of the request or response body being sent.
Question 6: What does CORS stand for in web development?
- Cross-Origin Resource Sharing (Correct answer)
- Client-Object Routing System
- Centralized Origin Request Schema
- Cross-Object Resource Syntax
Correct answer: Cross-Origin Resource Sharing
CORS (Cross-Origin Resource Sharing) is a browser security mechanism that controls how web pages can request resources from a different domain than the one that served the page.
What does REST stand for in web development?