📝 Unit 5: Software Engineering & Society — Unit Test
Assessment OF Learning — Summative
✅ Graded — Counts Toward 70% Term Mark
⏱️ Duration: 75 minutes | Total: /60 marks
Show all work. Code answers must be syntactically valid Python 3. No internet, no AI tools.
K/U
/15
Thinking
/15
Comm.
/15
Applic.
/15
Part A: Knowledge & Understanding [15 marks]
1. [2 marks]
List the six standard phases of the Software Development Life Cycle (SDLC) in order.
2. [3 marks]
Define each term in your own words (one sentence each):
Unit testing
Regression testing
Black-box vs. white-box testing
3. [2 marks]
A teammate runs git pull. Explain what just happened, and what they should do next if there is a merge conflict.
4. [2 marks]
Identify two historical contributors to computer science (one Canadian if possible) and briefly state their contribution.
5. [3 marks]
In one or two sentences each, define:
Algorithmic bias
Open-source software
The principle of least privilege
6. [3 marks]
Identify three Ontario universities that offer a Bachelor of Computer Science (or equivalent), and three Ontario colleges that offer related diploma programs.
Part B: Thinking & Investigation [15 marks]
7. [5 marks]
Find & fix the bugs / write tests. Below is a buggy function that should return True if a year is a leap year (Gregorian rules: divisible by 4, but not by 100, unless also by 400). It has two bugs.
def is_leap(year):
if year % 4 == 0:
return True
elif year % 100 == 0:
return False
else:
return False
(a) Provide the corrected function. (b) Write four test cases (year, expected) that, together, would have caught the bugs.
8. [5 marks]
Algorithmic-bias case study. A high-school admissions algorithm uses past acceptance data and ends up favouring applicants from certain postal codes. (a) Identify two plausible mechanisms by which this bias could have entered the system. (b) Suggest two concrete mitigations a development team could implement.
9. [5 marks]
Estimate the carbon impact of a typical home Wi-Fi router that draws 8 W continuously over one year. Assume Ontario's grid has roughly 30 g of CO₂ per kWh delivered. Provide:
kWh per year (round to 1 dp)
kg of CO₂ per year
One software-related way someone could reduce this per year (with a brief justification)
Part C: Communication [15 marks]
10. [5 marks]
A peer's program works but is one giant 200-line main() with no comments. Write a 4-5 point review explaining specific maintainability issues and how to fix each.
11. [5 marks]
Short essay (150-200 words). "Should facial-recognition technology be regulated by the Canadian government? Discuss." Take a position and provide at least two specific reasons. Reference at least one specific risk and one specific benefit.
12. [5 marks]
Write a clear, professional commit message (50-character title + body) for a change that "fixes a crash when the user enters a non-numeric input to the wage calculator". Use Git conventions: imperative mood, why > what, blank line before body.
Part D: Application [15 marks]
13. [5 marks]
Write a function safe_divide(a, b) that returns a/b. If b == 0, the function should raise a ValueError with a clear message. Then write 4 unit tests using unittest: normal case, zero numerator, zero denominator (should raise), and negative inputs.
14. [5 marks]
A teammate's function below has a logic bug AND a poor design choice. (a) Identify the bug and explain its symptom. (b) Identify the design issue. (c) Refactor the function to fix both issues, with a brief docstring.
def calculate_total(items):
total = 0
for item in items:
if item["price"] > 0:
total += item["price"]
print("Your total is " + str(total))
15. [5 marks]
Capstone planning. Write a one-page proposal for a small, ethical software project you could build as a final capstone. Include: