Test it properly
Answers are for parents and teachers.
1
Trace this program and say what is printed.
Python
1n = 2 2if n > 1: 3 n = n + 5 4if n > 6: 5 n = n - 1 6print(n)
n = 2; 2 > 1 so n = 2 + 5 = 7. Then 7 > 6 is true, so n = 7 - 1 = 6. It prints 6.
2
A game accepts player numbers from 2 to 4. Write one normal value, the boundary values, and one invalid value.
Normal: 3. Boundary: 2 and 4, and the values just outside, 1 and 5. Invalid: the word “three” or 40.
3
A program says Open when hours >= 9 and hours <= 17. It is tested with 17. What is the expected outcome, and what type of test is it?
Open. It is a boundary test, because 17 is the last allowed value.
4
Explain the difference between a prediction and a trace.
A prediction is a quick idea of the result before running. A trace follows the program line by line and records every value, so it is a careful check.
5
A pupil says, “My program passed all my tests, so it is perfect.” What could be wrong?
The tests may have used only normal data. Boundary data and invalid data might find mistakes. A good evaluation also asks whether the program does everything the rules require.