Skip to content

Course home

Sign up

Subprograms

EasyMediumHard
123456789101112
Question 9

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]
Markscheme

Subprograms Questions

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

29 exam-style questions on Edexcel GCSE Computer Science Subprograms, covering Built-in and user-devised subprograms, Functions versus procedures, and Global and local variables. Each one has a worked solution and a mark scheme showing where the marks go.

Question bank