Bird
Raised Fist0

Given the following Python code for regression testing outputs, what will be the printed result?

medium📝 Predict Output Q13 of Q15
Testing Fundamentals - Testing Types and Levels

Given the following Python code for regression testing outputs, what will be the printed result?

old_results = [10, 20, 30]
new_results = [10, 20, 25]

if old_results == new_results:
    print("Test Passed")
else:
    print("Test Failed")
ATest Passed
BSyntaxError
CTest Failed
DNo output
Step-by-Step Solution
Solution:
  1. Step 1: Compare the two lists element-wise

    old_results has [10, 20, 30], new_results has [10, 20, 25]. The last elements differ (30 vs 25).
  2. Step 2: Evaluate the if condition

    Since the lists are not equal, the else block runs, printing "Test Failed".
  3. Final Answer:

    Test Failed -> Option C
  4. Quick Check:

    Lists differ, so output = Test Failed [OK]
Quick Trick: Lists must match exactly for test to pass [OK]
Common Mistakes:
MISTAKES
  • Assuming partial match passes test
  • Confusing list equality with set equality
  • Expecting syntax errors from correct code

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Testing Fundamentals Quizzes