📑 Contents

Chapter 6.2: Data Integrity

Validation & Verification Methods

9618 AS Computer Science

📚 Learning Objectives
🌟 What is Data Integrity?

Data Integrity refers to the accuracy, completeness, and consistency of data. It ensures that:

Data integrity can be compromised during data entry, data transmission, malicious attacks (malware, hacking), or accidental data loss (hardware issues).

VALIDATION Is it reasonable? VERIFICATION Is it accurate? Data Integrity Protection Methods

1. Validation

📖 Definition

Validation is an automatic computer check to ensure that the data entered is sensible and reasonable. It does NOT check the accuracy of data.

Example: A secondary school student is likely to be aged between 11 and 16. The computer can be programmed only to accept numbers between 11 and 16. This is a range check. However, if a student's age is 14 but 11 is entered, it will be valid but incorrect.

1.1 Key Point

Validation ensures data is sensible and reasonable, but cannot guarantee it is correct. Validation is automatically carried out by computer software.

💡 Exam Tip

Remember: Validation checks if data is reasonable (within acceptable criteria), NOT if it is accurate (correct). For example, if you enter your age as 62 instead of 26, it is reasonable but not accurate.

1.2 Types of Validation

Validation Type Description Example
Range Check Ensures a number falls within a set range Percentage must be 0-100
Limit Check Checks that a value does not exceed a maximum/minimum limit Maximum 5 items per order
Length Check Checks the length of a string PIN must be exactly 4 digits
Type Check Checks that input is correct data type Age must be a whole number
Presence Check Ensures field is not left blank Registration form requires name
Existence Check Checks that a referenced value exists in database Student ID must exist in records
Format Check Ensures data matches a pre-defined pattern Email must contain @ and domain
Check Digit Final digit calculated from other digits to detect errors ISBN, barcodes

2. Validation Types in Detail

2.1 Range Check

📝 How It Works

Checks that only numbers within a specified range are accepted. For example, month in a date must not exceed 12, or a percentage must be between 0 and 100.

2.2 Limit Check

📝 How It Works

Checks only one limit - either upper limit or lower limit. For example, a maximum number of years for a person's age, or minimum order quantity.

2.3 Length Check

📝 How It Works

Checks that data contains an exact number or range of characters. For example, a telephone number must be 10-11 digits, or a PIN must be exactly 4 characters.

2.4 Format Check

📝 How It Works

Checks that characters entered conform to a pre-defined pattern. For example:

2.5 Presence Check

📝 How It Works

Ensures that an entry field is not left blank. For example, making sure a registration form is not submitted with blank required fields like name or email.

2.6 Existence Check

📝 How It Works

Checks that a referenced value exists in a database or list. For example, confirming a student ID entered exists in the school records, or a filename referred to in data entry actually exists.

INPUT Valid? NO ERROR! YES PROCESS Validation Types: • Range Check • Length Check • Format Check • Presence Check • Type/Existence Check

3. Check Digits

📖 Definition

A check digit is the final digit included in a code; it is calculated from all other digits in the code. When a number is entered into a computer, the check digit is recalculated and if the same value is not generated, an error will occur.

3.1 Applications of Check Digits

3.2 Types of Errors Detected

Error Type Example
Incorrect digit 5327 entered instead of 5307
Phonetic errors 13 (thirteen) instead of 30 (thirty)
Transposition error 4087 instead of 4807 (two digits swapped)
Missing/Extra digit 247 instead of 2407, or 42107 instead of 4207

3.3 ISBN Check Digit Calculation Example

📝 10-Digit ISBN Calculation: 1 84146 201 ?

Step 1: Each digit is given a weighting from 10 down to 1 (left to right)

Step 2: Multiply each digit by its weighting and sum:

(1×10) + (8×9) + (4×8) + (1×7) + (4×6) + (6×5) + (2×4) + (0×3) + (1×2)

= 10 + 72 + 32 + 7 + 24 + 30 + 8 + 0 + 2 = 185

