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.

Questions 351–360 of 1,222
  1. 351
  2. 352
  3. 353
  4. 354
  5. 355
  6. 356
  7. 357
  8. 358
  9. 359
  10. 360

Question 351

Multiple choice Arraylists
list is ArrayList with [2,5,7,6,0,1].…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 352

Multiple choice Arraylists
list is nonempty and sorted in decreasing string order. When does insert fail? public void…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 353

Multiple choice Arraylists
If list initially contains [6,1,8], what does it…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 354

Multiple choice Arraylists
Assume coins contains nonnull Coin objects. Which replaces /* more code */ in getTotal? public class Coin { private double value private String name public…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 355

Multiple choice Arraylists
In Purse.find, coins and aCoin are nonnull. Coins with the same name have the same value, and vice versa. Which replacement detects a match? public class Coin {…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 356

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 357

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 358

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 359

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 360

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 351 of 1,222
Page 36 of 123