Bird
0
0

Given the code snippet:

medium📝 Predict Output Q4 of 15
Testing Fundamentals - Testing Models and Approaches
Given the code snippet:
def select_approach(risk_level):
    if risk_level > 7:
        return 'risk-based'
    else:
        return 'exploratory'

print(select_approach(8))

What will be the output?
Arisk-based
Bexploratory
CNone
DError
Step-by-Step Solution
Solution:
  1. Step 1: Analyze the function input and condition

    The input risk_level is 8, which is greater than 7.
  2. Step 2: Determine which return statement executes

    Since 8 > 7, the function returns 'risk-based'.
  3. Final Answer:

    risk-based -> Option A
  4. Quick Check:

    Input 8 > 7 returns risk-based [OK]
Quick Trick: Check condition carefully to find returned string [OK]
Common Mistakes:
  • Choosing exploratory for input 8
  • Assuming function returns None
  • Expecting syntax error

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Testing Fundamentals Quizzes