Abnormal test data

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

Abnormal test data

Name:
Date:
Class:

Quick Questions

Shade in the A or B circle for each question.

1. A program accepts an age from 1 to 120. Which value is abnormal test data?
A -5
B 35
2. A program asks for a whole-number age. Which is abnormal test data?
A 17
B abc
3. What should a program do with abnormal test data?
A Reject it
B Accept it
4. A name field must not be left empty. Which input is abnormal test data?
A An empty input
B Maya
5. A mark must be a number from 0 to 100. Which is abnormal test data?
A 70
B seventy

Match the Pairs

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

Left columnRight column
1Age: -5 (allowed range 0 to 120) ATest input: -20 | Expected result: rejected with an error message
2Age: "abc" (a whole number is needed) BTest input: (nothing typed) | Expected result: rejected
3An empty input is abnormal test data, and the expected outcome is that it is rejected C50 is inside the allowed range, so it is normal data and would be accepted. Abnormal data would be a value like -5 or 150.
4Abnormal test data is chosen so that the program should reject it, not accept it DAbnormal data should be rejected. Letters are the wrong type for an age, so the expected result should be rejected, not accepted.
5Age range 0 to 120. Abnormal test data: 50. Expected result: rejected EAbnormal test data: a negative age is outside the allowed values, so the program should reject it
6Abnormal test data: "abc" for an age. Expected result: accepted FAbnormal test data: letters are the wrong data type for a number, so the program should reject them

Definitions

Abnormal test data

Fill in the Blanks

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

1.
Value: -5 for Age (allowed 0 to 120) Test data type: ________
2.
Test value for Age: "cat" Test data type: Abnormal Expected outcome: ________
3.
IF Age < 0 THEN ______ "Rejected" ENDIF
4.
INPUT Age IF LENGTH(Age) = _ THEN OUTPUT "Rejected"
5.
IF Age < 0 __ Age > 120 THEN OUTPUT "Rejected" ENDIF

Spot the Error

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

Question 1
A Field: Age (range 0 to 120)
B Test data: -5
C Type: normal
D Expected: rejected
Question 2
A Field: Age (whole number)
B Test data: abc
C Expected: accepted
D Type: abnormal
Question 3
A INPUT Age
B IF Age < 0 OR Age > 120 THEN
C OUTPUT "Rejected"
D ENDWHILE
Question 4
A INPUT Age
B // Reject below 0 or above 120
C IF Age < 0 AND Age > 120 THEN
D OUTPUT "Rejected"
E ENDIF
Question 5
A INPUT Name
B IF Name <> "" THEN
C OUTPUT "Rejected"
D ENDIF

Answer Key

Abnormal test data
Section A: Quick Questions
Q1
A — -5
Q2
B — abc
Q3
A — Reject it
Q4
A — An empty input
Q5
B — seventy
Section B: Match the Pairs
Q1
Age: -5 (allowed range 0 to 120) → Abnormal test data: a negative age is outside the allowed values, so the program should reject it
Q2
Age: "abc" (a whole number is needed) → Abnormal test data: letters are the wrong data type for a number, so the program should reject them
Q3
An empty input is abnormal test data, and the expected outcome is that it is rejected → Test input: (nothing typed) | Expected result: rejected
Q4
Abnormal test data is chosen so that the program should reject it, not accept it → Test input: -20 | Expected result: rejected with an error message
Q5
Age range 0 to 120. Abnormal test data: 50. Expected result: rejected → 50 is inside the allowed range, so it is normal data and would be accepted. Abnormal data would be a value like -5 or 150.
Q6
Abnormal test data: "abc" for an age. Expected result: accepted → Abnormal data should be rejected. Letters are the wrong type for an age, so the expected result should be rejected, not accepted.
Section C: Definitions
Q1
Abnormal test data — Test data of the wrong type or outside the allowed values, such as -5 or letters for an age, or an empty input. The program should reject it.
Section D: Fill in the Blanks
Q1
Value: -5 for Age (allowed 0 to 120) Test data type: Abnormal
Q2
Test value for Age: "cat" Test data type: Abnormal Expected outcome: Rejected
Q3
IF Age < 0 THEN OUTPUT "Rejected" ENDIF
Q4
INPUT Age IF LENGTH(Age) = 0 THEN OUTPUT "Rejected"
Q5
IF Age < 0 OR Age > 120 THEN OUTPUT "Rejected" ENDIF
Section E: Spot the Error
Q1
C — -5 is outside the allowed range 0 to 120, so it is abnormal test data, not normal. Line 3 should be 'Type: abnormal'.
Q2
C — Letters are the wrong data type for an age, so the program should reject them. Line 3 should be 'Expected: rejected'.
Q3
D — An IF statement must be closed with ENDIF, not ENDWHILE. Line 4 should be ENDIF.
Q4
C — No number can be both below 0 and above 120, so AND would never reject abnormal data like -5. It should use OR.
Q5
B — Abnormal data here is an empty input, so the condition must test for an empty string with =, not <>. Line 2 should be IF Name = "" THEN.