Skip to content

Course home

Sign up

Computational thinking

EasyMediumHard
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
Question 34

An algorithm designed to monitor the safety status of a chemical reactor based on its core temperature is shown below.

1 SET reactorTemp TO 112.4
2
3 IF (reactorTemp >= 150.0) THEN
4     SEND "Critical" TO DISPLAY
5 END IF
6 IF (reactorTemp >= 100.0) AND (reactorTemp < 150.0) THEN
7     SEND "High" TO DISPLAY
8 END IF
9 IF (reactorTemp >= 50.0) AND (reactorTemp < 100.0) THEN
10    SEND "Normal" TO DISPLAY
11 END IF
12 IF (reactorTemp < 50.0) THEN
13    SEND "Low" TO DISPLAY
14 END IF

The programmer notes that using consecutive, independent selection statements makes this algorithm highly inefficient.

Explain how the structure and conditions of this algorithm should be modified to resolve these inefficiencies.

[3]
Markscheme

Computational thinking Questions

  1. GCSE
  2. /Computer Science
  3. /Computational thinking

Question bank