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 881–890 of 1,222
  1. 881
  2. 882
  3. 883
  4. 884
  5. 885
  6. 886
  7. 887
  8. 888
  9. 889
  10. 890

Question 881

Multiple choice 2D Arrays
Consider the following code segment. int[][] arr2D = /* missing initialization */; int sum = 0; for (int j = 0; j < arr2D.length; j++) { sum +=…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 882

Multiple choice 2D Arrays
Consider the following code segment. int[][] arr = {{10, -7, 19, 14}, {-3, -2, -6, 11}, {-9, 12, 10, -1}}; int ans = 1; for (int[] row : arr) { for (int…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 883

Multiple choice Sorting And Searching
The following method is a correct implementation of the selection sort algorithm. The method sorts the elements of arr so that they are in order from least to…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 884

Multiple choice Recursion
Consider the following method. public static void mystery(int j, int k) { if (j > k) { mystery(j -…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 885

Free response Arraylists
The ItemInfo class is used to store information about an item at a store. A partial declaration of the ItemInfo class is shown. public class ItemInfo { /** *…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 886

Free response 2D Arrays
The Appointment class is used to store information about a person's scheduled appointments. A partial declaration of the Appointment class is shown. public…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 887

Free response Arraylists
A tournament round pairs best-ranked competitors with worst-ranked competitors. Implement the Round constructor and buildMatches. Names are ordered from best to…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 888

Free response 2D Arrays
This question involves reasoning about a number puzzle that is represented as a two-dimensional array of integers. Each element of the array initially contains…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 889

Multiple choice Arraylists
Consider the following code segment. What is printed when this code is executed? ArrayList<String> list = new ArrayList<>(); list.add("apple");…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 890

Multiple choice Using Text Files
info.txt contains exactly 2.5 Hello World. The file exists, opens successfully, and the enclosing method handles checked file-opening exceptions. What happens?…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 881 of 1,222
Page 89 of 123