2210/22/O/N/25 question 5: worked solution (October/November 2025, paper 22)

Show as plain text

Cambridge O Level Computer Science 2210 · 7.7 Trace tables Worked solution from the Algorithm design and problem-solving Paper 2 Algorithms, Programming and Logic booklet, Part 6 of 8. Q64 2210/22/O/N/25 original Q5 Structured · 13 marks Worked solution (a) Follow the flowchart one input at a time. 7686 is stored in the first empty place. Face is already in CodeStore [3] . Speed has 5 characters. 432U fills the last place, then Count reaches 7. Code Store Count [1] [2] [3] [4] [5] [6] OUTPUT aBcd 1532 Face 63q8 7686 FALSE 1 2 3 4 TRUE 5 7686 6 Face FALSE 1 2 3 Code used before Speed Length must be 4 432U FALSE 1 2 3 4 5 TRUE 6 432U 7 CodeStore full Code column correct [1] Store column correct [1] Count column correct [1] CodeStore [1] to [4] left unchanged [1] CodeStore [5] = 7686 and CodeStore [6] = 432U [1] OUTPUT column correct (Code used before, Length must be 4, CodeStore full) [1] (b) Write three of these points: It checks that the code input is 4 characters long [1] It checks the code against the codes already in the array to see if it has been used before [1] If it passes the checks, it stores the code in the lowest empty place in the array [1] Also accepted: it checks that the code store is not full and outputs a message when it is full. (c) Declare the array and a counter, then use a loop to set all six places to the empty string. DECLARE CodeStore : ARRAY[1:6] OF STRING DECLARE Index : INTEGER FOR Index ← 1 TO 6 CodeStore[Index] ← "" NEXT Index Array declared with the correct name and data type [1] Loop counter declared [1] A loop that runs six times [1] Every element set to "" using the counter as the index [1] Any type of loop is accepted. KEY IDEA Trace a flowchart one box at a time, and use a loop with a counter to set up every element of an array. TOTAL 13 marks Official mark scheme VIDEO ▶ Whole paper Video solution of the whole paper · by MAK CS. Tap the picture to open it on YouTube.