Validate data with range and type checks
Reject values that fall outside allowed limits or do not have the required data type.
Exam scope and assessment notes
This sequence follows Cambridge IGCSE Computer Science 0984, 2026–2028 syllabus Version 4. It covers subject content Topic 7 only. The separately published 2029–2031 syllabus is not mapped here. Practice is original, self-checked and does not award an official Cambridge grade. Full timed papers and human subject-teacher review remain outstanding. Cambridge states that 0984 has the same 2026–2028 subject content as 0478, with 9–1 grading. In June and November, Cambridge lists 0984 in Administrative zone 3 and for centres in Oman and the UAE. Confirm availability for your centre and exam series with Cambridge International. The separately published 2029–2031 syllabus changes to Python 3 only and removes pseudocode; this 2026–2028 route does not cover those changes.
Before you begin
- No programming language is required. Be comfortable with place value and multiplication; each lesson introduces the computer-science notation it uses.
Work on paper. Try each question before revealing help, and explain why your method works.
Quick readiness check
Which check tests whether input is an integer?
What you will learn
- Explain range validation
- Explain type validation
- Choose a suitable check for a requirement
Validation checks input acceptability
A range check tests whether a value lies between permitted limits, such as a mark from 0 to 100 inclusive. It does not prove the value is true; a mistaken but in-range mark may still pass.
Apply and check the rule
A type check tests whether the input has the required data type, such as an integer rather than text. Validation prevents unsuitable data from being accepted but cannot guarantee that a valid-looking value is accurate.
Pause and explain
A mark must be between 0 and 100. Which validation is needed?
Worked example
A system accepts an age from 0 to 120 as an integer. Name the checks needed.
Show the worked solution
- Check that the value is an integer.
- Check that it is at least 0.
- Check that it is at most 120.
Answer Use a type check for integer and a range check for 0–120 inclusive.
Try a topic test
Choose Easy, Normal or Difficult. Save your answers and open worked review after finishing.
Test this topic →From guided practice to a new situation
Write your answer and reasoning first. Use a hint only if you are stuck. The model solution is for self-checking; your written work is not automatically marked.
A temperature input must be a real number from −50 to 60. State the checks.
Give me a hint
Check type and both inclusive bounds.
Compare my reasoning
- Type must be real/numeric.
- Value must be >= −50.
- Value must be <= 60.
Use a numeric type check and range check −50 <= Temperature <= 60.
Look for these in your work
- Type
- Lower bound
- Upper bound
A code expects a whole number of books but accepts the text “five”. Why is that a type problem even though the meaning is understandable?
Give me a hint
The program's operations depend on a defined data type.
Compare my reasoning
- The input is text, not an integer.
- Arithmetic or comparison rules may not handle it as a count.
- Require an integer or explicitly convert recognised number words.
The value has the wrong type for a numeric count. Require an integer or implement an explicit conversion before processing.
Look for these in your work
- Type mismatch
- Operational risk
- Suitable correction
A mark of 85 passes the range check 0–100 but belongs to another student. Explain what range validation proves and which separate method could detect the mix-up.
Give me a hint
Validation and verification answer different questions.
Compare my reasoning
- The range check proves only that 85 is an allowed value.
- It does not prove the mark belongs to this student.
- Compare with the original record using verification.
Range validation shows the value is within limits, not that it is assigned correctly. Verify the entered mark against the source record.
Look for these in your work
- Range result
- Accuracy limitation
- Verification
Common mistakes
- Calling range validation proof that a value is correct
- Using a type check when the requirement concerns size or boundaries
What can you explain now?
What does a range check test?
Compare with the explanation
Whether a value is within allowed limits
It compares the value with minimum and maximum bounds.
After trying it yourself, choose your next review. This is your self-assessment.
Your review choice appears on Today. Sign in to sync it across devices.
Make it stick
How do range and type checks differ, and what can neither prove?
If you needed the solution, close it and solve the problem again from a blank page. A correct answer is stronger when you can explain the reason for each step.