Step 3: Divide total by 11: 185 ÷ 11 = 16 remainder 9

Step 4: Subtract remainder from 11: 11 - 9 = 2

Check digit = 2

Note: If remainder is 10, letter X is used as check digit.

3.4 EAN8 Barcode Check Digit Example

📝 EAN8 Barcode: 2142345?

Step 1: Multiply 1st, 3rd, 5th, 7th digits by 3:

(3×2) + (3×4) + (3×3) + (3×5) = 6 + 12 + 9 + 15 = 42

Step 2: Add remaining digits: 42 + 1 + 2 + 4 = 49

Step 3: Divide by 10: 49 ÷ 10 = 4 remainder 9

Step 4: Subtract from 10: 10 - 9 = 1

Check digit = 1 → Full barcode: 21423451

4. Verification

📖 Definition

Verification is checking that data has been accurately copied onto a computer or transferred from one computer system to another. Verification ensures data matches the original source.

⚠️ Validation vs Verification

4.1 Verification During Data Entry

Method Description Limitations
Double Entry Data is entered twice; computer compares both entries and outputs error if different Time-consuming; same mistake entered twice won't be detected
Visual Check User manually compares input data against original source document on screen Prone to human error; relies on user attention
Check Digits Final digit calculated from other digits; computer recalculates to verify Only works for numeric codes; requires algorithm

4.2 Double Entry Example

Password Creation: Users are asked to enter their chosen password twice. This verifies that the user typed it correctly. This check is important because password entry fields are normally asterisked out (***********), so users cannot see what they typed.
Double Entry Enter Password: **** Re-enter: **** Compare Visual Check Original Doc Screen Data User checks Check Digit 2142345 [1] Check digit calculated and verified

5. Verification During Data Transfer

When data is transferred electronically from one device to another, there is possibility of data corruption or even data loss. Several methods exist to minimize this risk.

5.1 Checksums

📖 Definition

A checksum is a value transmitted at the end of a block of data, calculated using the other elements in the data stream, used to check for transmission errors.

📝 How Checksums Work
  1. Sending computer uses data and a predefined mathematical algorithm to calculate a checksum value
  2. Sending computer sends the data plus the checksum value
  3. Receiving computer uses the data received to calculate what it believes the checksum should be
  4. The two checksum values are compared
  5. If values match → data transmitted without errors
  6. If values differ → request is sent for data to be retransmitted
💡 Checksum Calculation Rule
Example: Bytes total 1,151
1,151 ÷ 256 = 4 remainder 127
Checksum = 127
SENDER Data + Algorithm = Checksum DATA BLOCK + Checksum Value RECEIVER Recalculate Checksum =? MATCH → OK! NO MATCH → RETRY Request retransmission

6. Parity Checks

📖 Definition

A parity check is a method to check whether data has been changed or corrupted following transmission. An extra bit (parity bit) is added to a string of binary code to ensure the number of 1-bits are either even or odd.

6.1 Even vs Odd Parity

Parity Type Rule Parity Bit Value
Even Parity Total number of 1-bits (including parity bit) must be EVEN Set to make total even
Odd Parity Total number of 1-bits (including parity bit) must be ODD Set to make total odd
📝 How Parity Checks Work
  1. Sending and receiving computers agree the protocol (even or odd parity)
  2. Sending computer adds the correct parity bit to the binary data (either 1 or 0)
  3. Sending computer sends the binary data including parity bit
  4. Receiving computer checks that the overall parity matches the agreed type
  5. If parity is incorrect → receiving computer requests data be transmitted again

6.2 Parity Examples

Even Parity Example:
Data bits: 1 0 1 1 0 1 0 (four 1s = even)
Parity bit must be 0 to keep total even
Byte transmitted: 0 1 0 1 1 0 1 0
Odd Parity Example:
Data bits: 1 0 1 1 0 1 0 (four 1s = even)
Parity bit must be 1 to make total odd
Byte transmitted: 1 1 0 1 1 0 1 0
❌ Limitation of Parity Checks

