12Medium
0/3

An algorithm that determines a parcel's shipping category based on its weight is shown below.

1 SET parcelWeight TO 12.5
2
3 IF (parcelWeight >= 20.0) THEN
4     SEND "Heavy" TO DISPLAY
5 END IF
6 IF (parcelWeight >= 10.0) AND (parcelWeight < 20.0) THEN
7     SEND "Medium" TO DISPLAY
8 END IF
9 IF (parcelWeight >= 5.0) AND (parcelWeight < 10.0) THEN
10    SEND "Light" TO DISPLAY
11 END IF
12 IF (parcelWeight < 5.0) THEN
13    SEND "Eco" TO DISPLAY
14 END IF

The use of multiple independent selection statements in this algorithm is inefficient.

Explain how the algorithm should be amended to address this inefficiency.

[3]
PreviousNext

Computational thinking Questions

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