Bias and over-reliance when using AI to program

Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.

Bias and over-reliance when using AI to program

Name:
Date:
Class:

Quick Questions

Shade in the A or B circle for each question.

1. A student pastes AI-generated code into their project and submits it without reading it. Is this good practice?
A No. The code could be biased, outdated or insecure, so it must be reviewed first.
B Yes. AI code is always correct, so checking it is a waste of time.
2. An AI writes a loan approval function that gives lower scores to people from certain postcodes. What is the problem?
A This is fine because a computer cannot be unfair.
B The code shows bias and could treat groups of people unfairly.
3. Which is a sign that AI-generated code may be insecure?
A It uses clear variable names and comments.
B It builds an SQL query by joining user input straight into the string.
4. An AI suggests a Python method that was removed in newer versions. What is the risk?
A The code may be outdated and fail or be unsafe in the current version.
B There is no risk because AI always uses the latest version.
5. A student lets AI write every program and never practises writing code. What is the likely result?
A De-skilling: their own programming skills and problem-solving get weaker.
B Their skills improve faster because they write less code.

Match the Pairs

Draw a line connecting each item on the left to its match on the right.

Left columnRight column
1query = "SELECT * FROM users WHERE name = '" + name + "'" ABiased or unfair output: the rule rejects people by where they live, which could unfairly disadvantage a group
2if applicant_postcode in blocked_postcodes: reject() BLetting AI do all the coding causes de-skilling. You lose your own problem-solving skills and judgement. Use AI as a helper and write and understand code yourself.
3Outdated code: AI may suggest old methods that are no longer recommended, so check the documentation Cassert calculate_total([2, 3]) == 5 # I tested it
4Keeping a human in control: read the code, test it and be able to explain every line before you use it Dimport md5 # old, weak hashing library
5# AI wrote it, so I will paste it in without reading EInsecure AI-generated code: joining user input into an SQL string allows SQL injection, so it must be reviewed and fixed
6# Let AI write all my functions so I never need to learn how FPasting AI code without reviewing it means bias, outdated methods or security flaws go unnoticed. Review and test it first.

Definitions

AI over-reliance

Fill in the Blanks

Complete each line of code by filling in the missing parts.

1.
# AI hardcoded it; ask the user instead password = _____("Enter password: ")
2.
if reviewed ___ tests_passed: deploy()
3.
# Equal skills, so scores must match assert score(a) __ score(b)
4.
# I wrote this myself, no AI ___ average(marks): return sum(marks) / len(marks)
5.
answer = input("Accept AI code? y/n: ") __ answer == "y": print("Merged after review")

Spot the Error

Shade in the letter of the line that contains an error.

Question 1
A def pick(skills, years, age):
B score = skills * 2
C score -= age // 10
D return score >= 10
Question 2
A import md5
B pw = input('Password: ')
C data = pw.encode()
D h = hashlib.sha256(data)
Question 3
A code = ask_ai('sort list')
B review(code)
C if code:
D deploy(code)
Question 4
A attempts = 3
B while attempts < 3:
C try_myself(task)
D attempts += 1
E ask_ai_hint(task)
Question 5
A def rank(applicant):
B return applicant.age < 30
C best = max(pool, key=rank)

Answer Key

Bias and over-reliance when using AI to program
Section A: Quick Questions
Q1
A — No. The code could be biased, outdated or insecure, so it must be reviewed first.
Q2
B — The code shows bias and could treat groups of people unfairly.
Q3
B — It builds an SQL query by joining user input straight into the string.
Q4
A — The code may be outdated and fail or be unsafe in the current version.
Q5
A — De-skilling: their own programming skills and problem-solving get weaker.
Section B: Match the Pairs
Q1
query = "SELECT * FROM users WHERE name = '" + name + "'" → Insecure AI-generated code: joining user input into an SQL string allows SQL injection, so it must be reviewed and fixed
Q2
if applicant_postcode in blocked_postcodes: reject() → Biased or unfair output: the rule rejects people by where they live, which could unfairly disadvantage a group
Q3
Outdated code: AI may suggest old methods that are no longer recommended, so check the documentation → import md5 # old, weak hashing library
Q4
Keeping a human in control: read the code, test it and be able to explain every line before you use it → assert calculate_total([2, 3]) == 5 # I tested it
Q5
# AI wrote it, so I will paste it in without reading → Pasting AI code without reviewing it means bias, outdated methods or security flaws go unnoticed. Review and test it first.
Q6
# Let AI write all my functions so I never need to learn how → Letting AI do all the coding causes de-skilling. You lose your own problem-solving skills and judgement. Use AI as a helper and write and understand code yourself.
Section C: Definitions
Q1
AI over-reliance — Trusting AI-generated code without checking it. The code may be biased, outdated or insecure, and you lose your own skills and judgement. Always review it and stay in control.
Section D: Fill in the Blanks
Q1
# AI hardcoded it; ask the user instead password = input("Enter password: ")
Q2
if reviewed and tests_passed: deploy()
Q3
# Equal skills, so scores must match assert score(a) == score(b)
Q4
# I wrote this myself, no AI def average(marks): return sum(marks) / len(marks)
Q5
answer = input("Accept AI code? y/n: ") if answer == "y": print("Merged after review")
Section E: Spot the Error
Q1
C — This AI-style scoring code penalises older applicants, which is biased and unfair. A fair score should only use relevant factors, so the line should be 'score += years'.
Q2
A — The old md5 module is outdated and insecure, and AI tools can still suggest it. It should be 'import hashlib' so the later hashlib.sha256() call works.
Q3
C — Any non-empty AI code would pass this check, so the human is no longer in control. The condition should be 'if tests_pass(code):' so the code only deploys after it passes tests.
Q4
A — Starting attempts at 3 means the loop never runs, so the student never tries the task and goes straight to the AI. This is de-skilling. It should be 'attempts = 0'.
Q5
B — Ranking by age builds unfair bias into the program. The rank should be based on relevant data, so the line should be 'return applicant.skills'.