0
0
Testing Fundamentalstesting~20 mins

Defect density and detection rate in Testing Fundamentals - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Defect Density & Detection Rate Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
1:30remaining
Understanding Defect Density Calculation

Imagine a software module has 50 defects found during testing. The module size is 10,000 lines of code. What is the defect density?

A0.5 defects per line of code
B0.005 defects per line of code
C0.05 defects per line of code
D5 defects per line of code
Attempts:
2 left
💡 Hint

Defect density = Number of defects / Size of code.

🧠 Conceptual
intermediate
1:30remaining
Calculating Defect Detection Rate

A testing team found 80 defects in the first week and 40 defects in the second week. If the total defects found after two weeks is 120, what is the defect detection rate for the second week?

A40%
B50%
C66.7%
D33.3%
Attempts:
2 left
💡 Hint

Defect detection rate = (Defects found in period / Total defects found) * 100%

Predict Output
advanced
2:00remaining
Output of Defect Density Calculation Code

What is the output of this Python code?

Testing Fundamentals
def calculate_defect_density(defects, lines_of_code):
    return defects / lines_of_code

result = calculate_defect_density(25, 5000)
print(f"Defect Density: {result:.4f}")
ADefect Density: 0.0250
BDefect Density: 0.0500
CDefect Density: 0.0050
DDefect Density: 0.0005
Attempts:
2 left
💡 Hint

Divide defects by lines of code and format to 4 decimals.

assertion
advanced
1:30remaining
Assertion for Defect Detection Rate

Which assertion correctly verifies that the defect detection rate is 40% when 20 defects are found out of 50 total defects?

Testing Fundamentals
defect_found = 20
total_defects = 50
detection_rate = (defect_found / total_defects) * 100
Aassert detection_rate == 40
Bassert detection_rate == 0.4
Cassert detection_rate == 0.40
Dassert detection_rate == 4
Attempts:
2 left
💡 Hint

Remember detection_rate is a percentage, not a fraction.

🔧 Debug
expert
2:00remaining
Debugging Defect Density Calculation Error

What error will this code raise when calculating defect density?

defect_count = '30'
lines_of_code = 10000
defect_density = defect_count / lines_of_code
print(defect_density)
Testing Fundamentals
defect_count = '30'
lines_of_code = 10000
defect_density = defect_count / lines_of_code
print(defect_density)
ATypeError: unsupported operand type(s) for /: 'str' and 'int'
BZeroDivisionError: division by zero
CNameError: name 'defect_count' is not defined
DSyntaxError: invalid syntax
Attempts:
2 left
💡 Hint

Check the data types of variables used in division.