Skip to content

Course home

Sign up

Subprograms

EasyMediumHard
123456789101112
Question 1

An algorithm is designed to manage bookings for a local cinema. A section of the pseudocode is shown below:

1  SET rowA TO ["", "", "", "", ""]
2  SET countA TO 0
3  SET rowB TO ["", "", "", "", ""]
4  SET countB TO 0
5
6  FUNCTION bookSeat(pRow, pCustomer)
7      DECLARE success AS BOOLEAN
8      SET success TO False
9      IF (pRow == "A") THEN
10         IF (countA < 5) THEN
11             SET rowA[countA] TO pCustomer
12             SET countA TO countA + 1
13             SET success TO True
14         END IF
15     ELSE IF (pRow == "B") THEN
16         IF (countB < 5) THEN
17             SET rowB[countB] TO pCustomer
18             SET countB TO countB + 1
19             SET success TO True
20         END IF
21     END IF
22     RETURN success
23 END FUNCTION

State why bookSeat 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