Skip to content

Course home

Sign up

Computational thinking

EasyMediumHard
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
Question 29

LogiSwift tracks packages and flags them for different delivery regions using their tracking codes.

This is pseudo-code for an algorithm that routes packages based on the first character of their tracking code.

1 IF (code[0] >= "A" AND code[0] <= "H") THEN
2     SEND "Region East" TO DISPLAY
3 ELSE
4     IF (code[0] >= "I" AND code[0] <= "P") THEN
5         SEND "Region West" TO DISPLAY
6     ELSE
7         IF (code[0] >= "Q" AND code[0] <= "Z") THEN
8             SEND "Region South" TO DISPLAY
9         ELSE
10            SEND "Invalid tracking code" TO DISPLAY
11        END IF
12    END IF
13 END IF

Complete the table below to show the output of the algorithm for the given inputs.

Tracking CodeOutput displayed
MD9921X
ZJ3847Y
5B8394A
[3]
Markscheme

Computational thinking Questions

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

Question bank