← IGCSE Computer Science Paper 2

Boundary test data

The largest and smallest acceptable values plus the nearest rejected values either side of each limit, e.g. 0 and -1, 120 and 121 for a range of 0 to 120.

Understanding Boundary test data in IGCSE Computer Science Paper 2

What it does: One value on each side of the upper limit shows whether the program accepts 120 but rejects 121. The bottom boundary pair is the smallest accepted value (0) and the nearest rejected value (-1). 1 is also accepted, so it does not test the limit. Boundary data checks that the limits are in the right place, for example that <= and < have not been mixed up. The test must include -1 and 121 as well as 0 and 120, so both sides of each limit are checked.

Common mistakes: The boundary values accepted are the smallest and largest valid values, 0 and 120. 1 and 119 are inside the range, not on its limits. 1 is inside the range 0 to 120, so it is accepted. The rejected boundary value just below the bottom limit is -1.

Class: _____________________  ·  Name: _____________________  ·  Date: _________

Free printable worksheet with full answer key — or add this module to a class and your students practise it interactively.

This module's key terms are also in a printable crossword (Modules 71–82) and word search (Modules 71–92).

Take this worksheet further — free with Cloodit

Each concept is reinforced from every angle — learned, then applied, then tested.

Learning
Duo
An age field accepts whole numbers from 0 to 120. Which set is boundary test data for this range?
-1, 0, 120, 1210, 60, 120, 200
Matches
Boundary test data for 0 to 120: 0, 60, 120
↓
These are only accepted values and no rejected values are included. Boundary data needs the nearest rejected values too, -1 and 121.
Applying
Meanings
Term
Boundary test data
Meaning
The largest and smallest acceptable values plus the nearest rejected values either side of each limit, e.g. 0 and -1, 120 and 121 for a range of 0 to 120.
Practice
// Boundary data: 0 and 120 pass, -1 and 121 fail
Testing
Gaps
TestAge ←
Check Answer
Spots
1// Range check 0 to 120
2Accept: 1 and 119

Cloodit turns curriculum-aligned coding content into journeys students work through one biome at a time.

The 'Sea Dragon' badge — OOP Pioneer, one of Cloodit's 106 collectible badges
Students earn collectable badges

Over 100 of them, across seven natural biomes.

Study Buddy
Students build a real study resource

Turns their work into revision material ready for Flash Cards and Exam study.

Diamond Dash — one of Cloodit's live, competitive Sprint games
Students lock in with Sprints

Live, competitive practice for the start of the lesson or a teacher-led lesson finisher.

A Cloodit certificate of achievement, ready to personalise and print
Custom printable certificates

Honour your top performers, or encourage a student who's trying hard — ready to print in seconds.

Quick Questions

1. An age field accepts whole numbers from 0 to 120. Which set is boundary test data for this range?
A. -1, 0, 120, 121 ✓
B. 0, 60, 120, 200
Boundary test data uses the smallest and largest acceptable values (0 and 120) plus the nearest rejected value beyond each limit (-1 and 121).
2. For the range 0 to 120, which pair of values tests the bottom limit?
A. 0 and -1 ✓
B. 0 and 1
The bottom boundary pair is the smallest accepted value (0) and the nearest rejected value (-1). 1 is also accepted, so it does not test the limit.
3. For the range 0 to 120, which pair of values tests the top limit?
A. 119 and 120
B. 120 and 121 ✓
The top boundary pair is the largest accepted value (120) and the nearest rejected value (121). 119 and 120 are both accepted, so neither one is rejected.
4. Why do we test 121 as well as 120 for a range of 0 to 120?
A. To check the program accepts every value above 120
B. To check the program rejects the nearest invalid value above the limit ✓
121 should be rejected. Testing it shows the upper limit is coded correctly and not set too high.
5. A programmer wrongly codes the check as age < 120 instead of age <= 120. Which boundary test would show the error?
A. Entering 120, which should be accepted but is rejected ✓
B. Entering 60, which should be accepted and is accepted
The mistake only appears at the limit. 120 should be accepted, but age < 120 rejects it. A value in the middle like 60 passes either way.

Match the Pairs

0 and -1 → The boundary pair at the bottom of a range 0 to 120: the smallest accepted value and the nearest rejected value below it
120 and 121 → The boundary pair at the top of a range 0 to 120: the largest accepted value and the nearest rejected value above it
Boundary data checks that the upper limit is coded correctly, so a test needs a pair of values either side of it → Test 120 (accept) and 121 (reject)
Boundary data checks that the lower limit is coded correctly, such as catching a program that wrongly uses > 0 instead of >= 0 → Test 0 (accept) and -1 (reject)
Boundary test data for 0 to 120: 0, 60, 120 → These are only accepted values and no rejected values are included. Boundary data needs the nearest rejected values too, -1 and 121.
Boundary test data for 0 to 120: -50, 200 → These values are far outside the range. Boundary data uses the values right next to the limits, -1 and 121, along with 0 and 120.

Key Term

Boundary test data
The largest and smallest acceptable values plus the nearest rejected values either side of each limit, e.g. 0 and -1, 120 and 121 for a range of 0 to 120.

Fill in the Blanks

1. // Range 0 to 120: smallest accepted value TestAge ← 0
Hint: Type the lowest value that the range still accepts.
2. // Range 0 to 120: nearest rejected below TestAge ← -1
Hint: Type the whole number just below the lower limit, which the check must reject.
3. // Range 0 to 120: largest accepted value TestAge ← 120
Hint: Type the highest value that the range still accepts.
4. // Range 0 to 120: nearest rejected above TestAge ← 121
Hint: Type the whole number just above the upper limit, which the check must reject.
5. IF TestAge >= 0 AND TestAge <= 120 THEN OUTPUT "Accepted" ENDIF
Hint: Type the relational operator that lets the largest accepted value pass while 121 is still rejected.

Spot the Error

Question 1
A // Range check 0 to 120
B Accept: 1 and 119
C Reject: -1 and 121
Line B — The boundary values accepted are the smallest and largest valid values, 0 and 120. 1 and 119 are inside the range, not on its limits.
Question 2
A // Test the bottom limit
B Accepted boundary: 0
C Rejected boundary: 1
Line C — 1 is inside the range 0 to 120, so it is accepted. The rejected boundary value just below the bottom limit is -1.
Question 3
A // Test the top limit
B Accepted boundary: 119
C Rejected boundary: 121
Line B — The accepted boundary at the top is the largest valid value, 120. 119 is valid but it is not on the limit.
Question 4
A REPEAT
B INPUT Age
C UNTIL Age >= 0 AND Age < 120
D OUTPUT Age
Line C — With < the valid boundary value 120 would be rejected. The test 120 would expose this. The condition should use <= 120.
Question 5
A Each limit needs one value
B One is accepted at the limit
C One is rejected just beyond
Line A — Boundary data uses a pair at each limit: the accepted value on the limit and the nearest rejected value beyond it. One value cannot show where the limit is.

Student with a class code? Join your class →