Skip to content

Course home

Sign up

Computational thinking

EasyMediumHard
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
Question 6

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]
Markscheme

Computational thinking Questions

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

Question bank