Describe and use a range of data‑validation and data‑verification methods so that data stored, transmitted or processed is accurate, complete and reliable.
Data integrity is the correctness and consistency of data throughout its entire life‑cycle. It is protected by preventing accidental or intentional alteration of data.
Validation can be performed at three distinct stages. Each stage has a different focus.
| Term | Definition (Cambridge AS/A‑Level) |
|---|---|
| Presence check | Verify that a required field is not blank (e.g., a student’s ID must be entered). |
| Existence check | Confirm that a value exists in a reference list or table (e.g., a course code must exist in the master Courses table). |
| Range check | Ensure a numeric value lies between a lower and upper limit (e.g., age 0–120). |
| Limit check | Test that a value does not exceed a defined maximum (e.g., total credits ≤ 180). |
| Check‑digit | A single digit calculated from the other digits of a number to detect transcription errors (e.g., ISBN‑10). |
^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}$ for e‑mail addresses.Courses table.A single bit added so that the total number of 1‑bits in the word is even (even parity) or odd (odd parity).
Example – 8‑bit word with even parity:
Data: 10110010 (four 1‑bits → even) Parity P = 0 Transmitted: 10110010 0 If bit 3 flips → 10010010 0 → three 1‑bits → parity check fails.
Sum all data bytes and take the remainder modulo 256 (8‑bit checksum).
Example – data bytes 0x12, 0xA7, 0x5C:
Sum = 0x12 + 0xA7 + 0x5C = 0x10D Checksum C = 0x10D mod 256 = 0x0D Transmitted block = 12 A7 5C 0D If the second byte is corrupted to 0xA6, new sum = 0x10C → C = 0x0C ≠ 0x0D → error detected.
CRC treats the data as a binary polynomial and appends the remainder after division by a generator polynomial. Useful for deeper study but not required for the exam.
Produces a 256‑bit digest that changes dramatically with any alteration of the input. Used for tamper‑proof verification, but beyond the syllabus specification.
| Method | Typical size (bits) | Error‑detection capability | Common uses (exam relevance) |
|---|---|---|---|
| Parity bit | 1 | Detects any single‑bit error; fails for an even number of bit errors | Memory modules, simple serial links (syllabus focus) |
| Additive checksum (mod‑256) | 8 | Detects most single‑byte errors; limited against re‑ordering or multiple‑byte errors | File‑transfer protocols, exam‑style questions |
| CRC‑16 / CRC‑32 (optional) | 16–32 | Detects all single‑bit errors, all double‑bit errors, and all burst errors up to the degree of the generator polynomial | Ethernet, USB, deeper study |
| SHA‑256 (optional) | 256 | Detects any change with probability ≈ 2⁻²⁵⁶ | Software distribution, digital signatures |
function validateStudentRecord(record):
# ---- 1. Syntactic (presence & format) ----
if record.id == "" :
return false, "Presence check failed – Student ID required"
if not matches(record.id, r'^[A-Z]{2}\d{4}$'):
return false, "Format check failed – ID must be two letters followed by four digits (e.g., AB1234)"
if not matches(record.email, r'^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}$'):
return false, "Email format invalid"
# ---- 2. Semantic (range, limit, existence, check‑digit) ----
age = int(record.age)
if age < 0 or age > 120:
return false, "Range check failed – age must be 0‑120"
if record.totalCredits > 180:
return false, "Limit check failed – credits cannot exceed 180"
if record.startDate > record.endDate:
return false, "Cross‑field check failed – start date after end date"
if not existsInTable('Courses', record.courseCode):
return false, "Existence check failed – course code not found"
# check‑digit example (ISBN‑10 style)
calcDigit = (10 - (sum((i+1)*int(d) for i,d in enumerate(record.isbn[:-1])) % 10)) % 10
if calcDigit != int(record.isbn[-1]):
return false, "Check‑digit verification failed"
# ---- 3. Redundancy – additive checksum (mod‑256) ----
dataBytes = toBytes(record.id + record.name + record.age + record.email)
checksum = sum(dataBytes) % 256
if checksum != record.checksum:
return false, "Checksum mismatch – data may be corrupted"
return true, "Record valid"
Given the data‑entry form below, list **three** validation checks that must be performed before the form can be accepted. Justify your choice in terms of the syllabus terminology (e.g., presence, range, existence).
Student ID: _______ (required, format AA1234) Name: _______ (required) Date of birth: __/__/____ Course code: _______ (must exist in Courses table) Credits earned: ___
| Criterion | Marks |
|---|---|
| Presence check for Student ID and Name | 1 |
| Format check for Student ID (AA1234) | 1 |
| Existence check for Course code | 1 |
| Range/limit check for Credits (0‑180) | 1 |
| Clear justification linking each check to the syllabus term | 1 |
Write pseudocode (or a short program fragment) that calculates an 8‑bit additive checksum for a record consisting of the fields StudentID, Name and Age. The checksum must be stored with the record and later verified.
| Criterion | Marks |
|---|---|
| Correct conversion of fields to bytes | 1 |
| Summation of all bytes | 1 |
| Modulo‑256 operation | 1 |
| Storing the checksum with the record | 1 |
| Verification step (re‑calculate and compare) | 1 |
Flowchart: Input → Presence/Format checks → Range/Existence checks → Check‑digit / Redundancy check → Store/Transmit
Create an account or Login to take a Quiz
Log in to suggest improvements to this note.
Your generous donation helps us continue providing free Cambridge IGCSE & A-Level resources, past papers, syllabus notes, revision questions, and high-quality online tutoring to students across Kenya.