ProgrammingModerate
Matrix m = {{1,2,3},{4,5,6},{7,8,9}} is transposed in place. What is the first row afterwards?
- A. 1 4 7
- B. 7 4 1
- C. 1 2 3
- D. 3 6 9
Correct answer: A. 1 4 7
Transposing swaps m[i][j] with m[j][i]. The first row becomes the first column of the original, 1, 4, 7.
More C Programming questions
- 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…
- int g[3][3] = {{1,2,3},{4,5,6},{7,8,9}}; With a 2D prefix-sum table P, the sum of the rectangle with rows 1 to 2 and columns 1 to 2…
- Count the 4-connected islands of 1s in this grid, where rows are "11000", "11010", "00100", "00011". How many islands are there?
- In Pascal's triangle with row 0 at the top, what is the entry in row 6, column 2?
- The matrix [[1,1],[1,0]] raised to the 10th power, computed by fast exponentiation, has entry [0][1] equal to which Fibonacci number?
- Which prototype is valid in C99 for a function that takes a column count c and an int matrix m with c columns?