Boundary test data

Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.

Boundary test data

Name:
Date:
Class:

Quick Questions

Shade in the A or B circle for each question.

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
2. For the range 0 to 120, which pair of values tests the bottom limit?
A 0 and -1
B 0 and 1
3. For the range 0 to 120, which pair of values tests the top limit?
A 119 and 120
B 120 and 121
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
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

Match the Pairs

Draw a line connecting each item on the left to its match on the right.

Left columnRight column
10 and -1 AThese values are far outside the range. Boundary data uses the values right next to the limits, -1 and 121, along with 0 and 120.
2120 and 121 BTest 120 (accept) and 121 (reject)
3Boundary data checks that the upper limit is coded correctly, so a test needs a pair of values either side of it CThe boundary pair at the top of a range 0 to 120: the largest accepted value and the nearest rejected value above it
4Boundary data checks that the lower limit is coded correctly, such as catching a program that wrongly uses > 0 instead of >= 0 DThese are only accepted values and no rejected values are included. Boundary data needs the nearest rejected values too, -1 and 121.
5Boundary test data for 0 to 120: 0, 60, 120 ETest 0 (accept) and -1 (reject)
6Boundary test data for 0 to 120: -50, 200 FThe boundary pair at the bottom of a range 0 to 120: the smallest accepted value and the nearest rejected value below it

Definitions

Boundary test data

Fill in the Blanks

Complete each line of code by filling in the missing parts.

1.
// Range 0 to 120: smallest accepted value TestAge ← _
2.
// Range 0 to 120: nearest rejected below TestAge ← __
3.
// Range 0 to 120: largest accepted value TestAge ← ___
4.
// Range 0 to 120: nearest rejected above TestAge ← ___
5.
IF TestAge >= 0 AND TestAge __ 120 THEN OUTPUT "Accepted" ENDIF

Spot the Error

Shade in the letter of the line that contains an error.

Question 1
A // Range check 0 to 120
B Accept: 1 and 119
C Reject: -1 and 121
Question 2
A // Test the bottom limit
B Accepted boundary: 0
C Rejected boundary: 1
Question 3
A // Test the top limit
B Accepted boundary: 119
C Rejected boundary: 121
Question 4
A REPEAT
B INPUT Age
C UNTIL Age >= 0 AND Age < 120
D OUTPUT Age
Question 5
A Each limit needs one value
B One is accepted at the limit
C One is rejected just beyond

Answer Key

Boundary test data
Section A: Quick Questions
Q1
A — -1, 0, 120, 121
Q2
A — 0 and -1
Q3
B — 120 and 121
Q4
B — To check the program rejects the nearest invalid value above the limit
Q5
A — Entering 120, which should be accepted but is rejected
Section B: Match the Pairs
Q1
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
Q2
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
Q3
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)
Q4
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)
Q5
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.
Q6
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.
Section C: Definitions
Q1
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.
Section D: Fill in the Blanks
Q1
// Range 0 to 120: smallest accepted value TestAge ← 0
Q2
// Range 0 to 120: nearest rejected below TestAge ← -1
Q3
// Range 0 to 120: largest accepted value TestAge ← 120
Q4
// Range 0 to 120: nearest rejected above TestAge ← 121
Q5
IF TestAge >= 0 AND TestAge <= 120 THEN OUTPUT "Accepted" ENDIF
Section E: Spot the Error
Q1
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.
Q2
C — 1 is inside the range 0 to 120, so it is accepted. The rejected boundary value just below the bottom limit is -1.
Q3
B — The accepted boundary at the top is the largest valid value, 120. 119 is valid but it is not on the limit.
Q4
C — With < the valid boundary value 120 would be rejected. The test 120 would expose this. The condition should use <= 120.
Q5
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.