Skip to content

Course home

Sign up

Computational thinking

EasyMediumHard
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
Question 11

A pseudocode algorithm that monitors weather drone altitude readings is shown below.

The first four inputs read from the file AltitudeLog.txt are 180, 320, 95, and 240 in that order.

Complete the trace table showing the execution of the pseudocode with these four inputs. You may not need to use all the rows in the table.

1 SET altitude TO 0
2 SET min_alt TO 500
3 SET max_alt TO 200
4
5 FOR EACH altitude FROM "AltitudeLog.txt" DO
6     IF (altitude < min_alt) THEN
7         SET min_alt TO altitude
8     ENDIF
9     IF (altitude > max_alt) THEN
10        SET max_alt TO altitude
11    ENDIF
12 END FOREACH
13
14 SEND min_alt & " to " & max_alt TO DISPLAY
altitudemin_altmax_altDisplay
[6]
Markscheme

Computational thinking Questions

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

Question bank