Bird
0
0

Which of the following is the correct way to respond with a 500 Internal Server Error in a REST API using HTTP status codes?

easy📝 Syntax Q12 of 15
Rest API - HTTP Status Codes
Which of the following is the correct way to respond with a 500 Internal Server Error in a REST API using HTTP status codes?
AReturn status code 404 with an error message.
BReturn status code 500 with an error message.
CReturn status code 200 with an error message.
DReturn status code 401 with an error message.
Step-by-Step Solution
Solution:
  1. Step 1: Recall HTTP status code meanings

    500 is the standard code for Internal Server Error indicating server failure.
  2. Step 2: Match status code to error type

    To indicate a server error, the response must use status code 500 along with an error message.
  3. Final Answer:

    Return status code 500 with an error message. -> Option B
  4. Quick Check:

    Use 500 status code for internal server errors [OK]
Quick Trick: Use 500 status code for server errors, not 404 or 401 [OK]
Common Mistakes:
  • Using 404 or 401 instead of 500 for server errors
  • Returning 200 OK with error message
  • Confusing client error codes with server error codes

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes