ProgrammingVery hard

Spiral traversal (clockwise, starting top-left) of the 3 x 4 matrix with rows {1,2,3,4}, {5,6,7,8}, {9,10,11,12} visits the elements in which order? What is the sixth element visited?

  1. A. 6
  2. B. 12
  3. C. 7
  4. D. 10

Correct answer: B. 12

The order is 1 2 3 4 8 12 11 10 9 5 6 7, so the sixth value visited is 12, the last cell of the top sweep on the right edge.

More C Programming questions

Exams that ask this topic