Bird
0
0

Find the error in this test approach selection code:

medium📝 Debug Q6 of 15
Testing Fundamentals - Testing Models and Approaches
Find the error in this test approach selection code:
def choose_approach(priority):
    if priority = 'high':
        return 'risk-based'
    else:
        return 'exploratory'
AUse '==' for comparison, not '='
BReturn statements are missing
CFunction name is invalid
DIndentation is incorrect
Step-by-Step Solution
Solution:
  1. Step 1: Identify the comparison operator used

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

    Use '==' to compare priority with 'high'.
  3. Final Answer:

    Use '==' for comparison, not '=' -> Option A
  4. Quick Check:

    Comparison needs '==' not '=' [OK]
Quick Trick: Use '==' to compare values in conditions [OK]
Common Mistakes:
  • Using '=' instead of '==' in if condition
  • Thinking return statements are missing
  • Assuming function name causes error

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Testing Fundamentals Quizzes