Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to classify defects by severity level.
Testing Fundamentals
def classify_severity(defect): if defect['impact'] == 'system down': return '[1]' else: return 'Low' severity = classify_severity({'impact': 'system down'})
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Choosing 'Minor' or 'Trivial' for system down impact.
Confusing severity with priority.
✗ Incorrect
If the defect causes system down, it is classified as Critical severity.
2fill in blank
mediumComplete the code to assign priority based on severity.
Testing Fundamentals
def assign_priority(severity): if severity == '[1]': return 'High' else: return 'Low' priority = assign_priority('Critical')
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Assigning 'Low' priority to critical defects.
Mixing up severity and priority terms.
✗ Incorrect
Critical severity defects get High priority for fixing.
3fill in blank
hardFix the error in the code to correctly classify defect priority.
Testing Fundamentals
def defect_priority(defect): if defect['severity'] == 'Critical': return '[1]' else: return 'Low' priority = defect_priority({'severity': 'Critical'})
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Returning 'Medium' or 'Low' for critical defects.
Using undefined priority levels.
✗ Incorrect
Critical severity defects should have High priority.
4fill in blank
hardFill both blanks to create a dictionary of defects filtered by severity and priority.
Testing Fundamentals
def filter_defects(defects): return {d['id']: d for d in defects if d['severity'] == '[1]' and d['priority'] == '[2]'} defects = [ {'id': 1, 'severity': 'Critical', 'priority': 'High'}, {'id': 2, 'severity': 'Minor', 'priority': 'Low'} ] filtered = filter_defects(defects)
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing severity and priority values.
Using incorrect string values in filter.
✗ Incorrect
The function filters defects with Critical severity and High priority.
5fill in blank
hardFill all three blanks to create a summary dictionary of defect counts by severity and priority.
Testing Fundamentals
def summarize_defects(defects): summary = {} for d in defects: key = (d['[1]'], d['[2]']) summary[key] = summary.get(key, 0) + [3] return summary defects = [ {'severity': 'Critical', 'priority': 'High'}, {'severity': 'Critical', 'priority': 'High'}, {'severity': 'Minor', 'priority': 'Low'} ] summary = summarize_defects(defects)
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong keys for grouping.
Incrementing count incorrectly.
✗ Incorrect
The function counts defects grouped by severity and priority, adding 1 for each defect.