Pearson Edexcel · GCSE · Computer Science
Course version: 1CP2 · Version from Sept 2020
Understand the need for and be able to write programs that implement…
Full specification wording
Input/output: 6.4.3 understand the need for and be able to write programs that implement validation (length check, presence check, range check, pattern check)
Validation checks that data entered into a program is sensible and complete before it is processed.
Checked against the Pearson Edexcel 1CP2 specification (opens in a new tab) on .
- Point 1 of 2
- 4 key terms
Study notes
From the checked teaching notes for this specification point.
The idea
Validation checks that data entered into a program is sensible and complete before it is processed. It cannot prove data is true, only that it meets rules. A length check confirms a string has an allowed number of characters, such as a username between 4 and 12 characters. A presence check confirms a field is not empty, for example rejecting a blank email box. A range check confirms a number or ordered value lies between limits, such as a test score from 0 to 100. A pattern check confirms text matches a required format, such as a postcode or a date in DD/MM/YYYY form. Programs implement these with selection and iteration: read input, test the condition, and if it fails, display a message and ask again until valid. This protects later stages from missing, out-of-range or wrongly formatted data.
What earns the marks
- Validation checks that input is sensible, complete and within allowed rules; it does not prove the data is accurate or true.
- A length check tests the number of characters in a string against a minimum, maximum or exact length.
- A presence check tests that a required field has not been left empty.
- A range check tests that a value lies between a lower and an upper limit, inclusive or exclusive as specified.
- A pattern check tests that text matches a required format, such as a postcode or date layout.
- Programs implement validation using selection and iteration so invalid input is rejected and the user is prompted to re-enter.
Common mistakes and how to put them right
Confusing validation with verification.
Put it right by stating that validation cannot confirm a value is true.
Treating a presence check as a length check.
Put it right by matching each check to the rule it enforces.
Assuming a range check applies only to numbers.
Put it right by describing it as testing whether a value lies between limits.
Writing a pattern check as a simple equality test.
Put it right by describing it as testing the structure of the input.
Exam tips
- Read the scenario and name the check that matches the rule, then state the condition the program must test.
- When asked to write code, include a loop that repeats until the input passes the check, and show the error message path.
- Use precise terms: length, presence, range and pattern, and avoid saying validation proves data is correct.
Try the lesson
The start of the Input/output: 6.4.3 understand the need for and be able to write programs that implement validation (length check, presence check, range check, pattern check) lesson, made from checked teaching notes for this specification point.
Have a go first
A registration form requires an email address. The program must reject the input if the user submits the field with no characters entered at all. Which type of validation check does this describe?
Listen
Validation checks that data entered into a program is sensible and complete before it is processed. It cannot prove data is true, only that it meets rules. A length check confirms a string has an allowed number of characters, such as a username between 4 and 12 characters. A presence check confirms a field is not empty, for example rejecting a blank email box. A range check confirms a number or ordered value lies between limits, such as a test score from 0 to 100. A pattern check confirms text matches a required format, such as a postcode or a date in DD/MM/YYYY form. Programs implement these with selection and iteration: read input, test the condition, and if it fails, display a message and ask again until valid. This protects later stages from missing, out-of-range or wrongly formatted data. A strong answer earns marks for these points. Validation checks that input is sensible, complete and within allowed rules; it does not prove the data is accurate or true. A length check tests the number of characters in a string against a minimum, maximum or exact length. A presence check tests that a required field has not been left empty. A range check tests that a value lies between a lower and an upper limit, inclusive or exclusive as specified. A common slip: Confusing validation with verification: validation checks that data is sensible against rules, while verification checks that data has been copied or entered accurately. Instead, stating that validation cannot confirm a value is true. Exam tip: Read the scenario and name the check that matches the rule, then state the condition the program must test.
See it
Key words
Say what each word means before you turn the card.
Data validation
Try answering aloud or in your head before turning the card.
Length check
Try answering aloud or in your head before turning the card.
Presence check
Try answering aloud or in your head before turning the card.
Range check
Try answering aloud or in your head before turning the card.
See every definition
- Data validation
- Checks that data entered into a program is sensible and complete before it is processed, though it cannot prove the data is true.
- Length check
- Confirms a string has an allowed number of characters, such as a username between 4 and 12 characters.
- Presence check
- Confirms a field is not empty, for example rejecting a blank email box.
- Range check
- Confirms a number or ordered value lies between limits, such as a test score from 0 to 100.
Label the diagram
Some boxes have lost their names. Pick the right name for each number.
1Box 1
2Box 2
3Box 3
There is more to this lesson
The full lesson goes on to check your understanding and help you earn the marks. Create a free account to carry on, with your progress saved.
A week of Premium from your first lesson · Then the free plan continues · No card, no charge
Test your understanding of Input/output: 6.4.3 understand the need for and be able to write programs that implement validation (length check, presence check, range check, pattern check)
Active recall beats re-reading. Take an instant quiz now to test what you’ve learned and lock it into long-term memory.
A week of Premium from your first lesson · Then the free plan continues · No card, no charge