Skip to content
MathsGenie logo
Open app

Course home

  1. GCSE
  2. Computer Science Edexcel
  3. Question bank

Computational thinking

EasyMediumHard
12345678910111213141516171819202122232425262728293031323334353637
Question 31

An algorithm is used to calculate the delivery cost of a courier parcel based on its weight in kilograms.

10 SEND "Parcel Courier Service" TO DISPLAY
11 SEND "Enter weight of parcel in kg:" TO DISPLAY
12 RECEIVE weight FROM (INTEGER) KEYBOARD
13 SEND "Calculating cost for " & weight & " kg" TO DISPLAY
14
15 IF (weight > 12) THEN
16     SET cost TO 35 + (3 * (weight - 12))
17 ELSE
18     IF (weight > 7) THEN
19         SET cost TO 35
20     ELSE
21         IF (weight > 3) THEN
22             SET cost TO 22
23         ELSE
24             SET cost TO 10
25         END IF
26     END IF
27 END IF
28
29 SEND "Total Cost: £" & cost TO DISPLAY

Complete the table to show the final output displayed by line 29 of the algorithm for each given input.

InputOutput
16
3
7
[3]

Computational thinking Questions

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