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 | |
|---|---|---|
| 1Test 1: input 15, expect "Pass" Test 2: input 3, expect "Try again" | AA test case for each path of an IF ... ELSE, so both the THEN path and the ELSE path get checked | |
| 2Test: REPEAT count times, count = 0 Expect: loop body never runs | BExpected: 10 Actual: 8 Result: FAIL | |
| 3Comparing expected and actual results: if they do not match, the algorithm has a mistake to fix | CThe loop is never tested with a start value of 0, so we do not know if it correctly runs zero times. Add a test with n = 0. | |
| 4A test for every path: pick starting values so each branch of the decision is used | DIF score >= 50 THEN Test with score = 70 ELSE Test with score = 20 | |
| 5IF age >= 12 THEN ... ELSE ... Test: age = 15 only | EOnly the THEN path is tested. The ELSE path is never tried, so a mistake there would be missed. Add a test such as age = 8. | |
| 6REPEAT n times Test: n = 5 only Expect: it runs 5 times | FA test case for a loop that runs zero times, to check the steps inside are skipped |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
test case — A chosen starting value you try in an algorithm, with the result you expect. Use one for every path and for a loop that runs zero times, then compare expected and actual results.REPEAT count TIMES
OUTPUT "Hi"
TEST count ← 0, expected: no "Hi"SET expected ← 10
SET actual ← 10
IF actual = expected THEN OUTPUT "Pass"IF temp > 30 THEN OUTPUT "Hot"
ELSE OUTPUT "Mild"
Test temp ← 20 uses the ELSE pathIF n > 0 THEN OUTPUT "Positive"
ELSE OUTPUT "Not positive"
TEST n ← 0, expected "Not positive"FOR EACH test IN testList
IF actual ≠ expected THEN
OUTPUT "Fix the algorithm"