Bird
Raised Fist0

Which of the following is the correct way to handle errors for graceful degradation in a REST API response (in pseudocode)?

easy📝 Syntax Q12 of Q15
Rest API - Rate Limiting and Throttling
Which of the following is the correct way to handle errors for graceful degradation in a REST API response (in pseudocode)?
Aignore errors and return nothing
Breturn data; if error then stop
Ctry { return data } catch { return fallbackData }
Dthrow error without handling
Step-by-Step Solution
Solution:
  1. Step 1: Identify error handling syntax

    Graceful degradation uses try-catch to handle errors and provide fallback data.
  2. Step 2: Match options to this pattern

    try { return data } catch { return fallbackData } shows try-catch with fallback, others either stop or ignore errors.
  3. Final Answer:

    try { return data } catch { return fallbackData } -> Option C
  4. Quick Check:

    Use try-catch with fallback for graceful degradation [OK]
Quick Trick: Use try-catch to return fallback on error [OK]
Common Mistakes:
MISTAKES
  • Not catching errors properly
  • Stopping API on first error
  • Ignoring fallback responses

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes