Bird
Raised Fist0
Testing Fundamentalstesting~20 mins

Risk-based testing in Testing Fundamentals - Practice Problems & Coding Challenges

Choose your learning style10 modes available
Challenge - 5 Problems
🎖️
Risk-Based Testing Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Understanding Risk Prioritization in Testing

In risk-based testing, which factor is most important when deciding which features to test first?

AThe likelihood of failure and impact on users
BThe complexity of the code implementation
CThe number of developers who worked on the feature
DThe order in which features were developed
Attempts:
2 left
💡 Hint

Think about what risk means in testing: what could go wrong and how bad it would be.

❓ Predict Output
intermediate
2:00remaining
Output of Risk Score Calculation

What is the output of this Python code that calculates risk scores for features?

Testing Fundamentals
features = {'Login': {'likelihood': 0.9, 'impact': 0.8}, 'Search': {'likelihood': 0.4, 'impact': 0.5}}
risk_scores = {f: data['likelihood'] * data['impact'] for f, data in features.items()}
print(risk_scores)
A{'Login': 1.7, 'Search': 0.9}
B{'Login': 0.72, 'Search': 0.2}
C{'Login': 0.9, 'Search': 0.4}
D{'Login': 0.8, 'Search': 0.5}
Attempts:
2 left
💡 Hint

Multiply likelihood by impact for each feature.

❓ assertion
advanced
2:00remaining
Validating Risk Priority Order

Given a list of features with risk scores, which assertion correctly checks that the features are sorted from highest to lowest risk?

Testing Fundamentals
features = [('Login', 0.72), ('Search', 0.2), ('Profile', 0.5)]
sorted_features = sorted(features, key=lambda x: x[1], reverse=True)
Aassert sorted_features[0][1] < sorted_features[-1][1]
Bassert sorted_features == [('Search', 0.2), ('Profile', 0.5), ('Login', 0.72)]
Cassert sorted_features[0][0] == 'Search'
Dassert sorted_features == [('Login', 0.72), ('Profile', 0.5), ('Search', 0.2)]
Attempts:
2 left
💡 Hint

Check that the list is sorted descending by risk score.

🔧 Debug
advanced
2:00remaining
Debugging Risk Score Calculation Error

Why does this code raise a TypeError when calculating risk scores?

Testing Fundamentals
features = {'Login': {'likelihood': '0.9', 'impact': 0.8}}
risk_scores = {f: data['likelihood'] * data['impact'] for f, data in features.items()}
print(risk_scores)
ABecause the print statement is missing parentheses
BBecause the dictionary keys are strings instead of integers
CBecause 'likelihood' is a string and cannot be multiplied by a float
DBecause the dictionary comprehension syntax is incorrect
Attempts:
2 left
💡 Hint

Check the data types of values used in multiplication.

❓ framework
expert
3:00remaining
Designing a Risk-Based Test Suite

You have 5 features with risk scores: A(0.9), B(0.7), C(0.4), D(0.3), E(0.1). You can only write tests for 3 features due to time limits. Which selection best follows risk-based testing principles?

ATest features A, B, and C because they have the highest risk scores
BTest features C, D, and E because they are less complex
CTest features B, D, and E because they were developed last
DTest features A, C, and E to cover a range of risk scores
Attempts:
2 left
💡 Hint

Focus on features with the highest risk scores first.

Practice

(1/5)
1. What is the main goal of risk-based testing in software testing?
easy
A. To avoid testing parts that are easy to test
B. To test all parts of the software equally
C. To focus testing on the most important and risky parts first
D. To test only the user interface

Solution

  1. Step 1: Understand the purpose of risk-based testing

    Risk-based testing aims to prioritize testing efforts on areas with the highest risk to save time and improve effectiveness.
  2. Step 2: Compare options with this purpose

    To focus testing on the most important and risky parts first matches this goal by focusing on important and risky parts first, while others do not.
  3. Final Answer:

    To focus testing on the most important and risky parts first -> Option C
  4. Quick Check:

    Risk-based testing = Focus on risky parts first [OK]
Hint: Risk-based testing targets risky parts first [OK]
Common Mistakes:
  • Thinking all parts are tested equally
  • Believing risk-based testing ignores important parts
  • Confusing risk-based testing with UI-only testing
2. Which of the following is the correct way to prioritize tests in risk-based testing?
easy
A. By combining the impact and likelihood of potential problems
B. By testing the easiest features first
C. By testing features in alphabetical order
D. By testing only the newest features

Solution

  1. Step 1: Recall how risk is calculated in testing

    Risk is usually calculated by combining the impact of a problem and how likely it is to happen.
  2. Step 2: Match this with the options

    By combining the impact and likelihood of potential problems correctly states this combination, while others focus on unrelated criteria.
  3. Final Answer:

    By combining the impact and likelihood of potential problems -> Option A
  4. Quick Check:

    Risk = Impact x Likelihood [OK]
Hint: Prioritize tests by impact and likelihood [OK]
Common Mistakes:
  • Prioritizing by ease or alphabetical order
  • Ignoring likelihood of problems
  • Testing only new features without risk analysis
3. Consider this simplified risk table for features:

Feature A: Impact=5, Likelihood=4
Feature B: Impact=3, Likelihood=6
Feature C: Impact=4, Likelihood=2


Which feature should be tested first based on risk?
medium
A. Feature B
B. Feature A
C. Feature C
D. All features equally

Solution

  1. Step 1: Calculate risk for each feature

    Risk = Impact x Likelihood.
    Feature A: 5 x 4 = 20
    Feature B: 3 x 6 = 18
    Feature C: 4 x 2 = 8
  2. Step 2: Identify highest risk

    Feature A has the highest risk score (20), so it should be tested first.
  3. Final Answer:

    Feature A -> Option B
  4. Quick Check:

    Highest risk = Feature A (20) [OK]
Hint: Multiply impact and likelihood to find highest risk [OK]
Common Mistakes:
  • Choosing feature with highest likelihood only
  • Ignoring impact in calculation
  • Testing all features equally without prioritization
4. 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?
medium
A. Risk should be calculated by multiplying impact and likelihood, not adding
B. The loop should use feature.name instead of feature["name"]
C. The risk threshold should be less than 8, not greater
D. The features list should be sorted before looping

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]
Hint: 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
5. You have three features with these risk scores:

Feature X: 12
Feature Y: 20
Feature Z: 20


Due to limited time, you can only test two features. Which is the best risk-based testing approach?
hard
A. Test Feature X and Feature Y because X has the lowest risk
B. Test all three features equally
C. Test Feature X and Feature Z because Z is newer
D. Test Feature Y and Feature Z because they have the highest risk

Solution

  1. Step 1: Identify features with highest risk

    Feature Y and Feature Z both have the highest risk score of 20.
  2. Step 2: Prioritize testing based on risk and time limit

    Since only two can be tested, choose the two with highest risk to maximize risk coverage.
  3. Final Answer:

    Test Feature Y and Feature Z because they have the highest risk -> Option D
  4. Quick Check:

    Test highest risk features first [OK]
Hint: Pick features with highest risk scores first [OK]
Common Mistakes:
  • Testing lower risk features first
  • Ignoring risk scores when time is limited
  • Trying to test all features equally despite limits
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard