📁 Topic 2 · 2.4 Input and Output
2.4a Input, output and validation
Edexcel 4CP0 · iGCSE Computer Science · ~12 min read
Notes
──
Video
──
Slides
──
Worksheet
──
Quiz

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 typeDescriptionExample
Range checkChecks if value falls within an acceptable minimum and maximumAge must be between 0 and 120
Type checkChecks the data is the correct data typeScore must be an integer, not a string
Presence checkChecks that a field has not been left emptyName field cannot be blank
Length checkChecks a string is within an acceptable lengthPassword must be 8–20 characters
Format checkChecks data matches a required pattern or formatPostcode 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

ConceptDefinitionExample
ValidationChecking data is reasonable/within acceptable limits (done by the program)Age must be 0–120
VerificationChecking 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
← 2.3c String Manipulation Topic 2 · 2.4 Input and Output Next: 2.4b File Handling →
🔒
Pro Content
Subscribe to access all 47 Edexcel iGCSE lessons.
£7.99/month
or £59/year