Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.
Shade in the A or B circle for each question.
Draw a line connecting each item on the left to its match on the right.
| Left column | Right column | |
|---|---|---|
| 1mystery(4) -> 16, mystery(5) -> 25, mystery(-3) -> 9 | A# 3 tests fit n * 2, but I did not test negatives | |
| 2mystery(0), mystery(-1), mystery(1000) | BInformative inputs: a zero, a negative and a large value that test edge cases and reveal the limits of the behaviour. | |
| 3Record each chosen input and the output it produced in a table, so you can look for a pattern. | COne test result is used to claim a rule that holds for all inputs. Squaring also gives 4 from 2, so more varied inputs are needed. | |
| 4Infer the process from the pattern, but state the limit: you only know the inputs you tried. | DThree small positive inputs are claimed to prove behaviour for every number. The evidence only covers the inputs tried, so zero, negatives and large values are untested. | |
| 5mystery(2) -> 4 so mystery always doubles its input | EAn input-output table: the outputs are each input squared, so the process is probably n * n. | |
| 6Tried mystery(1), mystery(2), mystery(3): it is fully tested and correct for every number | F| input | output | | 2 | 8 | | 3 | 27 | |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
black-box testing — Running unfamiliar code with chosen inputs and recording the outputs to infer what it does without reading the source. The evidence only covers the inputs you tried.for x in [0, 1, 5, -2]:
print(x, mystery(x))result = mystery(x)
print(x, "->", result)table = {}
result = mystery(x)
table[x] = resultif mystery(3) == 9 and mystery(5) == 25:
print("Looks like squaring")tested = [1, 2, 5, 10]
if 0 not in tested:
print("Limit: 0 never tested")