Input
In Edexcel 4CP0 pseudocode, input from the user (keyboard) is written as:
RECEIVE variableName FROM KEYBOARD
# Examples
RECEIVE age FROM KEYBOARD
RECEIVE name FROM KEYBOARD
RECEIVE score FROM KEYBOARD
Output
Output to the screen (display) is written as:
SEND value TO DISPLAY
# Examples
SEND "Enter your age:" TO DISPLAY
SEND age TO DISPLAY
SEND "Your name is: " & name TO DISPLAY
Validation
Validation checks that data entered by a user is reasonable, sensible, and within acceptable limits before the program processes it. Note: validation does NOT check that data is correct or accurate — only that it is acceptable.
Types of Validation Check
| Validation type | Description | Example |
| Range check | Checks if value falls within an acceptable minimum and maximum | Age must be between 0 and 120 |
| Type check | Checks the data is the correct data type | Score must be an integer, not a string |
| Presence check | Checks that a field has not been left empty | Name field cannot be blank |
| Length check | Checks a string is within an acceptable length | Password must be 8–20 characters |
| Format check | Checks data matches a required pattern or format | Postcode must follow pattern AA9 9AA |
Validation in Pseudocode
# Range check with a WHILE loop (keep asking until valid)
RECEIVE age FROM KEYBOARD
WHILE age < 0 OR age > 120 DO
SEND "Invalid age. Enter a value between 0 and 120:" TO DISPLAY
RECEIVE age FROM KEYBOARD
END WHILE
# Presence check
RECEIVE name FROM KEYBOARD
WHILE LENGTH(name) = 0 DO
SEND "Name cannot be empty. Please enter your name:" TO DISPLAY
RECEIVE name FROM KEYBOARD
END WHILE
Validation vs Verification
| Concept | Definition | Example |
| Validation | Checking data is reasonable/within acceptable limits (done by the program) | Age must be 0–120 |
| Verification | Checking data was entered accurately (usually done by a human) | Double-keying: enter password twice |
📝 Exam Tip: Validation does NOT guarantee correctness. A student entering age 999 fails a range check (invalid), but entering 17 when they are actually 18 passes all checks yet is wrong. Validation only checks reasonableness, not truth.
⚠️ Common Mistakes
- Confusing validation with verification — validation is automated; verification involves a human check
- Saying validation ensures data is "correct" — it only ensures it is "reasonable"
- Using IF instead of WHILE for validation loops — IF only checks once; WHILE keeps checking until valid