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 461–470 of 1,222
  1. 461
  2. 462
  3. 463
  4. 464
  5. 465
  6. 466
  7. 467
  8. 468
  9. 469
  10. 470

Question 461

Multiple choice Sorting And Searching
Consider the following method. public void selectionSort(String[] arr) { for (int i = 0; i < arr.length; i++) { int small = i; for (int j = i; j < arr.length;…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 462

Free response Arraylists
A train is composed of an engine and any number of train cars. The engine is rated to pull up to a maximum weight, based on its power. The weight of all the…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 463

Free response 2D Arrays
The colors of the pixels on a TV or computer screen are made by combining different quantities of red, green, and blue light. Each of the three colors is…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 464

Multiple choice Arraylists
Consider the following code segment. ArrayList<String> foods = new ArrayList<String>(); foods.add("Hummus"); foods.add("Soup"); foods.add("Sushi"); foods.set(1,…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 465

Multiple choice 2D Arrays
Consider the following output. A A A A P P P P C C C C Which of the following code segments will produce this output? I. String[] letters = {"A", "P", "C",…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 466

Multiple choice Recursion
Consider the following recursive method. public int weird(int num) { if (num <= 0) return num; return…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 467

Multiple choice Arrays
Consider the following method. public boolean verifyValues(int[] values) { for (int index = values.length - 1; index > 0; index--) { /* missing code */ return…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 468

Multiple choice 2D Arrays
Consider the following code segment. int [] [] matrix = new int [3] [3]; int value = 0; for (int row = 0;row < matrix.length;row++) { for (int column = 0;column…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 469

Multiple choice Arraylists
Consider the following method. /** Precondition: numbers.size() > 0 */ public int totalValue(ArrayList<Integer> numbers) { int total = 0; for (Integer val :…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 470

Multiple choice Arrays
Assume that planets has been correctly instantiated and initialized to contain the names of the planets. Which of the following code segments will reverse the…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 461 of 1,222
Page 47 of 123