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 471–480 of 1,222
  1. 471
  2. 472
  3. 473
  4. 474
  5. 475
  6. 476
  7. 477
  8. 478
  9. 479
  10. 480

Question 471

Multiple choice Arraylists
Consider the following code segment. String exampleString = "computer"; ArrayList<String> words = new ArrayList<String>(); for (int k = 0; k <…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 472

Multiple choice Recursion
Consider the following recursive method. public void wackyOutput (String wacky) { if (wacky.length() < 1) return; wacky =…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 473

Multiple choice Sorting And Searching
Consider the following method which implements an Insertion Sort algorithm. public void sortIt(int[] arr) { for (int i = 1;i < arr.length;i++) { int value =…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 474

Multiple choice Arraylists
Consider the following method. public ArrayList<String> rearrange(ArrayList<String> myList) { for (int i = myList.size() / 2; i >= 0; i--) { String wordA =…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 475

Multiple choice 2D Arrays
Consider the following code segment. int [] [] grid = { {0, 1, 2}, {3, 4, 5}, {6, 7, 8}, {9, 10, 11} }; int [] [] newGrid = new int [grid[0].length]…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 476

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

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 477

Multiple choice Sorting And Searching
What can the following method best be described as? public int mystery(int[] array, int…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 478

Multiple choice Arraylists
Assume obscureAnimals is an ArrayList<String> that has been correctly constructed and populated with the following items. ["okapi", "aye-aye", "cassowary",…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 479

Free response Arraylists
A printing factory maintains many printing machines that hold rolls of paper. public class Machine { private PaperRoll paper; public Machine(PaperRoll roll) {…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 480

Free response 2D Arrays
A hex grid is a type of two-dimensional (2-D) map used by many games to represent the area that tokens, ships, robots, or other types of game pieces can move…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 471 of 1,222
Page 48 of 123