← QCE Digital Solutions Unit 4

Integrity

Data stays accurate and unaltered unless an authorised person changes it. It protects data from accidental changes and deliberate tampering.

Understanding Integrity in QCE Digital Solutions Unit 4

What it does: A typing slip (880 instead of 88) is an accidental change that leaves the stored data inaccurate. Giving a student 9999 points without authority is intentional tampering, so the data no longer stays accurate and unaltered. Integrity allows changes only by authorised people. A read-only user editing data is unauthorised. A typing slip is an unintentional error. Malware rewriting records is deliberate tampering. A changed hash means the content is different from the original. It could be an accident or tampering, and either way integrity is compromised. Integrity covers mistakes such as typos and corruption, as well as intentional tampering by attackers or insiders.

Common mistakes: 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(). 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':.

Class: _____________________  ·  Name: _____________________  ·  Date: _________

Free printable worksheet with full answer key — or add this module to a class and your students practise it interactively.

This module's key terms are also in a printable crossword (Modules 127–333) and word search (Modules 127–401).

Take this worksheet further — free with Cloodit

Each concept is reinforced from every angle — learned, then applied, then tested.

Learning
Duo
Which statement best describes integrity in data security?
Data stays accurate and unaltered unless an authorised person changes itData can be viewed only by people who are allowed to see it
Matches
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.
Applying
Meanings
Term
Integrity
Meaning
Data stays accurate and unaltered unless an authorised person changes it. It protects data from accidental changes and deliberate tampering.
Practice
input newMark
Testing
Gaps
mark = (input("Mark: "))
Check Answer
Spots
2data = b'Pay: 500'
3h = sha256(data).hexdigest

Cloodit turns curriculum-aligned coding content into journeys students work through one biome at a time.

The 'Giant Isopod' badge — Patient Builder, one of Cloodit's 106 collectible badges
Students earn collectable badges

Over 100 of them, across seven natural biomes.

Study Buddy
Students build a real study resource

Turns their work into revision material ready for Flash Cards and Exam study.

Diamond Dash — one of Cloodit's live, competitive Sprint games
Students lock in with Sprints

Live, competitive practice for the start of the lesson or a teacher-led lesson finisher.

A Cloodit certificate of achievement, ready to personalise and print
Custom printable certificates

Honour your top performers, or encourage a student who's trying hard — ready to print in seconds.

Quick Questions

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 ✓
Integrity is about data staying accurate and unaltered. Limiting who can view data is confidentiality.
2. A student accidentally deletes a row from a shared spreadsheet. Which security property is affected?
A. Integrity ✓
B. Confidentiality
The data was changed by mistake, so it is no longer accurate or complete. That is a loss of integrity from an accidental change.
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 ✓
The attacker changed the data on purpose without authorisation. That is 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
Integrity allows changes only by authorised people. A read-only user editing data is unauthorised.
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
A typing slip is an unintentional error. Malware rewriting records is deliberate tampering.

Match the Pairs

Integrity → Data stays accurate and unaltered unless an authorised person changes it
Deliberate tampering → Someone intentionally changes data without permission, such as editing a mark in a database
An accidental change breaks integrity when a user mistypes a value and overwrites correct data → UPDATE results SET mark = 880 WHERE studentId = 1;
Deliberate tampering breaks integrity when an unauthorised person edits stored data to benefit themselves → UPDATE students SET points = 9999 WHERE studentId = 5;
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.
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.

Key Term

Integrity
Data stays accurate and unaltered unless an authorised person changes it. It protects data from accidental changes and deliberate tampering.

Fill in the Blanks

1. mark = int(input("Mark: "))
Hint: Type the function that converts typed text into a whole number, so a typing slip like letters can't corrupt the data.
2. if mark >= 0 and mark <= 100: record = mark
Hint: Type the logical operator that requires both range checks to be true before an accidental bad value is stored.
3. tampered = current != original
Hint: Type the comparison operator that checks whether the two hashes are different, which signals deliberate tampering.
4. file = open("marks.txt", "r")
Hint: Type the built-in function that opens a file; the read-only mode helps prevent accidental changes.
5. if user in authorised_users: record = new_value
Hint: Type the keyword that checks membership in a list, so only authorised people can change the data.

Spot the Error

Question 1
A from hashlib import sha256
B data = b'Pay: 500'
C h = sha256(data).hexdigest
D print(h)
Line 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().
Question 2
A role = 'student'
B allow_edit = False
C if role != 'teacher':
D allow_edit = True
Line 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':.
Question 3
A original = [88, 74, 91]
B copy = original
C original[1] = 47
D if copy != original:
E print('Data changed!')
Line 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().
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')
Line 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:.
Question 5
A def valid_mark(mark)
B return 0 <= mark <= 100
C mark = 105
D if not valid_mark(mark):
E print('Rejected')
Line 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):.

Student with a class code? Join your class →