Question 2(b) 2020 · October-November · Paper 23 · 4 marks
Reveal official mark-scheme answer
Official answer for Question 2
Part (b)
Question 4
Show text version of question
Question 2
Part (b)
Question 2
An algorithm has been written in pseudocode to check the temperature readings taken from a
freezer are within the range –18 degrees to –25 degrees inclusive.
The algorithm counts the number of times that the temperature reading is below –25 degrees and the number of times that the temperature reading is above –18 degrees.
An engineer is called if there are more than 10 temperature readings below –25 degrees.
An alarm sounds if there are more than 5 temperature readings above –18 degrees.
01 TooHot 0 02 TooCold 1000 03 REPEAT 04 OUTPUT "Please enter temperature" 05 INPUT Temperature 06 IF Temperature < -25 07 THEN 08 TooCold TooCold – 1 09 ENDIF 10 IF Temperature > -18 11 THEN 12 TooHot TooHot + 1 13 ENDIF 14 UNTIL TooHot > 5 OR TooCold > 10 15 IF TooHot < 5 16 THEN 17 INPUT "Alarm!!" 18 ENDIF 19 IF TooCold > 10 20 THEN 21 OUTPUT "Call the Engineer" 22 ENDIF
Part (b)
Give line numbers where the four errors are to be found in the pseudocode. Suggest a
correction for each error.
Error 1 line number ...................................................................................................................
Correction .................................................................................................................................
...................................................................................................................................................
Error 2 line number ...................................................................................................................
Correction .................................................................................................................................
...................................................................................................................................................
Error 3 line number ...................................................................................................................
Correction .................................................................................................................................
...................................................................................................................................................
Error 4 line number ...................................................................................................................
Correction .................................................................................................................................
...................................................................................................................................................
Why this question appears here
98% assigned-topic match · Algorithm design and problem-solving
Topic-match percentages estimate how closely each question fits the selected syllabus topic. They are a guide for choosing stricter or broader practice.
Permanent source page: Educate A Change · From 2210_w20_qp_23.pdf
