Subprograms

EasyMediumHard
123456789101112
Question 9
Easy

An algorithm is designed to log temperature data for a weather station. A section of the pseudocode is shown below:

1  SET readings TO [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
2  SET index TO 0
3  SET limit TO 6
4
5  FUNCTION recordReading(pValue)
6      DECLARE written AS BOOLEAN
7      SET written TO False
8      IF (index < limit) THEN
9          SET readings[index] TO pValue
10         SET index TO index + 1
11         SET written TO True
12     END IF
13     RETURN written
14 END FUNCTION

State why recordReading is classified as a function rather than a procedure.

[1]

Subprograms Questions

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