9618/22/M/J/21 question 7: worked solution (May/June 2021, paper 22)
Show as plain textHide plain text
Cambridge AS Level Computer Science 9618 · 12.3 Program Testing and Maintenance Worked solution from the Software Development Paper 2 Problem-solving and Programming booklet, Part 3 of 3. Q34 9618/22/M/J/21 original Q7 Structured · 5 marks Worked solution (a) Black-box testing uses inputs and expected outputs only. One test string should show every requirement, so it needs a space before the first word, a space after the last word, several spaces between words, and capital letters. For example: ∇∇Hello∇∇∇World∇ The string must have all four of these features: at least one leading space , at least one trailing space , multiple spaces between two words and at least one upper case letter. At least one feature present [1] Three features present [1] All four features present [1] (b) Any two of these ways of finding where the assignment is missed: Dry run the code with a trace table, or walk through it, to see when the assignment line is skipped [1] Use a breakpoint (or single-step and watch variables) to see whether FString is set; or add output statements to track the code; or try different test strings to find which ones fail [1] KEY IDEA A good black-box test string contains every special case at once, and a missed assignment is found by tracing or stepping through the code. TOTAL 5 marks Official mark scheme VIDEO ▶ Whole paper Video solution of the whole paper · by Papersdock. Tap the picture to open it on YouTube.