Note AcademyNote Academy

Computer Science · Oct / Nov 2024 · Paper 1 HL · Question 15

Adapt for 2027Processing 2D and 1D arrays with nested loops is B2.2.2, but the algorithms should be written in Python or Java instead of IB pseudocode.

IBCS

As printed in the paper

The question as text

15. The two-dimensional array MAT is used to store randomly generated integers in the range from 0 to 9. In the MAT array, some numbers can be repeated multiple times and other numbers may not appear at all (see Figure 1). Figure 1: Example data stored in the MAT array [0] [1] [2] [3] [4] [5] [6] [0] 0 2 5 9 3 6 1 [1] 0 2 9 0 7 0 0 [2] 4 2 7 9 5 7 1 [3] 7 2 3 1 5 4 0 [4] 3 6 3 9 9 6 0 [5] 7 4 3 1 7 9 3 [6] 3 9 6 4 2 2 4 (This question continues on the following page) (Question 15 continued) The one-dimensional COUNT array will show how many times each of the randomly generated numbers is found in the MAT array (see Figure 2). Figure 2: The content of the COUNT array [0] [1] [2] [3] [4] [5] [6] [7] [8] [9] 7 4 6 7 5 3 4 6 0 7 Figure 2 shows that number 4 occurs 5 times (COUNT[4]=5) in the MAT array.

Read automatically from the paper; the printed page above is exact.

Show the answer and mark scheme
  • 15(a)[4]

  • 15(b)[5]

  • 15(c)[6]

Make a free account to save your answers and see your weak topics and ask the AI why a wrong answer is wrong.