If there are multiple errors in the same byte that still produce the same parity, the error will NOT be detected!

Example: "00001111" changes to "00000011" - both have even parity (four 1s and two 1s are both even... wait, 00001111 has 4 ones, 00000011 has 2 ones - both even!)

Actually: Original 00001111 has 4 ones (even), corrupted 00000011 has 2 ones (even) - parity unchanged, error undetected!

7. Parity Block Checks

📖 Definition

Parity blocks and parity bytes can be used to check an error has occurred AND where the error is located. Parity checks on their own only detect that an error occurred, not where.

📝 How Parity Blocks Work

7.1 Parity Block Example (Odd Parity)

Parity Bit Bit 2 Bit 3 Bit 4 Bit 5 Bit 6 Bit 7 Bit 8 0 1 1 0 1 0 1 1 Byte 1 0 0 0 0 1 0 0 0 Byte 2 1 0 1 0 1 1 1 1 Byte 3 ← ERROR! 0 1 1 1 1 1 1 1 Parity Byte • Row 3 parity wrong • Column 5 parity wrong • Intersection = error location Error at: Byte 3, Bit 5 Should be: 0 (not 1) Odd Parity Block Check - Error Detection

8. Automatic Repeat Request (ARQ)

📖 Definition

ARQ (Automatic Repeat Request) is a form of error detection that uses a system of acknowledgements and timeouts. ARQ is often used to ensure reliable transmissions over an unreliable service.

📝 How ARQ Works
  1. Sending computer transmits a block of data
  2. Sending computer waits a period of time to see if receiving computer acknowledges receipt
  3. If acknowledgement received → transmission successful
  4. If no acknowledgement after set period (timeout) → data is automatically resent
  5. This continues until the receiving computer acknowledges the data has been received

8.1 Key Components

Component Description
Acknowledgement (ACK) Signal sent by receiver to confirm data was received correctly
Timeout Set period of time after which data is resent if no acknowledgement received
Retransmission Automatic resending of data when timeout occurs without acknowledgement
SENDER RECEIVER DATA 1. Send data block ⏱ TIMER 2. Wait for ACK ✗ No ACK received 3. TIMEOUT → Resend ACK ✓ SUCCESS!
💡 Exam Tip

ARQ combines well with other error detection methods. Data is first checked using parity or checksum, then if an error is found, no ACK is sent → timeout occurs → data is resent automatically.

9. Data Security vs Data Integrity

Data Security Data Integrity
Deals with protection of data Deals with validity of data
Protects data from illegal access/loss Ensures data is not corrupted after input or transmission
Methods: Encryption, firewalls, passwords, access control Methods: Validation, verification, checksums, parity checks
Prevents unauthorized users from accessing data Ensures data accuracy and consistency

10. Key Takeaways

📌 Summary Points

Validation

Verification During Data Entry

Verification During Data Transfer

11. Glossary

Term Definition
Data Integrity The accuracy, completeness, and consistency of data; ensures data is correct and not corrupted
Validation Automatic computer check to ensure data entered is sensible and reasonable
Verification Checking that data has been accurately copied or transferred, matching the original source
Range Check Validation that ensures a number falls within a specified minimum and maximum range
Limit Check Validation that checks a value against one limit (upper or lower) only
Length Check Validation that checks the number of characters in data entry
Format Check Validation that ensures data conforms to a pre-defined pattern
Presence Check Validation that ensures a field is not left blank/empty
Existence Check Validation that confirms a referenced value exists in a database or file system
Type Check Validation that ensures the correct data type is entered
Check Digit Final digit in a code calculated from other digits to detect entry errors
Double Entry Verification method where data is entered twice and compared for match
Visual Check Verification method where user manually compares input with original source
Checksum Value transmitted with data block, calculated from data, used to detect transmission errors
Parity Bit Extra bit added to binary data to make total number of 1s even or odd
Even Parity Parity system where total number of 1-bits (including parity bit) must be even
Odd Parity Parity system where total number of 1-bits (including parity bit) must be odd
Parity Block Grid of data with horizontal and vertical parity bits to locate errors
Parity Byte Additional byte containing vertical parity bits for each column in a parity block
ARQ Automatic Repeat Request - error control using acknowledgements and timeouts
Acknowledgement Signal sent by receiver to confirm successful data receipt
Timeout Set period after which data is resent if no acknowledgement received
Transposition Error Error where two adjacent digits are swapped (e.g., 4087 instead of 4807)
Phonetic Error Error caused by similar-sounding numbers (e.g., 13 instead of 30)

