Bird
0
0

Given this REST API response code snippet:

medium📝 Predict Output Q4 of 15
Rest API - Rate Limiting and Throttling
Given this REST API response code snippet:
if (serviceA.failed) {
  return { data: partialData, status: 206 };
} else {
  return { data: fullData, status: 200 };
}

What will be the HTTP status if serviceA fails?
A200
B500
C404
D206
Step-by-Step Solution
Solution:
  1. Step 1: Analyze the condition for serviceA failure

    If serviceA.failed is true, the code returns status 206 with partialData.
  2. Step 2: Identify the returned status code

    The returned status code in failure case is 206 Partial Content.
  3. Final Answer:

    206 -> Option D
  4. Quick Check:

    Failure triggers 206 partial content status [OK]
Quick Trick: Check condition branches to find returned status code [OK]
Common Mistakes:
  • Confusing 200 with 206 status codes
  • Assuming failure returns 500 error
  • Ignoring the conditional logic

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes