Bird
0
0

You wrote this alert rule:

medium📝 Troubleshoot Q14 of 15
Rest API - API Testing and Monitoring
You wrote this alert rule:
if response.status_code = 500:
    send_alert('Server error')

Why does this rule not work as expected?
AThe comparison operator should be '==' not '='
BThe status code 500 is not an error
Csend_alert function is missing parentheses
DThe API URL is missing
Step-by-Step Solution
Solution:
  1. Step 1: Identify the operator used

    The code uses '=' which is assignment, not comparison.
  2. Step 2: Correct operator for comparison

    To compare values, '==' must be used instead of '='.
  3. Final Answer:

    The comparison operator should be '==' not '=' -> Option A
  4. Quick Check:

    Use '==' for comparison [OK]
Quick Trick: Use '==' to compare values, '=' assigns [OK]
Common Mistakes:
MISTAKES
  • Using '=' instead of '==' in conditions
  • Thinking 500 is not an error
  • Ignoring syntax errors in conditions

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes