Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.
Shade in the A or B circle for each question.
Draw a line connecting each item on the left to its match on the right.
| Left column | Right column | |
|---|---|---|
| 1requests.post(url, json=order) | AThe front-end sends a request carrying JSON data to the back-end API | |
| 2response.json() | Bhttps://shop.example.com/api/orders | |
| 3Encrypting the exchange so an interceptor cannot read the request or response | CThe back-end must also validate, because requests can bypass the front-end or be altered in transit. | |
| 4The back-end validates incoming data and refuses a bad request with an error response | Dif quantity <= 0: return 400 | |
| 5The back-end reads the form and decides what the front-end page looks like | EThe back-end processes the request and returns data in a response. The front-end is responsible for displaying it to the user. | |
| 6Validate in the front-end only, so the back-end can trust every request | FReads the back-end's JSON response so the front-end can display it |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
request and response — The front-end sends a request (often to a REST API) with JSON or XML data; the back-end processes it and returns a response that the front-end displays.response = requests.post(url, json=data)url = "https://shop.example.com/api/items"response = requests.get(url)
items = response.json()if response.status_code == 200:
print("Request worked")if age < 0 or age > 120:
return "Invalid age", 400