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 | |
|---|---|---|
| 1OUTPUT CalcTotal(5, 2.50) | AOnly the faulty subroutine needs fixing. The other tested parts work and do not need to be rewritten. | |
| 2CALL ShowMenu() | BIf it fails, the error could be anywhere in the program, so it is hard to find which part causes it. Test each sub-problem on its own first. | |
| 3A failing test points to one part: if CalcTotal gives the wrong answer, the fault is inside that function only | CFUNCTION CalcTotal(Qty, Price) RETURNS REAL RETURN Qty + Price ENDFUNCTION | |
| 4Fixing a part does not need rewriting everything: only the faulty line in one subroutine is changed | DRETURN Qty * Price | |
| 5Write the whole program, then test it once at the end | ERun one procedure on its own to check it works before the main program uses it | |
| 6CalcTotal gives a wrong answer, so rewrite the whole program from the start | FTest one function alone by calling it with sample values and checking the result against the expected total of 12.50 |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
test each sub-problem separately — Each sub-problem is tested on its own before being joined to the rest, so an error is traced to the part that causes it and only that part needs fixing, not the whole program.FUNCTION Double(n : INTEGER) RETURNS INTEGER
RETURN n * 2
OUTPUT Double(5)expected ← 10
actual ← Double(5)
OUTPUT actual = expectedPROCEDURE ShowTotal(a, b : INTEGER)
OUTPUT a + b
ENDPROCEDUREFUNCTION Add(a, b : INTEGER) RETURNS INTEGER
RETURN a + b
OUTPUT Add(2, 3) // expect 5CALL ReadMark()
CALL CheckMark() // only this is fixed
CALL ShowResult()