Bird
Raised Fist0

Consider this code snippet representing a test strategy selection:

medium📝 Predict Output Q13 of Q15
Testing Fundamentals - Testing Models and Approaches
Consider this code snippet representing a test strategy selection:
approach = 'risk-based'
if approach == 'risk-based':
    tests = ['critical features', 'security']
else:
    tests = ['all features']
print(tests)

What will be the output?
AError: approach not defined
B['all features']
C[]
D['critical features', 'security']
Step-by-Step Solution
Solution:
  1. Step 1: Check the value of 'approach'

    The variable 'approach' is set to 'risk-based'.
  2. Step 2: Follow the if condition logic

    Since approach equals 'risk-based', the code assigns tests to ['critical features', 'security'].
  3. Final Answer:

    ['critical features', 'security'] -> Option D
  4. Quick Check:

    Approach 'risk-based' selects critical tests = A [OK]
Quick Trick: Match variable value to if condition [OK]
Common Mistakes:
MISTAKES
  • Confusing else branch output
  • Assuming empty list output
  • Thinking variable is undefined

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Testing Fundamentals Quizzes