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 11–20 of 145
  1. 11
  2. 12
  3. 13
  4. 14
  5. 15
  6. 16
  7. 17
  8. 18
  9. 19
  10. 20

Question 11

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 12

Multiple choice 2D Arrays
Given the following definition: int len = 4; int[][] matrix = new int[len][len]; Consider the following code: int total = 0; for (int row = 0;row < len;row++) {…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 13

Multiple choice 2D Arrays
Given the following method and 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 14

Multiple choice 2D Arrays
Consider the following method, which is intended to return the element of a 2-dimensional array that is closest in value to a specified number, val. /** @return…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 15

Multiple choice 2D Arrays
Consider the following code segment. int[] oldArray = {1, 2, 3, 4, 5, 6, 7, 8, 9}; int[][] newArray = new int[3][3]; int row = 0; int col = 0; for (int value :…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 16

Multiple choice 2D Arrays
int[][] t = new int[2][3]; for (int i = 0; i < t.length; i++) { for (int j = 0; j <…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 17

Multiple choice 2D Arrays
Consider the following class. public class Matrix { private int[][] m; /** Initializes m to a square n-by-n array with all * the elements on the diagonal…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 18

Multiple choice 2D Arrays
What would be a correct way to…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 19

Multiple choice 2D Arrays
Which is the correct way to construct and assign a 2D…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 20

Multiple choice 2D Arrays
We want to create a 2D double array with 6 rows and 7…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 11 of 145
Page 2 of 15