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 data security?
A Data can be viewed only by people who are allowed to see it
B Data stays accurate and unaltered unless an authorised person changes it
2. A student accidentally deletes a row from a shared spreadsheet. Which security property is affected?
A Integrity
B Confidentiality
3. An attacker edits the marks in a school database to give themselves higher grades. What type of integrity problem is this?
A Accidental change
B Deliberate tampering
4. Which change keeps data integrity intact?
A A teacher with edit permission corrects a student's mark and the change is logged
B A student with read-only access edits their own mark
5. Which is an example of an accidental threat to integrity?
A Typing 750 instead of 75 into a form
B Malware that rewrites records in a database

Match the Pairs

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

Left columnRight column
1Integrity ASomeone intentionally changes data without permission, such as editing a mark in a database
2Deliberate tampering BData stays accurate and unaltered unless an authorised person changes it
3An accidental change breaks integrity when a user mistypes a value and overwrites correct data CThis describes confidentiality, not integrity. Integrity is about data staying accurate and unaltered unless an authorised person changes it.
4Deliberate tampering breaks integrity when an unauthorised person edits stored data to benefit themselves DUPDATE students SET points = 9999 WHERE studentId = 5;
5Integrity means keeping data secret from unauthorised people. EIntegrity can also be lost through accidental changes, such as typing errors or accidental deletions, not just deliberate tampering.
6Integrity is only lost when a hacker deliberately changes data. FUPDATE results SET mark = 880 WHERE studentId = 1;

Definitions

Integrity

Fill in the Blanks

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

1.
mark = ___(input("Mark: "))
2.
if mark >= 0 ___ mark <= 100: record = mark
3.
tampered = current __ original
4.
file = ____("marks.txt", "r")
5.
if user __ authorised_users: record = new_value

Spot the Error

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

Question 1
A from hashlib import sha256
B data = b'Pay: 500'
C h = sha256(data).hexdigest
D print(h)
Question 2
A role = 'student'
B allow_edit = False
C if role != 'teacher':
D allow_edit = True
Question 3
A original = [88, 74, 91]
B copy = original
C original[1] = 47
D if copy != original:
E print('Data changed!')
Question 4
A sent_hash = 'a1b2'
B got_hash = 'a1b2'
C if sent_hash != got_hash:
D print('Data intact')
E else:
F print('Data altered')
Question 5
A def valid_mark(mark)
B return 0 <= mark <= 100
C mark = 105
D if not valid_mark(mark):
E print('Rejected')

Answer Key

Integrity
Section A: Quick Questions
Q1
B — Data stays accurate and unaltered unless an authorised person changes it
Q2
A — Integrity
Q3
B — Deliberate tampering
Q4
A — A teacher with edit permission corrects a student's mark and the change is logged
Q5
A — Typing 750 instead of 75 into a form
Section B: Match the Pairs
Q1
Integrity → Data stays accurate and unaltered unless an authorised person changes it
Q2
Deliberate tampering → Someone intentionally changes data without permission, such as editing a mark in a database
Q3
An accidental change breaks integrity when a user mistypes a value and overwrites correct data → UPDATE results SET mark = 880 WHERE studentId = 1;
Q4
Deliberate tampering breaks integrity when an unauthorised person edits stored data to benefit themselves → UPDATE students SET points = 9999 WHERE studentId = 5;
Q5
Integrity means keeping data secret from unauthorised people. → This describes confidentiality, not integrity. Integrity is about data staying accurate and unaltered unless an authorised person changes it.
Q6
Integrity is only lost when a hacker deliberately changes data. → Integrity can also be lost through accidental changes, such as typing errors or accidental deletions, not just deliberate tampering.
Section C: Definitions
Q1
Integrity — Data stays accurate and unaltered unless an authorised person changes it. It protects data from accidental changes and deliberate tampering.
Section D: Fill in the Blanks
Q1
mark = int(input("Mark: "))
Q2
if mark >= 0 and mark <= 100: record = mark
Q3
tampered = current != original
Q4
file = open("marks.txt", "r")
Q5
if user in authorised_users: record = new_value
Section E: Spot the Error
Q1
C — hexdigest is a method, so it needs brackets to run. Without them h holds the method itself, not the hash, and the hash can't be used to detect tampering. It should be h = sha256(data).hexdigest().
Q2
C — Only an authorised person (the teacher) should be able to change the data. Using != gives edit rights to everyone except the teacher. It should be if role == 'teacher':.
Q3
B — This only creates a second name for the same list, so the change to original also changes copy and the alteration is never detected. An untouched snapshot needs copy = original.copy().
Q4
C — Data is intact when the two hashes match. Using != reverses the check, so matching data is reported as altered. It should be if sent_hash == got_hash:.
Q5
A — A function header must end with a colon. Without it Python raises a SyntaxError and the check that blocks accidental bad data never runs. It should be def valid_mark(mark):.