๐ Scenario: You are part of a software development team that wants to track the quality of your software project. To do this, you will create a simple data structure to hold quality metrics, set a threshold for acceptable quality, analyze the metrics, and finalize the quality report.
๐ฏ Goal: Build a step-by-step quality metrics tracker that stores metric values, sets a quality threshold, identifies metrics below the threshold, and completes the quality report.
๐ What You'll Learn
Create a dictionary named quality_metrics with exact metric names and values
Create a variable named quality_threshold with a specific numeric value
Use a for loop with variables metric and value to find metrics below the threshold
Add a final summary dictionary named quality_report that includes the low quality metrics
๐ก Why This Matters
๐ Real World
Tracking software quality metrics helps teams identify weak areas and improve product reliability.
๐ผ Career
Quality measurement is essential for software testers, developers, and project managers to ensure high standards.
Progress0 / 4 steps
1
Create the quality metrics dictionary
Create a dictionary called quality_metrics with these exact entries: 'Code Coverage': 85, 'Bug Density': 3, 'Test Pass Rate': 92, 'Code Complexity': 7
Software Engineering
Hint
Use curly braces {} to create a dictionary with the exact keys and values.
2
Set the quality threshold
Create a variable called quality_threshold and set it to the value 80 to represent the minimum acceptable metric value.
Software Engineering
Hint
Just assign the number 80 to the variable quality_threshold.
3
Identify metrics below the threshold
Use a for loop with variables metric and value to iterate over quality_metrics.items(). Inside the loop, create a list called low_quality_metrics before the loop and add each metric to this list if its value is less than quality_threshold.
Software Engineering
Hint
Start with an empty list, then check each metric's value and add the metric name if it is below the threshold.
4
Create the final quality report
Create a dictionary called quality_report with a key 'Low Quality Metrics' and set its value to the list low_quality_metrics.
Software Engineering
Hint
Use curly braces to create a dictionary with the specified key and assign the list as its value.
Practice
(1/5)
1. What is the main purpose of quality metrics in software engineering?
easy
A. To manage project budgets
B. To write code faster
C. To measure and improve software quality
D. To design user interfaces
Solution
Step 1: Understand what quality metrics measure
Quality metrics provide numbers that show how good or bad software quality is.
Step 2: Identify the main goal of using these metrics
They help find problems and track improvements in software quality.
Final Answer:
To measure and improve software quality -> Option C
Quick Check:
Quality metrics = measure and improve quality [OK]
Hint: Quality metrics measure software quality, not speed or cost [OK]
Common Mistakes:
Confusing quality metrics with project management tools
Thinking metrics speed up coding directly
Mixing quality metrics with design tasks
2. Which of the following is a correct example of a software quality metric?
easy
A. user interface color
B. number of developers
C. programming language used
D. defect density
Solution
Step 1: Identify what counts as a quality metric
Quality metrics are measurable numbers related to software quality, like defects per size.
Step 2: Check each option
Defect density counts defects per size, so it is a quality metric. Others are not numeric quality measures.
Final Answer:
defect density -> Option D
Quick Check:
Defect density = quality metric [OK]
Hint: Look for measurable numbers related to software quality [OK]
Common Mistakes:
Choosing non-numeric attributes like color or language
Confusing team size with quality metric
Ignoring the need for measurement
3. Given a software module with 50 defects found in 10,000 lines of code, what is the defect density?
medium
A. 0.005 defects per line
B. 0.5 defects per line
C. 5 defects per line
D. 0.05 defects per line
Solution
Step 1: Understand defect density formula
Defect density = Number of defects / Lines of code.
Step 2: Calculate defect density
50 defects / 10,000 lines = 0.005 defects per line. This equals 0.005, which is 0.005 defects per line.
Final Answer:
0.005 defects per line -> Option A
Quick Check:
50 รท 10,000 = 0.005 [OK]
Hint: Divide defects by lines of code for defect density [OK]
Common Mistakes:
Multiplying instead of dividing
Mixing decimal places
Confusing defect density with total defects
4. A team tracks test coverage but reports it as 150%. What is the likely error?
medium
A. Test coverage calculation is incorrect or data is wrong
B. Test coverage can exceed 100% if tests overlap
C. Test coverage is not a valid quality metric
D. Test coverage measures defects, not code tested
Solution
Step 1: Understand test coverage limits
Test coverage measures percentage of code tested, max 100%.
Step 2: Analyze reported value
150% is impossible, so calculation or data must be wrong.
Final Answer:
Test coverage calculation is incorrect or data is wrong -> Option A
Quick Check:
Test coverage โค 100% [OK]
Hint: Test coverage cannot be more than 100% [OK]
Common Mistakes:
Believing coverage can exceed 100%
Confusing coverage with defect count
Ignoring data errors
5. A project has these metrics: defect density = 0.02, average repair time = 5 hours, test coverage = 80%. Which action best improves overall software quality?
hard
A. Ignore defect density and focus on coding speed
B. Increase test coverage to find more defects early
C. Reduce repair time without changing testing
D. Decrease test coverage to save time
Solution
Step 1: Understand the impact of each metric
Higher test coverage helps find defects early, reducing defect density over time.
Step 2: Evaluate options for improving quality
Increasing test coverage is the best way to improve quality by catching defects early.
Final Answer:
Increase test coverage to find more defects early -> Option B
Quick Check:
More test coverage = better defect detection [OK]
Hint: More test coverage usually improves quality by catching defects early [OK]
Common Mistakes:
Focusing only on repair time
Ignoring defect density
Reducing test coverage to save time
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.