Bird
0
0

The following pseudo-code is intended to perform a smoke test but has an error:

medium📝 Debug Q6 of 15
Testing Fundamentals - Testing Types and Levels
The following pseudo-code is intended to perform a smoke test but has an error:
def smoke_test(build):
    if build['feature'] = 'ready':
        return 'Pass'
    else:
        return 'Fail'

What is the error and how to fix it?
ARemove the else block entirely
BChange 'return' to 'print' statements
CUse '==' for comparison instead of '=' assignment
DAdd a semicolon at the end of the if line
Step-by-Step Solution
Solution:
  1. Step 1: Identify syntax error in condition

    The code uses '=' which is assignment, not comparison, causing a syntax error.
  2. Step 2: Correct the operator

    Replace '=' with '==' to compare values properly.
  3. Final Answer:

    Use '==' for comparison instead of '=' assignment -> Option C
  4. Quick Check:

    Comparison needs '==' not '=' [OK]
Quick Trick: Use '==' to compare, '=' assigns [OK]
Common Mistakes:
  • Using '=' instead of '==' in conditions
  • Thinking semicolons are needed in Python
  • Removing else block unnecessarily

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Testing Fundamentals Quizzes