3Easy
0/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]

Subprograms Questions

Practise Edexcel GCSE Computer Science Subprograms with exam-style questions for GCSE Computer Science. 29 questions covering Built-in and user-devised subprograms, Functions versus procedures, and Global and local variables, matched to the Edexcel GCSE Computer Science (1CP2) specification and written in Paper 1 and Paper 2 style. Every question includes a full worked solution and mark scheme, so you can see where marks are awarded rather than just whether you got the answer right.

PreviousNext

Subprograms Questions

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