Question 9
Edexcel Computer Science June 2020 Paper 2GCSE9 marks
On the specification
- 1.2 Algorithms6.2 Program constructs6.3 Data types and structures
Question text
9 Passengers are counted as they go through the security barriers. There are currently eight barriers operating. The number of barriers may change. A barrier sends a signal to the main computer when a passenger goes through. Each time a signal is received, the main computer increments the count for that barrier. The program on the main computer stores the barrier counts in a two-dimensional array. Write an algorithm to increment the count for each barrier in the two-dimensional array. • Use pseudocode or a programming language with which you are familiar. • Assume inBarrier holds the number of the barrier that has sent a signal. You may not need to use all of the answer space. Put a line through any work you do not want to be marked. (9) ARRAY counts SET counts TO [[2, 0], [8, 0], [5, 0], [4, 0], [1, 0], [3, 0], [6, 0], [7, 0]] INTEGER inBarrier