9Medium
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]

Algorithms Questions

Practise Edexcel GCSE Computer Science Algorithms with exam-style questions for GCSE Computer Science. 100 questions covering Constructs for solving problems, Variables, constants and data structures, Arithmetic, relational and logical operators, Tracing algorithm output with trace tables, Types of error and correcting logic errors, Standard algorithms (sorts and searches), and Evaluating algorithm fitness and efficiency, matched to the Edexcel GCSE Computer Science (1CP2) specification and written in Paper 1 and Paper 2 style. Every question includes a full worked solution and mark scheme, so you can see where marks are awarded rather than just whether you got the answer right.

PreviousNext

Algorithms Questions

  1. GCSE
  2. /Computer Science
  3. /Algorithms