# Data integrity

> Computer Science · CIE A-Level 9618
> Source: https://www.owlsprep.com/study/cie-9618-u6-data-integrity/

This sub-topic covers the definition of data integrity, common causes of integrity loss, and core error detection and prevention techniques assessed in CIE 9618 exams. You will learn to distinguish key concepts and solve common calculation questions.

**Prerequisites:** [Binary number representation](https://www.owlsprep.com/study/cie-9618-u1-binary-representation/)

## Learning objectives

- Distinguish between data integrity, data accuracy and data security
- Identify common accidental and intentional threats to data integrity
- Explain how different error detection and integrity maintenance mechanisms work
- Calculate parity bits and simple checksums for error detection

## Core Concepts: What is Data Integrity?

**Data Integrity** — The property of data that ensures it remains accurate, complete and consistent over time, and is not altered in an unauthorised or accidental way.

*Example:* A bank transaction that retains its correct value after storage and transfer has intact data integrity.

Data integrity is often confused with two related concepts, which CIE regularly asks you to distinguish:

- **Data accuracy**: Refers to whether data correctly represents the real-world concept it describes. Data can be consistent (high integrity) but inaccurate (e.g. a wrong customer date of birth stored correctly).
- **Data security**: Refers to protecting data from unauthorised access. Data can be secure but corrupted (e.g. encrypted data damaged on disk loses integrity while still being inaccessible to unauthorised users).

**Worked example:** A student enters their date of birth as 12/13/2005 (month 13) in an online form. Does this affect accuracy, integrity, or both?

1. The value 13 for a month is invalid and does not match the student's real date of birth, so this is an accuracy error.
2. If the system stores the value 13 consistently without corruption, the data remains unmodified as entered: it still has integrity.
3. Conclusion: This is an accuracy error, not an integrity error. A validation rule would maintain integrity by rejecting the invalid entry before storage.

> **Exam tip:** When asked to distinguish between these terms, always define each one separately to earn full marks.

## Common Threats to Data Integrity

Data integrity can be compromised by both accidental and intentional events:

- **Accidental corruption**: Hardware failure (e.g. bad disk sectors), network transmission errors, power loss during write operations, or human error during data entry/editing.
- **Intentional corruption**: Unauthorized modification by attackers, malicious software that alters data, or insider tampering with records.
- **Physical/environmental damage**: Damage to storage media from heat, water or impact that flips stored bits.

**Worked example:** A power cut occurs while a bank is saving a new customer transaction record. Explain the impact on data integrity.

1. Only part of the new transaction record may be written to disk before power is lost.
2. This leaves the record incomplete, and can corrupt the file system index that locates records on storage.
3. The data is now inconsistent and incomplete: this is a direct loss of data integrity.

> **Exam tip:** Always link the threat to a specific impact on integrity, do not just describe the threat itself.

## Error Detection: Parity and Checksums

**Checksum** — A small numerical value calculated from a block of data, used to verify that data has not been corrupted during transmission or storage.

*Example:* An 8-bit checksum calculated by summing all bytes in a data packet.

Parity checking is the simplest error detection method. One extra parity bit is added to each data block, making the total number of 1 bits either even (even parity) or odd (odd parity).

**Worked example:** What is the parity bit for the 7-bit data `1011010` using even parity?

1. Count the number of 1 bits in the input data:
2. $$1 + 0 + 1 + 1 + 0 + 1 + 0 = 4$$
3. Even parity requires the total number of 1 bits (including parity) to be even. 4 is already even, so the parity bit is 0.
4. Final 8-bit transmitted value: `01011010`

**Worked example:** Calculate the 8-bit checksum for 3 bytes: `01001011`, `00101001`, `01011100`

1. Convert each binary byte to decimal: $01001011_2 = 75$, $00101001_2 = 41$, $01011100_2 = 92$
2. Calculate the sum of the values:
3. $$75 + 41 + 92 = 208$$
4. For 8-bit checksum, we keep only the 8-bit result (discard overflow). 208 in 8-bit binary is `11010000`, so this is the checksum.

> **info**
>
> Simple parity can only detect an odd number of bit errors. If 2 bits are flipped, parity remains correct and the error is not detected.

> **Exam tip:** Always explicitly state whether you are using even or odd parity in your answer to earn full marks.

## Other Integrity Maintenance Mechanisms

Beyond basic error detection, there are many mechanisms used to maintain long-term data integrity:

- **Cryptographic hashing**: Generates a fixed-size hash from input data; any change to data changes the hash. Used to verify integrity against intentional tampering.
- **Redundancy and backups**: Multiple copies of data across different locations allow recovery of intact data if one copy is corrupted. RAID storage uses this for hardware failure tolerance.
- **Database validation rules**: Constraints (data type checks, range checks, foreign key rules) ensure only valid, consistent data is stored.
- **Cyclic Redundancy Check (CRC)**: A polynomial-based error detection method used in networks and storage, more effective than simple checksums.

**Check your understanding**

Test your understanding:

1. Which of the following can simple parity detect?

   - A: Any 1-bit error
   - B: Any 2-bit error
   - C: All errors regardless of size
   - D: No errors

   *Why:* A 1-bit flip changes the number of 1 bits by 1, which changes the parity, so it is detected. 2 bit flips leave parity unchanged, so they go undetected.

## Common pitfalls

- **Wrong:** Confusing data integrity with data accuracy or data security
  - Why it fails: CIE regularly asks to distinguish these terms; mixing them up loses all marks
  - Correct: Remember: integrity = consistent and unmodified, accuracy = correct vs real world, security = protected from unauthorised access
- **Wrong:** Claiming simple parity can correct errors
  - Why it fails: Candidates often overstate what parity can do, leading to lost marks
  - Correct: Always state that parity can only detect an odd number of bit errors, it cannot correct errors
- **Wrong:** Miscounting 1 bits when calculating parity
  - Why it fails: This is the most common avoidable error in parity calculation questions
  - Correct: Count 1 bits in the original data first, then add the parity bit to get the required total parity
- **Wrong:** Claiming checksums prevent data corruption
  - Why it fails: Checksums only detect corruption, they do not stop it from occurring
  - Correct: Checksums are error detection tools: they identify corruption so you can restore or retransmit data

## Cheatsheet

| Concept | Purpose | Key Capability |
| --- | --- | --- |
| Data Integrity | Guarantee data is consistent/unmodified | Core requirement for reliable systems |
| Even Parity | Simple error detection | Detects odd number of bit errors |
| Odd Parity | Simple error detection | Detects odd number of bit errors |
| Checksum | Error detection | Detects most accidental corruption |
| Cryptographic Hash | Integrity verification | Detects accidental and intentional modification |
| Simple Parity | Error detection | Cannot correct errors or detect even errors |

## What's next

Understanding data integrity is a foundational concept for further study of database systems, network security and cryptography. The error detection methods you learned here are used daily in data storage, network communications and cloud computing, and form the basis for more advanced error correction techniques used in everything from USB drives to satellite communications. Data integrity works alongside data security mechanisms to protect digital information, and underpins the reliability of all modern computer systems.

- [Privacy issues](https://www.owlsprep.com/study/cie-9618-u6-privacy-issues/)
- [Backup and recovery](https://www.owlsprep.com/study/cie-9618-u6-backup-and-recovery/)
- [Ethics & ownership](https://www.owlsprep.com/study/cie-9618-u7-overview/)

---

From [OwlsPrep](https://www.owlsprep.com) — free study guides for A-Level, IB, AP and IGCSE, written against the official syllabus. Canonical page: https://www.owlsprep.com/study/cie-9618-u6-data-integrity/
