Unit 8: 2D Array
Showing 17 of 17 questions
What is the output of the following code?
What is the output of the following code?
What does the following method return when called with the array {{1, 2, 3}, {4, 5, 6}}?
What is the output of the following code?
What does the following method do to the 2D array?
What is the output of the following code?
What is the output of the following code?
What does the following method return for a 3x3 identity matrix?
What is the output of the following code?
In the 2D array int[][] grid = {{1,2,3},{4,5,6}}, what is grid[1][2]?
For int[][] matrix = new int[3][4], the number of rows is ____ and the number of columns is ____.
To traverse all elements of a 2D array int[][] grid using nested for loops, the outer loop iterates over:
To sum column j of a 2D array grid, you would:
In Java, a 2D array:
Which creates a 2D array with 2 rows and 3 columns?
In row-major traversal of a 2D array, elements are visited:
What is the output? int[][] grid = {{1,2,3},{4,5,6},{7,8,9}}; int sum = 0; for (int r = 0; r < grid.length; r++) { sum += grid[r][r]; } System.out.println(sum);
Advertisement