12. Exam-Style Questions (Part 1)

1. Describe the difference between validation and verification. Give an example of each. [4 marks]

Answer:

  • Validation is an automatic check to ensure data is sensible and reasonable, but does NOT check accuracy
  • Verification checks that data accurately matches the original source
  • Validation example: Range check ensuring age is between 11-16 for a secondary school student
  • Verification example: Double entry of password to ensure it was typed correctly
  • Additional point: Validation is performed by computer software automatically; verification can involve user interaction
2. A school is creating a database of student information. Describe three different validation checks that could be used on the data entry form. [6 marks]

Answer:

  • Presence check on name field to ensure it is not left blank
  • Range check on age field (e.g., 11-18) to ensure reasonable age for student
  • Format check on email field to ensure it contains @ and a valid domain
  • Length check on phone number to ensure correct number of digits
  • Type check on grade field to ensure only letters (A-F) are entered
  • Limit check on maximum number of subjects a student can select
  • Additional point: Existence check to verify student ID exists when referencing another record
3. Explain how a checksum is used to verify data during transmission. [5 marks]

Answer:

  • Sending computer calculates a checksum value using a mathematical algorithm on the data block
  • The checksum value is transmitted along with the data
  • Receiving computer recalculates the checksum from received data using same algorithm
  • The two checksum values are compared
  • If values match, data was transmitted without error; if different, retransmission is requested
  • Additional point: Checksum is calculated by summing bytes (if >255, use remainder when divided by 256)
4. A barcode has the first seven digits: 5 0 1 2 3 4 6. Calculate the check digit using the EAN8 method. Show your working. [4 marks]

Answer:

  • Step 1: Multiply 1st, 3rd, 5th, 7th digits by 3: (3×5) + (3×1) + (3×3) + (3×6) = 15 + 3 + 9 + 18 = 45
  • Step 2: Add remaining digits: 45 + 0 + 2 + 4 = 51
  • Step 3: Divide by 10: 51 ÷ 10 = 5 remainder 1
  • Step 4: Subtract from 10: 10 - 1 = 9
  • Check digit = 9
  • Additional: Full barcode would be: 50123469
5. Explain the purpose of a parity bit and describe the difference between even parity and odd parity. [4 marks]

Answer:

  • A parity bit is an extra bit added to binary data to help detect transmission errors
  • Even parity: The parity bit is set so that the total number of 1-bits (including parity) is an even number
  • Odd parity: The parity bit is set so that the total number of 1-bits (including parity) is an odd number
  • Sender and receiver must agree on parity type before transmission begins
  • Additional point: If received data has wrong parity, an error is detected and retransmission is requested

12. Exam-Style Questions (Part 2)

6. A byte using even parity is transmitted as: 1 0 1 1 0 1 0 0. Explain whether an error has been detected if this byte is received. [3 marks]

Answer:

  • Count the number of 1-bits in the received byte: 1, 0, 1, 1, 0, 1, 0, 0 = four 1s
  • Four is an even number, which matches the even parity requirement
  • No error detected - the parity check passes
  • Additional point: However, if two bits were corrupted (swapped), the parity would still be even and the error would NOT be detected - this is a limitation of parity checks
7. Describe how a parity block check can be used to both detect and correct an error in transmitted data. [5 marks]

