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 721–730 of 1,222
  1. 721
  2. 722
  3. 723
  4. 724
  5. 725
  6. 726
  7. 727
  8. 728
  9. 729
  10. 730

Question 721

Multiple choice Arrays
Consider the following code that is part of a class declaration: private int[] myStuff; // precondition: myStuff contains integers in no particular order public…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 722

Multiple choice Arraylists
Consider the following declaration of the class RandomList, which has a constructor intended to initialize the instance variable numList to an ArrayList of n…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 723

Multiple choice Arrays
Consider the following method: public static void test(int[] a, int y) { if (a.length > 1) { a[1] = a[1] * 2; y = y *…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 724

Multiple choice Sorting And Searching
The following method should sort the contents of the array in ascending order using insertion sort. Which of the following should replace /* missing code */ to…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 725

Multiple choice Recursion
Consider the following recursive method: // precondition: x >= 0 public static void mystery(int x) { if…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 726

Free response Arraylists
This question involves the manipulation and analysis of a list of words. The following WordChecker class contains an ArrayList<String> to be analyzed and…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 727

Free response 2D Arrays
This question involves a path through a two-dimensional (2D) array of integers, where the path is based on the values of elements in the array. When an element…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 728

Free response Arraylists
WordList stores strings of letters in myList. Implement both methods while preserving the order of words that remain. public class WordList { private ArrayList…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 729

Free response Arrays
Hotel maintains rooms numbered0 through rooms.length−1 and a waiting list of guest names. A null rooms entry is unreserved; any nonnull entry is a Reservation…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 730

Free response Arrays
StudentRecord holds more than one integer score. Scores have improved if every successive score is at least the preceding score. Improved records average only…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 721 of 1,222
Page 73 of 123