Bird
0
0

In a REST API, what is the expected response when a server throws an unhandled exception during processing?

medium📝 Predict Output Q5 of 15
Rest API - HTTP Status Codes
In a REST API, what is the expected response when a server throws an unhandled exception during processing?
AThe server responds with status 500 Internal Server Error.
BThe server closes the connection without response.
CThe server responds with status 403 Forbidden.
DThe server responds with status 200 and an error message.
Step-by-Step Solution
Solution:
  1. Step 1: Understand unhandled exceptions

    When the server code throws an exception not caught, it usually results in a 500 error.
  2. Step 2: Match to HTTP status

    500 Internal Server Error is the standard response for server failures.
  3. Final Answer:

    The server responds with status 500 Internal Server Error. -> Option A
  4. Quick Check:

    Unhandled exception = 500 response [OK]
Quick Trick: Unhandled server errors return 500 status code [OK]
Common Mistakes:
  • Thinking server returns 200 on errors
  • Confusing 403 Forbidden with server errors
  • Assuming no response is sent

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes