Bird
0
0

A tester wrote this pseudocode to select features to test based on risk:

medium📝 Debug Q14 of 15
Testing Fundamentals - Testing Models and Approaches
A tester wrote this pseudocode to select features to test based on risk:

features = [{"name": "A", "impact": 5, "likelihood": 4},
            {"name": "B", "impact": 3, "likelihood": 6}]

for feature in features:
    risk = feature["impact"] + feature["likelihood"]
    if risk > 8:
        print(feature["name"])

What is wrong with this code for risk-based testing?
ARisk should be calculated by multiplying impact and likelihood, not adding
BThe loop should use feature.name instead of feature["name"]
CThe risk threshold should be less than 8, not greater
DThe features list should be sorted before looping
Step-by-Step Solution
Solution:
  1. Step 1: Review risk calculation method

    Risk-based testing calculates risk by multiplying impact and likelihood, not adding them.
  2. Step 2: Identify error in code

    The code adds impact and likelihood, which is incorrect for risk calculation.
  3. Final Answer:

    Risk should be calculated by multiplying impact and likelihood, not adding -> Option A
  4. Quick Check:

    Risk = Impact x Likelihood, not sum [OK]
Quick Trick: Risk = impact x likelihood, not sum [OK]
Common Mistakes:
  • Adding instead of multiplying impact and likelihood
  • Confusing dictionary access syntax
  • Assuming sorting is required before risk check

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Testing Fundamentals Quizzes