Testing: IB Computer Science practice
Normal, boundary and erroneous data. 10 questions in the style of the IB Computer Science exam.
Sample questions
A program accepts ages from 13 to 19 inclusive. Which of these is boundary test data?
- 15
- 19
- "abc"
- 50
This code tests a validation function with some test data. What does it print?
def valid_mark(m):
return 0 <= m <= 50
for test in [25, 0, 50, 51, -1]:
print(test, valid_mark(test))A loop that should add up a list gives the wrong total. Which debugging technique would best show how the total changes on each pass?
- Add a print statement inside the loop showing the loop variable and the total
- Rename the variables to shorter names
- Add a comment above the loop
- Run the program again with the same input and hope it changes