2210/23/O/N/20 question 2: worked solution (October/November 2020, paper 23)
Show as plain textHide plain text
Cambridge O Level Computer Science 2210 · 8.1 Programming concepts Worked solution from the Programming Paper 2 Algorithms, Programming and Logic booklet, Part 1 of 3. Q7 2210/23/O/N/20 original Q2 Structured · 12 marks Worked solution (a) Look for each type of statement in the numbered lines. Assignment statement: line 01 (or 02, 08 or 12) [1] Loop: line 03 and/or line 14 (REPEAT … UNTIL) [1] Counting statement: line 08 or 12 [1] Selection statement: line 06 (or 10, 15 or 19) [1] (b) Read what each part of the algorithm should do. Line 02: TooCold starts at 1000. Change to TooCold ← 0 [1] Line 08: the count goes down. Change to TooCold ← TooCold + 1 [1] Line 15: it should be more than 5. Change to IF TooHot > 5 [1] Line 17: INPUT is used to show a message. Change to OUTPUT "Alarm!!" [1] (c) Count the readings that are inside the range with a new counter. Any four of these: Add a new variable, for example InRange [1] Set it to 0 at the start of the algorithm [1] Add an extra IF statement with the test Temperature >= -25 AND Temperature <= -18 [1] If it is true, add 1 to InRange [1] KEY IDEA Counters start at the right value and move the right way, and INPUT reads data while OUTPUT shows it. TOTAL 12 marks Official mark scheme VIDEO ▶ Topic lesson A lesson on this topic · by Mr Bulmer's Learning Zone. Tap the picture to open it on YouTube.