ExamBank Scot · N5 Computing Science question bank · All N5 Computing Science questions
2 marks · Selection and logical operators
State the logical operator in this code. Describe the purpose of the Boolean variable in this code. The program code below protects the rechargeable battery in an electric toothbrush. … Line 67 SET brushstop TO FALSE Line 68 WHILE brushstop = FALSE DO Line 69 Line 70 Line 71 Line 72 Line 73 SET battery TO <percentage of power left> SET temperature TO <temperature of battery> IF battery < 3 OR temperature > 45 THEN SET brushstop TO TRUE END IF Line 74 END WHILE Line 75 <switch toothbrush off> …
OR • to control the loop • to switch the toothbrush off Award 1 mark for any one bullet Do not award a mark for ‘controlling whether the toothbrush is on or off