ProgrammingHard
Rotating the 2 x 2 matrix [[1, 2], [3, 4]] by 90 degrees counter-clockwise gives which first row?
- A. 2 4
- B. 1 3
- C. 3 1
- D. 4 2
Correct answer: A. 2 4
A counter-clockwise rotation turns the last column into the first row, read top to bottom. The last column is 2 and 4.
More C Programming questions
- The matrix int a[3][3] = {[1][1] = 5}; is zero-initialised everywhere else (C99 designators). What is a[0][0] + a[1][1] + a[2][2]?
- For the array int a[2][3] = {{1, 2, 3}, {4, 5, 6}}, what does ((a + 1) + 2) print?
- int m[2][3] = {{1, 2, 3}, {4, 5, 6}}; int (r)[3] = m + 1; What is r[0][2]?
- In an n x n row-major int matrix with n = 5, what is the flat index of the diagonal cell (i, i) for i = 2?
- On a 5 x 5 grid the number of cells on its boundary (first and last row, first and last column) is what?
- Which 2 x 2 product gives the top-left entry of A = [[1, 2], [3, 4]] times B = [[5, 6], [7, 8]]?