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 71–80 of 195
  1. 71
  2. 72
  3. 73
  4. 74
  5. 75
  6. 76
  7. 77
  8. 78
  9. 79
  10. 80

Question 71

Multiple choice 2D Arrays
Consider the following code segment. int [] [] table = new int [5] [6]; int val = 0; for (int k = 0;k < table[0].length;k++) { for (int j…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 72

Free response 2D Arrays
The colors of the pixels on a TV or computer screen are made by combining different quantities of red, green, and blue light. Each of the three colors is…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 73

Multiple choice 2D Arrays
Consider the following output. A A A A P P P P C C C C Which of the following code segments will produce this output? I. String[] letters = {"A", "P", "C",…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 74

Multiple choice 2D Arrays
Consider the following code segment. int [] [] matrix = new int [3] [3]; int value = 0; for (int row = 0;row < matrix.length;row++) { for (int column = 0;column…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 75

Multiple choice 2D Arrays
Consider the following code segment. int [] [] grid = { {0, 1, 2}, {3, 4, 5}, {6, 7, 8}, {9, 10, 11} }; int [] [] newGrid = new int [grid[0].length]…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 76

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

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 77

Free response 2D Arrays
A hex grid is a type of two-dimensional (2-D) map used by many games to represent the area that tokens, ships, robots, or other types of game pieces can move…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 78

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++) {…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 79

Free response 2D Arrays
This question involves a two-dimensional array of integers that represents a collection of randomly generated data. A partial declaration of the Data class is…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 80

Multiple choice 2D Arrays
Consider the following method that will access a square matrix mat. /** Precondition: mat is initialized and is a square matrix. */ public static void…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 71 of 195
Page 8 of 20