Verityprep
Question Bank · Unit 4

AP® Computer Science A Data Collections Multiple Choice Questions

Work through AP Computer Science A multiple-choice 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 91–100 of 145
  1. 91
  2. 92
  3. 93
  4. 94
  5. 95
  6. 96
  7. 97
  8. 98
  9. 99
  10. 100

Question 91

Multiple choice 2D Arrays
Suppose m is a two-dimensional array of size 4 by 4, with all its elements initialized to zeros. The method fill is defined as follows: public void…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 92

Multiple choice 2D Arrays
Given the following method, what would the result be when m is executed? public void m(int[][] p) { int height = p.length; for…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 93

Multiple choice 2D Arrays
A two-dimensional array is used to represent a matrix. The declaration is below: private int[][] matrix = new int[2][3]; public static void changeMatrix(int[][]…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 94

Multiple choice 2D Arrays
Given the following values for a 2D array m and the following code: 1 1 1 1 1 2 3 4 2 2 2 2 2 4 6 8 int sum = 0; for…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 95

Multiple choice 2D Arrays
int len = 4; int[][] matrix = new int[len][len]; int total = 0; for (int row = 0; row < len; row++) { total = total + matrix[row][1]; } Assume…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 96

Multiple choice 2D Arrays
Given the following method public void m(int[][] p) { int height = p.length; for (int row = 0;row < height / 2;row++) { for (int col =…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 97

Multiple choice 2D Arrays
Given the following 2D array declaration and initialization: int[][] matrix = {{-1, -2, 3}, {4, -5, 6}}; And the method: public static void changeMatrix(int[][]…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 98

Multiple choice 2D Arrays
Given the following 2D array m: Row 0: 1 1 1 1 Row 1: 1 2 3 4 Row 2: 2 2 2 2 Row 3: 2 4 6 8 Consider the following code segment: int…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 99

Multiple choice 2D Arrays
Consider the following code segment: int[][] mat = new int[3][4]; for (int row = 0;row < mat.length;row++) { for (int col = 0;col < mat[0].length;col++) { if…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 100

Multiple choice 2D Arrays
public class FrequentFlyer { private int miles = 0; public FrequentFlyer(int m) { miles = m; } public void addMiles(int m) { miles += m;} public int getMiles()…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 91 of 145
Page 10 of 15