CS FundamentalsModerateProduct-company MCQ pattern

A logged-in user with a valid token calls an admin-only API endpoint. Which status code should the server return?

  1. A. 404 Not Found
  2. B. 401 Unauthorized
  3. C. 403 Forbidden
  4. D. 400 Bad Request

Correct answer: C. 403 Forbidden

The user is authenticated but lacks permission, so 403. 401 means authentication is missing or invalid (no or bad credentials). Some APIs return 404 to hide the resource, but 403 is the standard answer.

More Software Engineering, Git and Cloud Basics questions

Exams that ask this topic