Bird
0
0

Given this Python code using requests library:

medium📝 Predict Output Q13 of 15
Rest API - HTTP Methods
Given this Python code using requests library:
import requests
response = requests.delete('https://api.example.com/items/45')
print(response.status_code)

What will be printed if the item was successfully deleted?
A201
B404
C200
D500
Step-by-Step Solution
Solution:
  1. Step 1: Understand HTTP status codes for DELETE

    Successful DELETE usually returns 200 (OK) or 204 (No Content). 200 means success with response body.
  2. Step 2: Check options for success code

    Among options, 200 indicates success. 404 means not found, 500 server error, 201 created (not for DELETE).
  3. Final Answer:

    200 -> Option C
  4. Quick Check:

    DELETE success = 200 OK [OK]
Quick Trick: Successful DELETE usually returns 200 or 204 status code [OK]
Common Mistakes:
  • Confusing 201 (created) with success for DELETE
  • Assuming 404 means success
  • Ignoring status code meanings

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes