Verityprep
Question Bank · Unit 4

AP® Computer Science A Data Collections Practice Questions

Work through AP Computer Science A practice questions on Data Collections, then check each answer against a worked solution.

Free · no sign-up Open questions need no account. Sign up or log in to open the rest.

Subtopic: 2D Arrays Clear filter

Questions 81–90 of 195
  1. 81
  2. 82
  3. 83
  4. 84
  5. 85
  6. 86
  7. 87
  8. 88
  9. 89
  10. 90

Question 81

Multiple choice 2D Arrays
Consider the following instance variable and methods in the same class. private int[][] matrix; /** Precondition: array.length > 0. * @return the largest…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 82

Multiple choice 2D Arrays
Consider method1 and method2 below, which are identical except for the second last line of code. Each method returns a new matrix based on the input matrix mat.…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 83

Free response 2D Arrays
A puzzle-solving competition is held in a large hall with a two-dimensional arrangement of contestants. Each rectangle below represents one contestant. A…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 84

Multiple choice 2D Arrays
Consider the following instance variables and method assignValues in the same class. private int numRows; private int numCols; private int[][] mat; /** arr has…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 85

Multiple choice 2D Arrays
A two-dimensional matrix mat with at least one row is initialized and will be traversed using…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 86

Multiple choice 2D Arrays
A square matrix is declared as int[][] mat = new int[SIZE][SIZE]; where SIZE is an appropriate integer constant. Consider the following method. public static…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 87

Multiple choice 2D Arrays
A matrix class that manipulates matrices contains the following declaration. private int[][] mat = new int[numRows][numCols]; Consider the following method that…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 88

Free response 2D Arrays
Consider the problem of keeping track of the available seats in a theater. Theater seats can be represented with a two-dimensional array of integers, where a…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 89

Multiple choice 2D Arrays
Consider the following code segment. int[][] mat = {{3,4,5}, {6,7,8}}; int sum = 0; for (int[] arr: mat) { for…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 90

Multiple choice 2D Arrays
A matrix (two-dimensional array) is declared as int[][] mat = new int[2][3]; Consider the following method. public static void changeMatrix(int[][] mat) { for…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 81 of 195
Page 9 of 20