Structured programming and subroutines (procedures and functions)

EasyMediumHard
123456789101112131415161718192021222324252627282930313233343536373839404142
Question 4
Easy

State the value that is returned by the following subroutine call:

VerifyGatePass('PASS81', 4)

Figure 1

1      SUBROUTINE VerifyGatePass(passID, gateNumber)
2          passes ← ['PASS22', 'PASS45', 'PASS81', 'PASS99']
3          gates ← [4, 7, 2, 9]
4          i ← 0
5          authorized ← false
6          WHILE i < 4
7              IF passID = passes[i] THEN
8                  IF gateNumber = gates[i] THEN
9                      authorized ← true
10                 ENDIF
11             ENDIF
12             i ← i + 1
13         ENDWHILE
14         RETURN authorized
15     ENDSUBROUTINE
[2]

Structured programming and subroutines (procedures and functions) Questions

  1. GCSE
  2. /Computer Science
  3. /Structured programming and subroutines (procedures and functions)