Concert venues are selected based on the size of the audience booking.
The algorithm below, written in pseudocode, is designed to identify the first available hall capacity that can accommodate a target booking size.
There is an error on line 6.
1 SET hallCapacity TO [100, 250, 500, 1000]
2 SET ptr TO 0
3 SET allocated TO FALSE
4 SEND "Enter booking size: " TO DISPLAY
5 RECEIVE bookingSize FROM (INTEGER) KEYBOARD
6 WHILE (NOT allocated) DO
7 IF (hallCapacity[ptr] >= bookingSize) THEN
8 SEND hallCapacity[ptr] TO DISPLAY
9 SET allocated TO TRUE
10 ELSE
11 SET ptr TO ptr + 1
12 END IF
13 END WHILE
14
15 IF (NOT allocated) THEN
16 SEND "No hall suitable" TO DISPLAY
17 END IF
Complete the trace table below for an input of 1200 to show what happens due to the error on line 6.
| ptr | allocated | bookingSize | Output |
|---|---|---|---|