A-Level Computer Science / Unit 6: Protecting Data and Ensuring Accuracy

6.2.1 Checking Data During Entry

πŸ”’ Lesson slides are available to signed-in users. Sign in

6.2.1 Checking Data During Entry

Data integrity can be damaged at the moment data enters a system. A value may be missing, badly structured, outside an acceptable boundary, copied incorrectly, or inconsistent with a known list of valid items.

This section examines two complementary approaches. Validation applies rules to the entered value. Verification checks whether the value entered matches the source or the user's intended entry.

By the end of this section, you should be able to:

  • Explain the difference between validation and verification.
  • Describe and apply range, limit, format, length, presence, existence, and check-digit checks.
  • Select suitable validation rules for different input fields.
  • Describe visual checking and double entry as verification methods.
  • Explain why a value can pass every check and still be factually wrong.

Validation and Verification Answer Different Questions

Validation: checking entered data against predefined rules to decide whether it is acceptable for processing.
Verification: checking that data entered into the system matches the source or the value the user intended to enter.
Method Main question Example What it cannot prove
Validation Does the value obey the field's rules? An age of 17 is accepted because the permitted range is 13 to 19. That the person is genuinely 17.
Verification Was the source or intended value entered as expected? A booking code is entered twice and both entries match. That the original booking code was itself correct.
Common misconception: Valid data is not automatically correct data. A value may satisfy every rule while still describing the wrong person, object, or event.
Exam tip: When comparing the methods, state that validation checks rules, while verification checks agreement with a source or repeated entry.

Choosing Checks for a Field

A useful validation rule must reflect the meaning and expected structure of the field. Some fields need more than one check. For example, a membership code could require a presence check, a format check, a length check, and a check digit.

Question about the field Likely check
Must a value be supplied? Presence check
Must the value stay between two boundaries? Range check
Must it stay below or above one boundary? Limit check
Must characters appear in a particular pattern? Format check
Must it contain a fixed or permitted number of characters? Length check
Must the value already occur in a stored list or table? Existence check
Does an identifier contain a calculated final digit? Check-digit check
Exam tip: Name the check, state its rule, and apply it to the field. β€œUse validation” is too vague.

Range Checks and Limit Checks

Range check

A range check compares a value with both a lower boundary and an upper boundary. Values inside the permitted interval are accepted.

Range check: confirms that a value lies between a specified minimum and maximum, usually including both boundaries.

A youth sailing course accepts participants aged from 14 to 18 inclusive. The entry 19 fails because it is above the permitted range. The entry 16 passes, although this alone does not prove that the participant is truly 16.

Limit check

A limit check compares a value with one boundary only. It may enforce a maximum or a minimum.

Limit check: confirms that a value does not pass a single upper or lower boundary.

A courier form allows a parcel mass of no more than 22 kg. An entry of 24.5 kg fails the upper-limit check. No lower boundary is being tested by this rule.

Common misconception: A range check uses two boundaries. A limit check uses one. Describe the actual rule rather than choosing the term only because a number is involved.

Format, Length and Presence Checks

Check What it tests Original field rule Example that fails
Format check The arrangement and type of characters Workshop code must follow AA-999 R7-42B
Length check The number of characters Library locker code must contain exactly 8 characters LK20491 contains 7 characters
Presence check Whether a required field has been left empty Emergency contact number must not be blank An empty input field
Format check: tests whether entered characters follow an expected pattern.
Length check: tests whether the number of characters is acceptable.
Presence check: tests whether a required value has been entered.
Common misconception: A presence check only confirms that something was entered. It does not confirm that the value is meaningful or correct.

Existence Check

An existence check compares the entered value with data already stored by the system. It is useful when the value should refer to a known record, item, route, account, or product.

Existence check: tests whether an entered value is present in an authorised stored list, file, or database table.

Original example: minibus route code

A booking system stores the valid route codes MB12, MB18, MB24, and MB31. The entry MB27 has the correct pattern and length, but it fails the existence check because no such route is stored.

Exam tip: An existence check is not the same as a presence check. Presence means the field is not empty; existence means the value matches an item already known to the system.

Check Digit

A check digit is calculated from the other digits in an identifier. When the identifier is entered, the system repeats the calculation and compares the result with the supplied final digit. A mismatch suggests that the identifier was entered incorrectly.

Check digit: an extra digit derived from the other digits in an identifier and used to detect likely input errors.

