Bird
0
0

Identify the error in this regression testing code snippet:

medium📝 Debug Q14 of 15
Testing Fundamentals - Testing Types and Levels

Identify the error in this regression testing code snippet:

def regression_test(old, new):
    if old = new:
        return True
    else:
        return False
AMissing return statement
BUsing assignment operator '=' instead of comparison '==' in if condition
CFunction should print results, not return
DIncorrect function name
Step-by-Step Solution
Solution:
  1. Step 1: Check the if condition syntax

    The condition uses '=' which is assignment, not comparison. Python requires '==' for comparison.
  2. Step 2: Identify correct syntax for comparison

    Replacing '=' with '==' fixes the syntax error and allows proper comparison.
  3. Final Answer:

    Using assignment operator '=' instead of comparison '==' in if condition -> Option B
  4. Quick Check:

    Use '==' to compare, not '=' [OK]
Quick Trick: Use '==' for comparison, '=' is assignment [OK]
Common Mistakes:
  • Confusing '=' and '==' in conditions
  • Thinking return is missing
  • Believing function name matters for syntax

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Testing Fundamentals Quizzes