Answer:

  • Data is arranged in a block of rows and columns
  • Each row has a horizontal parity bit calculated and transmitted
  • Each column has a vertical parity bit in a parity byte
  • If an error occurs, the row with wrong parity and column with wrong parity are identified
  • The intersection of the row and column pinpoints the exact location of the error
  • The bit at that location can be automatically corrected (flipped from 0 to 1 or 1 to 0)
  • Additional point: This method can only correct single-bit errors; multiple errors may not be locatable
8. Explain how Automatic Repeat Request (ARQ) ensures reliable data transmission. [4 marks]

Answer:

  • Sending computer transmits a block of data
  • Sender waits for an acknowledgement (ACK) from the receiver
  • If ACK is received within the timeout period, transmission is confirmed successful
  • If no ACK is received before timeout expires, data is automatically resent
  • Process continues until receiver acknowledges successful receipt
  • Additional point: ARQ works with error detection methods - if parity/checksum fails, no ACK is sent, triggering retransmission
9. Describe three types of errors that a check digit can detect. Give an example of each. [6 marks]

Answer:

  • Incorrect digit: A single wrong digit is entered (e.g., 5327 instead of 5307)
  • Transposition error: Two adjacent digits are swapped (e.g., 4087 instead of 4807)
  • Phonetic error: Numbers that sound similar are confused (e.g., 13 "thirteen" instead of 30 "thirty")
  • Missing digit: A digit is omitted (e.g., 247 instead of 2407)
  • Extra digit: An additional digit is added (e.g., 42107 instead of 4207)
  • Additional point: Check digits are used in ISBNs, barcodes, bank cards, and VIN numbers
10. Compare double entry and visual check as methods of verification during data entry. Include advantages and disadvantages of each. [6 marks]

Answer:

  • Double Entry: Data is entered twice and computer compares both entries
  • Advantage: Automated checking, no human error in comparison
  • Disadvantage: Time-consuming; same error entered twice won't be detected
  • Visual Check: User manually compares entered data with original source on screen
  • Advantage: Quick to perform; good for small amounts of data
  • Disadvantage: Relies on human attention; prone to tiredness/errors
  • Additional point: Double entry is better for critical data like passwords; visual check is better for occasional verification

13. Exam Success Tips (Part 1)

🧠 Memory Trick: Validation vs Verification
💡 Validation Types - Remember "RFLPECT"
💡 Parity Rules - Easy Memory
💡 Checksum Calculation Rule
❌ Common Mistakes to Avoid

13. Exam Success Tips (Part 2)

🧠 ARQ Memory Trick
💡 Answer Structure Tips
⚠️ Must-Know Calculations

EAN8 Check Digit:

  1. Multiply positions 1, 3, 5, 7 by 3
  2. Add remaining positions (2, 4, 6)
  3. Divide by 10, get remainder
  4. Subtract remainder from 10

ISBN-10 Check Digit:

  1. Multiply each digit by weight (10 down to 1)
  2. Sum all products
  3. Divide by 11, get remainder
  4. Subtract remainder from 11 (if 10, use X)
🌟 Quick Reference Table
Topic Key Point
Validation Checks reasonableness, NOT accuracy
Verification Confirms data matches original source
Parity Check Extra bit for even/odd count of 1s
Parity Block Locates exact error position
Checksum Value from algorithm to detect corruption
ARQ ACK + Timeout = Reliable transmission
Check Digit Final digit calculated from code

13. Exam Success Tips (Part 3)

📌 Final Exam Reminders
💡 When to Use Each Method
Situation Best Method(s)
Ensuring password typed correctly Double entry verification
Checking age is reasonable Range check validation
Detecting transmission errors Checksum, Parity check, or ARQ
Finding exact error location Parity block check
Verifying barcode correctness Check digit
Ensuring field not empty Presence check validation
Reliable data transmission ARQ + Checksum/Parity
❌ Last-Minute Warnings
DATA INTEGRITY VALIDATION Reasonable? VERIFICATION Accurate? Range, Format, Length, Presence, Type, Check Digit Double Entry, Visual, Check Digit, Parity, Checksum, ARQ