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 51–60 of 145
  1. 51
  2. 52
  3. 53
  4. 54
  5. 55
  6. 56
  7. 57
  8. 58
  9. 59
  10. 60

Question 51

Multiple choice 2D Arrays
A rectangular playing board is to be set up so that in the even-numbered rows, there is an x in each odd-numbered column, and in the odd-numbered rows, there is…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 52

Multiple choice 2D Arrays
Which initializes an8×10 int matrix with all entries perfect squares, including 0? I int[][] mat=new int[8][10]; II int[][] mat=new int[8][10]; for(int…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 53

Multiple choice 2D Arrays
Consider the following code segment. int[][] mat = {{1,3,5}, {2,4,6}, {0,7,8}, {9,10,11}}; for (int col = 0; col < mat[0].length; col++) for…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 54

Multiple choice 2D Arrays
Consider a class that has this private instance variable. private int[][] mat; The class has the following method, alter. public void alter(int c) { for (int i…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 55

Multiple choice 2D Arrays
Consider the following method that will alter the matrix mat. public static void matStuff(int[][] mat, int row) { int numCols = mat[0].length; for (int col…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 56

Multiple choice 2D Arrays
Assume that a square matrix mat is defined by int[][] mat = new int[SIZE][SIZE]; // SIZE is an integer constant >= 2 What does the following code segment do?…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 57

Multiple choice 2D Arrays
Consider a class MatrixStuff that has a private instance variable. private int[][] mat; Refer to method alter below that occurs in the MatrixStuff class. (The…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 58

Multiple choice 2D Arrays
This question refers to the following method. public static boolean isThere(String[][] mat, int row, int col, String symbol) { boolean yes; int i, count = 0;…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 59

Multiple choice 2D Arrays
The method changeNegs below should replace every occurrence of a negative integer in its matrix parameter with 0. /** Replaces all negative values in mat with…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 60

Multiple choice 2D Arrays
A two-dimensional array rainfall that contains double values will be used to represent the daily rainfall for a given year. In this scheme, rainfall[month][day]…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 51 of 145
Page 6 of 15