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 141–150 of 195
  1. 141
  2. 142
  3. 143
  4. 144
  5. 145
  6. 146
  7. 147
  8. 148
  9. 149
  10. 150

Question 141

Multiple choice 2D Arrays
Consider the following code segment. int[][] arr2D = /* missing initialization */; int sum = 0; for (int j = 0; j < arr2D.length; j++) { sum +=…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 142

Multiple choice 2D Arrays
Consider the following code segment. int[][] arr = {{10, -7, 19, 14}, {-3, -2, -6, 11}, {-9, 12, 10, -1}}; int ans = 1; for (int[] row : arr) { for (int…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 143

Free response 2D Arrays
The Appointment class is used to store information about a person's scheduled appointments. A partial declaration of the Appointment class is shown. public…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 144

Free response 2D Arrays
This question involves reasoning about a number puzzle that is represented as a two-dimensional array of integers. Each element of the array initially contains…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 145

Free response 2D Arrays
The High School Coin Collection Club needs new software to help organize its coin collections. Each coin in the collection is represented by an object of the…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 146

Multiple choice 2D Arrays
What is the value of sum after the following executes? int[][] grid = { {1, 2, 3}, {4, 5,…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 147

Multiple choice 2D Arrays
What does the following method return for input [[1,2],[3,4],[5,6]]? public static int colSum(int[][] m, int…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 148

Free response 2D Arrays
A grayscale image can be represented as a 2D array of integers, where each value is a pixel intensity from 0 (black) to 255 (white). Consider the following…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 149

Multiple choice 2D Arrays
Consider the following code that processes a 2D array: int[][] g = {{1,2,3},{4,5,6},{7,8,9}}; int total = 0; for…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 150

Multiple choice 2D Arrays
A method receives a 2D integer array and returns true…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 141 of 195
Page 15 of 20