Integrity

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

Integrity

Name:
Date:
Class:

Quick Questions

Shade in the A or B circle for each question.

1. Which statement best describes integrity in cyber security?
A Data is hidden so that only authorised people can read it
B Data stays accurate and unaltered unless an authorised person changes it
2. A student breaks into the school system and changes their own mark from 52 to 92. What has been broken?
A Integrity, because the data was altered without permission
B Availability, because the marks can no longer be opened
3. Which of these is an example of tampering?
A An attacker edits the amount in a bank transfer before it is processed
B A teacher updates a student's address after the student asks
4. True or false: If an authorised person updates a record, integrity has been broken.
A False: authorised changes do not break integrity
B True: any change to data breaks integrity
5. Which result would show that integrity has been lost?
A A stock count of 40 can be seen only by managers
B A stock count of 40 has been secretly changed to 400

Match the Pairs

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

Left columnRight column
1integrity AAltering data without permission, which breaks integrity
2tampering BUPDATE results SET mark = 100 WHERE studentId = 1;
3A student secretly changes their own mark in the school database, breaking integrity CIntegrity allows changes made by an authorised person, so a correction by an admin does not break it.
4Integrity is kept when only an authorised person can change data Dif user.role == "teacher": update_mark()
5A hacker edits a bank balance from $500 to $5000. The data is still available, so integrity is intact. EAltering the balance without permission is tampering, which breaks integrity even though the data is still available and readable.
6An admin corrects a typo in a customer's address. This breaks integrity because the data was changed. FData stays accurate, complete and unaltered unless an authorised person changes it

Definitions

integrity

Fill in the Blanks

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

1.
if original __ received: print("Tampering detected")
2.
__ saved != current: print("Integrity lost")
3.
allowed = False if _______: mark = 90
4.
staff = ["teacher", "admin"] if user __ staff: mark = 95
5.
___ changed(old, new): return old != new print(changed("A", "B"))

Spot the Error

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

Question 1
A msg = 'Pay Sam $50'
B saved = len(msg)
C got = 'Pay Sam $500'
D print(hash(got) == saved)
Question 2
A saved = hash(file)
B if hash(file) == saved:
C print('Data was changed')
D else:
E print('File is intact')
Question 3
A role = 'student'
B if role != 'teacher':
C grades[0] = 95
D else:
E print('Edit denied')
Question 4
A nums = [4, 8, 15]
B total = sum(nums)
C nums[1] = 80
D if len(nums) != total:
E print('Data changed')
Question 5
A report = download()
B published = '9f2c1a'
C current = hash(report)
D ok = current = published
E print('Intact:', ok)

Answer Key

Integrity
Section A: Quick Questions
Q1
B — Data stays accurate and unaltered unless an authorised person changes it
Q2
A — Integrity, because the data was altered without permission
Q3
A — An attacker edits the amount in a bank transfer before it is processed
Q4
A — False: authorised changes do not break integrity
Q5
B — A stock count of 40 has been secretly changed to 400
Section B: Match the Pairs
Q1
integrity → Data stays accurate, complete and unaltered unless an authorised person changes it
Q2
tampering → Altering data without permission, which breaks integrity
Q3
A student secretly changes their own mark in the school database, breaking integrity → UPDATE results SET mark = 100 WHERE studentId = 1;
Q4
Integrity is kept when only an authorised person can change data → if user.role == "teacher": update_mark()
Q5
A hacker edits a bank balance from $500 to $5000. The data is still available, so integrity is intact. → Altering the balance without permission is tampering, which breaks integrity even though the data is still available and readable.
Q6
An admin corrects a typo in a customer's address. This breaks integrity because the data was changed. → Integrity allows changes made by an authorised person, so a correction by an admin does not break it.
Section C: Definitions
Q1
integrity — Data stays accurate, complete and unaltered unless an authorised person changes it. Tampering breaks integrity by altering data without permission.
Section D: Fill in the Blanks
Q1
if original != received: print("Tampering detected")
Q2
if saved != current: print("Integrity lost")
Q3
allowed = False if allowed: mark = 90
Q4
staff = ["teacher", "admin"] if user in staff: mark = 95
Q5
def changed(old, new): return old != new print(changed("A", "B"))
Section E: Spot the Error
Q1
B — To detect tampering, store the hash of the original message. The length is not a reliable fingerprint because altered data can keep the same length. It should be saved = hash(msg).
Q2
B — The condition is reversed. Matching hashes mean the data is unaltered, so a tampering warning must run when the hashes are different: if hash(file) != saved:.
Q3
B — Integrity means only authorised people may change data. With != every role except the teacher can edit the grades. It should be if role == 'teacher':.
Q4
D — The check must compare the new sum with the saved sum. The list length stays at 3 even after tampering, so the change would be missed. It should be if sum(nums) != total:.
Q5
D — A single = assigns a value instead of comparing, so no integrity check happens. It should use the comparison operator: ok = current == published.