9618/21/O/N/23 question 2: worked solution (October/November 2023, paper 21)

Show as plain text

Cambridge AS Level Computer Science 9618 · 9.2 Algorithms Worked solution from the Algorithm Design and Problem-solving Paper 2 Problem-solving and Programming booklet, Part 2 of 2. Q30 9618/21/O/N/23 original Q2 Structured · 7 marks Worked solution (a) Write five short steps in plain words, in the right order. Do not use pseudocode. Step 1: set the total to zero [1] Step 2: input a number [1] Step 3: check whether the number is between 30 and 70 inclusive (greater than 29 and less than 71) [1] Step 4: if it is, add the number to the total [1] Step 5: repeat steps 2 to 4 until 100 numbers have been input, then output the total [1] Another way to score: give the repeat step and the output step as two separate steps (any five of the points earn the marks). (b) Name the two constructs besides sequence. Iteration (a count-controlled loop) [1] Selection (an IF statement) [1] KEY IDEA Break the problem into small ordered steps: set up, input, test, add, repeat, then output. TOTAL 7 marks Official mark scheme VIDEO ▶ Starts at Q2 (9:40) Starts at Q2 (9:40) · by Pseudocode Pro. Tap the picture to open it on YouTube.