Test it properly
Answers are for parents and teachers.
1
A program accepts whole numbers from 10 to 50 inclusive. Say whether each value is normal, invalid or extreme (some are two kinds): 10, 30, 9, 50, 51.
10 is normal and extreme. 30 is normal. 9 is invalid. 50 is normal and extreme. 51 is invalid.
2
A music player accepts a volume from 0 to 10 inclusive. Make a table of six tests. For each one, give the kind of data, the number typed and the message that should appear: Volume set or Volume not allowed.
For example: normal 5 gives Volume set. Normal 8 gives Volume set. Extreme 0 gives Volume set. Extreme 10 gives Volume set. Invalid −1 gives Volume not allowed. Invalid 11 gives Volume not allowed.
3
Say whether each error is a syntax error or a logic error: (a) a missing quotation mark in a print line; (b) using + instead of − in a change calculation; (c) writing else if instead of elif; (d) testing age > 12 when 12 should be allowed.
(a) syntax. (b) logic. (c) syntax. (d) logic.
4
This program should print Big for any number above 60. It has one syntax error and one logic error. Find both and correct the program.
Python
1number = int(input("Number? ")) 2if number >= 60 3 print("Big")
The syntax error is the missing colon after the if condition. The logic error is that the comparison is >= 60, but the requirement says above 60, so it must be > 60. Corrected: if number > 60: / print("Big").
5
Explain the difference between extreme data and boundary data. Use the range 3 to 9 to give examples.
Extreme data: 3 and 9, the lowest and highest values the program accepts. Boundary data adds the rejected neighbours: 2, 3, 9 and 10.