A smart sorting conveyor belt in a distribution center uses the algorithm shown below to route packages to different sorting zones.
1 category ← USERINPUT
2 IF category = 'express' THEN
3 passes ← 4
4 ELSE IF category = 'standard' THEN
5 passes ← 2
6 ELSE
7 passes ← 0
8 ENDIF
9 FOR i ← 1 TO passes
10 IF i < 3 THEN
11 ROUTE_TO('conveyor_A')
12 ELSE
13 ROUTE_TO('conveyor_B')
14 IF passes > 2 THEN
15 ROUTE_TO('conveyor_C')
16 ENDIF
17 ENDIF
18 ENDFOR
How many times would the subroutine ROUTE_TO be called if the user input is 'express'?
2 subroutine calls
4 subroutine calls
5 subroutine calls
6 subroutine calls
208 exam-style questions on AQA GCSE Computer Science Representing algorithms. Each one has a worked solution and a mark scheme showing where the marks go.