← QCE Digital Solutions Unit 2

Data security: integrity

Data stays accurate and unaltered unless an authorised person changes it, so a tampered bank balance breaks integrity.

Understanding Data security: integrity in QCE Digital Solutions Unit 2

What it does: Giving UPDATE permission only to an authorised role stops other users from altering balances, which protects integrity. A CHECK constraint rejects invalid balance values, helping keep the data accurate and unaltered by mistakes. An unauthorised edit alters the data and breaks integrity. A website being offline affects availability, not integrity. A balance that does not match the records suggests it was altered without authorisation, which is a loss of integrity. Secret changes alter the data and break integrity. Reading data you are allowed to see does not change it. Granting UPDATE to everyone removes the control that keeps data unaltered by unauthorised people.

Common mistakes: The condition is reversed, so everyone except a teller could change the balance. Only an authorised user may alter it: if userRole = "teller" then. When the stored balance matches the transaction total, the data is intact. This branch should print "Integrity OK", not report tampering.

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 144–185) and word search (Modules 144–228).

Take this worksheet further — free with Cloodit

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

Learning
Duo
A hacker changes a student's bank balance from $50 to $5000 without permission. Which security principle is broken?
AvailabilityIntegrity
Matches
GRANT UPDATE ON accounts TO PUBLIC;
↓
Every user can change balances, so anyone could tamper with them and integrity is not protected. Only authorised users should get UPDATE.
Applying
Meanings
Term
Integrity
Meaning
Data stays accurate and unaltered unless an authorised person changes it, so a tampered bank balance breaks integrity.
Practice
balance ← 500
Testing
Gaps
accounts SET balance = 9999
Check Answer
Spots
3input amount
4if userRole ≠ "teller" then

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

The 'Octopus' badge — Multi-Tasker, 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. A hacker changes a student's bank balance from $50 to $5000 without permission. Which security principle is broken?
A. Availability
B. Integrity ✓
Integrity means data stays accurate and unaltered unless an authorised person changes it. A tampered balance is data that has been altered without permission.
2. Which statement best describes data integrity?
A. Data can be read by anyone who asks for it
B. Data stays accurate and is only changed by authorised people ✓
Integrity is about data staying accurate and unaltered. Letting anyone read it would be a confidentiality problem, not integrity.
3. A bank teller with the right permissions corrects a mistyped balance and the change is logged. Is integrity still intact?
A. Yes, because an authorised person made the change ✓
B. No, because the balance was changed
Integrity does not mean data can never change. It means only authorised people can change it, so an approved, logged correction keeps integrity.
4. Which situation is a breach of integrity?
A. A user edits their own account balance without permission ✓
B. The bank website is offline for maintenance
An unauthorised edit alters the data and breaks integrity. A website being offline affects availability, not integrity.
5. Which control helps protect the integrity of a bank balance?
A. Giving only authorised staff write permission ✓
B. Giving every customer write permission to all accounts
Limiting write permission to authorised people stops tampering. If everyone can write to all accounts, balances can be changed by anyone.

Match the Pairs

Integrity → Data stays accurate and unaltered unless an authorised person changes it
UPDATE accounts SET balance = 999999 WHERE accountId = 7; → A tampered balance: an unauthorised change that breaks data integrity
Only authorised users may change a balance, which protects integrity → GRANT UPDATE ON accounts TO bank_manager;
A balance must stay accurate, so a rule blocks impossible changes → ALTER TABLE accounts ADD CHECK (balance >= 0);
GRANT UPDATE ON accounts TO PUBLIC; → Every user can change balances, so anyone could tamper with them and integrity is not protected. Only authorised users should get UPDATE.
A customer edits their own balance from 500 to 5000, and the bank accepts it as correct. → The change was made by an unauthorised person and was accepted without any check, so the balance is no longer accurate and integrity is broken.

Key Term

Integrity
Data stays accurate and unaltered unless an authorised person changes it, so a tampered bank balance breaks integrity.

Fill in the Blanks

1. UPDATE accounts SET balance = 9999 WHERE id = 4;
Hint: Type the SQL command that changes existing rows, as in a tampered balance.
2. if storedBalance ≠ expectedBalance then print "Tampering detected" end if
Hint: Type the comparison operator for 'not equal', which spots an altered balance.
3. if role = "admin" then balance ← newBalance end if
Hint: Type the variable that holds the user's permission level so only authorised people can change the balance.
4. GRANT SELECT ON accounts TO customer;
Hint: Type the privilege that lets customers read data without changing it.
5. balance DECIMAL(10,2) CHECK (balance >= 0)
Hint: Type the constraint keyword that rejects values which break a rule.

Spot the Error

Question 1
A balance ← 500
B input userRole
C input amount
D if userRole ≠ "teller" then
E balance ← balance - amount
F end if
Line D — The condition is reversed, so everyone except a teller could change the balance. Only an authorised user may alter it: if userRole = "teller" then.
Question 2
A oldTotal ← sum(transactions)
B if oldTotal = balance then
C print "Balance tampered"
D else
E print "Balance tampered"
Line C — When the stored balance matches the transaction total, the data is intact. This branch should print "Integrity OK", not report tampering.
Question 3
A define checkBalance(stored, now
B if stored ≠ now then
C return "Tampered"
D end if
E return "Intact"
Line A — The closing bracket of the parameter list is missing. It should be define checkBalance(stored, now).
Question 4
A input amount
B newBalance ← balance amount
C write userId, newBalance to log
Line B — The arithmetic operator is missing, so the new balance cannot be calculated. It should be newBalance ← balance - amount.
Question 5
A if role = "teller" then
B balance = balance + deposit
C else
D print "Access denied"
E end if
Line B — = compares two values and does not store anything. Assignment needs the arrow: balance ← balance + deposit.

Student with a class code? Join your class →