Programming and Software Development: Question 1
Syllabus 12.3
A program validates a student's percentage exam score before storing it. The score must be entered as a whole number in the range 0 to 100 inclusive; any other value must be rejected by the validation check, and the user asked to re-enter it.
Which one of the following is an example of erroneous (abnormal) test data for this validation check?
Show worked solution Hide worked solution
Worked solution
Why option D is correct
Test data is normally chosen from three categories: normal data (an ordinary valid value well inside the accepted range), boundary/extreme data (a valid value sitting exactly on the edge of the accepted range), and erroneous/abnormal data (an invalid value that lies outside the accepted range and must be rejected by the validation check).
The accepted range here is 0 to 100 inclusive. The value 101 lies just outside this range, so it is invalid and must be rejected by the validation check. This makes it erroneous (abnormal) test data.
Why the other options are wrong
- A (0): 0 is the lowest value that must be accepted, so testing with 0 checks the lower edge of the accepted range. This is boundary/extreme test data, not erroneous, because 0 is a valid value that the validation check must accept.
- C (100): by the same reasoning, 100 is the highest valid value, testing the upper edge of the range. This is also boundary/extreme test data, not erroneous.
- B (55): 55 is an ordinary value comfortably inside the accepted range, with nothing special about its position. This is normal test data, not erroneous.
Final answer
- D (101). The only value listed that lies outside the accepted range 0 to 100, so it must be rejected by the validation check, making it erroneous (abnormal) test data. Options A and C (0 and 100) are boundary/extreme test data, valid values at the edges of the range; option B (55) is normal test data, an ordinary valid value.