Worked solution from the Algorithm Design and Problem-solving Paper 2 Problem-solving and Programming booklet, Part 2 of 2.
Draw the boxes in this order, joined by arrows from START to END. Use a parallelogram for inputs and outputs, a rectangle for processes and a diamond for the decision.
START
→ OUTPUT "Enter a character" and INPUT MyChar
→ OUTPUT "Enter a count" and INPUT MyCount
→ Set MyString to "" (empty string)
→ Diamond: Is MyCount > 0 ?
YES → Set MyString to MyString & MyChar
→ Set MyCount to MyCount - 1
→ arrow back to the diamond
NO → OUTPUT MyString
→ ENDBoth prompts drawn [1]
Both inputs, using the names MyChar and MyCount [1]
MyString set to empty before the loop and output after the loop [1]
Loop that repeats MyCount times, with MyCount reduced by 1 each time [1]
Joining MyChar onto MyString inside the loop (with &) is a fifth point that also scores, but the most you can score is 4, so any four of the five points score.
DECLARE StartDate : DATE StartDate ← SETDATE(15, 11, 2005)
Declaration with type DATE [1]
Use of the function SETDATE [1]
Parameters in the order day, month, year: (15, 11, 2005) [1]
▶ Starts at Q2 (10:45)
Starts at Q2 (10:45) · by Pseudocode Pro. Tap the picture to open it on YouTube.
Solutions follow the official Cambridge mark schemes; marks are shown in grey. Videos are from other YouTube channels. Paper codes read component / series / year: M/J = May/June, O/N = October/November. Past-paper questions © UCLES, reproduced for classroom practice.