Note AcademyNote Academy

Computer Science · Oct / Nov 2016 · Paper 1 HL · Question 12

Adapt for 2027B2.2.2 2D arrays and B2.3.3 nested loops; spiral algorithm must be written in Python/Java.

IBCS

As printed in the paper

The question as text

12. A two-dimensional array, A, has N rows and N columns, where N is a positive integer. The following algorithm is written to fill array A with the numbers 1, 2, 3,…, N2. N=input(‘Enter an integer greater than zero’) K=N*N loop for ROW=0 to N-1 loop for COLUMN=0 to N-1 A[ROW][COLUMN]=K K=K-1 end loop end loop

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

Show the answer and mark scheme
  • 12(a)[3]

  • 12(b)(i)[1]

  • 12(b)(ii)[1]

  • 12(b)(iii)[1]

  • 12(c)[9]

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