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 81–90 of 145
  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 a program that has a two-dimensional array mat of int values. The program has several methods that change mat by reflecting elements of mat across a…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 82

Multiple choice 2D Arrays
Consider the following code segment. int n = // some positive integer int [ ][ ] table = new int[n][n]; // input values into table int sum = 0; for (int row =…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 83

Multiple choice 2D Arrays
Consider the following code segment. int m = // some positive integer int n = // some positive integer int [ ][ ] table = new int[m][n]; // input values into…

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 incomplete method. public static double findRowSum(double [][] mat, int n) { double sum = 0; // missing code return sum; } Method…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 85

Multiple choice 2D Arrays
Consider the following definition and code segment. int [][] table = new int[5][5]; for (int row = 0; row < table.length-1; row++) for (int…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 86

Multiple choice 2D Arrays
Consider the following class definition: public class Matrix { private double[][] data; public Matrix(int rows, int cols) { // < missing statements > } public…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 87

Multiple choice 2D Arrays
Consider the following class definition: public class Matrix { private int[][] data; public Matrix(int rows, int cols) { data = new int[rows][cols]; } public…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 88

Multiple choice 2D Arrays
A grayscale image is stored in a 2D array of integers called image. Each element represents a pixel's brightness value, ranging from 0 (black) to 255 (white).…

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: for (int r = 1;r < mat.length;r++) { for (int c = 1;c < mat[0].length;c++) { if ((r + c) % 2 == 0) mat[r][c] = 2 * mat[r -…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 90

Multiple choice 2D Arrays
Which of the following code segments correctly…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 81 of 145
Page 9 of 15