ProgrammingVery hard
The sum of i + j over all cells of a 3 x 3 grid with indices 0 to 2 is what?
- A. 9
- B. 12
- C. 18
- D. 15
Correct answer: C. 18
Each row index appears three times and each column index appears three times, so the total is 3 x (0+1+2) x 2 = 18.
More C Programming questions
- Which declaration creates a 3 x 3 identity matrix with C99 designators?
- For n = 10^5 cells in a 1D array viewed as a 316 x 317 grid, what is the total cell count?
- A matrix has R rows and C columns with R = 3 and C = 4 in a flat array of 12 ints. What flat index is cell (2, 3)?
- A square matrix is symmetric when a[i][j] equals a[j][i]. What is the time needed to test an n x n matrix for symmetry in C?
- A singly linked list is built by inserting 1, 2, 3 at the head. Then two nodes are popped from the head and their values printed. What is…
- A circular singly linked list holds 1 -> 2 -> 3 -> back to 1. Starting at the head node, the program prints six consecutive values. What…