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 511–520 of 1,222
  1. 511
  2. 512
  3. 513
  4. 514
  5. 515
  6. 516
  7. 517
  8. 518
  9. 519
  10. 520

Question 511

Multiple choice 2D Arrays
Consider method1 and method2 below, which are identical except for the second last line of code. Each method returns a new matrix based on the input matrix mat.…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 512

Multiple choice Arraylists
Consider an ArrayList cards of Card objects that needs to be shuffled. The following algorithm is used for shuffling. Create a temporary ArrayList<Card> Do the…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 513

Free response Arraylists
Consider a system for processing names and addresses from a mailing list. A Recipients class will be used as part of this system. The lines in the mailing list…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 514

Free response 2D Arrays
A puzzle-solving competition is held in a large hall with a two-dimensional arrangement of contestants. Each rectangle below represents one contestant. A…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 515

Multiple choice 2D Arrays
Consider the following instance variables and method assignValues in the same class. private int numRows; private int numCols; private int[][] mat; /** arr has…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 516

Multiple choice Arraylists
Let list be an ArrayList<String> containing only these elements. "John", "Mary", "Harry", "Luis" Which of the…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 517

Multiple choice Arrays
Consider the following instance variable and method. private int[] nums; /** Precondition: nums contains int values in no particular order. */ public int…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 518

Multiple choice Recursion
Consider the following method. public int mystery(int n) { if (n == 0) return 0; else if (n % 2…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 519

Multiple choice 2D Arrays
A two-dimensional matrix mat with at least one row is initialized and will be traversed using…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 520

Multiple choice Arrays
A class of 30 students rated their computer science teacher on a scale of 1 to 10 (1 means awful and 10 means outstanding). The responses array is a 30-element…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 511 of 1,222
Page 52 of 123