Original training scheme

The following invented scheme is used only to demonstrate the process:

  1. Multiply four base digits by the weights 4, 3, 2, and 1.
  2. Add the products.
  3. The final digit is the remainder after division by 10.
Base digit 3 8 1 6
Weight 4 3 2 1
Product 12 24 2 6

The total is 44, so the check digit is 4. The complete identifier is therefore 38164.

If a user enters 38194, the recalculated total for the first four digits is 47, so the expected check digit is 7. The supplied final digit is 4, so the entry fails.

Common misconception: A check digit does not prove that the identifier belongs to the correct item. It only checks whether the digits are consistent with the calculation.
Exam tip: For this syllabus, treat the check digit as a validation method. State that the system recalculates and compares it.

Verification During Data Entry

Visual check

The entered value is displayed and compared with the original source. A person identifies and corrects any difference.

Visual check: comparing displayed entered data with the source or intended value.

Double entry

The same data is entered independently for a second time. The computer compares the two entries. If they differ, the user must correct or repeat the input.

Double entry: entering the same data twice and comparing the two versions for agreement.
Method Example Strength Limitation
Visual check A volunteer compares the displayed name with a signed paper form. Useful for many different kinds of field. A person may overlook the difference.
Double entry An email address is typed twice and the system compares both versions. Automatically detects disagreement between the entries. The same mistake could be made twice.
Common misconception: Verification does not prove that the source data is true. It checks whether the source or intended value was transferred into the system as expected.

Worked Example: Designing Checks for an Entry Form

Scenario

A regional robotics event records a team name, division code, number of team members, supervisor email, and school identifier.

Field Rule Suitable check Reason
Team name Must not be empty Presence check A record cannot be identified without a name.
Division code Must be one of JR, INT, or ADV Existence check The value must occur in the stored list of divisions.
Team members From 3 to 7 inclusive Range check Both a minimum and maximum apply.
Supervisor email Must be entered twice Double-entry verification The two entries can be compared for agreement.
School identifier Four base digits plus a calculated final digit Check-digit validation A recalculation can detect some entry errors.
Model structure: identify the field rule, name the check, then explain why that check detects an unsuitable or mismatched entry.

Interactive: Data Entry Check Simulator

Choose an input situation and select the check that most directly detects the problem. The flow display shows the value, the chosen method, and the expected outcome.

Entered data Age = 21
β†’
Selected check No check selected
β†’
Outcome Choose a check

Select one check

Match the method to the exact rule or comparison required by the scenario.

Match confidence: 0%

Common Mistakes and Misconceptions

  • Claiming that validation guarantees accuracy.
  • Confusing a range check, which uses two boundaries, with a limit check, which uses one.
  • Confusing presence with existence.
  • Using length check when the important rule is the pattern of characters.
  • Classifying visual checking or double entry as validation.
  • Assuming double entry cannot repeat the same mistake twice.
  • Calling a check digit a checksum; checksums belong to transfer checking in the next section.

Practice

Try these original questions

  1. Explain one difference between validation and verification.
  2. A field accepts temperatures from βˆ’12Β°C to 46Β°C. Name and describe the most suitable check.
  3. A lift booking permits a maximum load of 850 kg. Name and describe the most suitable check.
  4. A specimen code must follow the pattern AAA-9999. Explain how a format check would be used.
  5. Explain the difference between a presence check and an existence check.
  6. Describe how a check digit can detect an incorrectly entered identifier.
  7. Explain how a visual check could be applied when transferring data from a paper survey.
  8. Describe double-entry verification and give one limitation.
  9. A value of 15 passes an age range of 12 to 17, but the person is actually 19. Explain why validation did not protect data integrity in this case.
  10. Design suitable entry checks for a music festival form containing a stage code, performer count, required contact name, and ticket batch identifier.

Review

Method Strong recall statement
Range check Tests a value against both a minimum and maximum.
Limit check Tests a value against one upper or lower boundary.
Format check Tests whether characters follow a required pattern.
Length check Tests the number of characters.
Presence check Tests whether a required field is empty.
Existence check Tests whether a value occurs in a stored valid list or table.
Check digit Recalculates a digit from the rest of an identifier and compares the result.
Visual check Compares displayed entered data with the source.
Double entry Enters data twice and compares the two versions.
Final exam tip: Use the structure field rule β†’ named check β†’ comparison performed β†’ accept or reject.