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 671–680 of 1,222
  1. 671
  2. 672
  3. 673
  4. 674
  5. 675
  6. 676
  7. 677
  8. 678
  9. 679
  10. 680

Question 671

Multiple choice Sorting And Searching
Consider the following class: public class SortX { public static void sort(String[] items) { int n = items.length; while (n > 1) { sortHelper(items, n - 1);…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 672

Multiple choice Arraylists
What is printed when the following code segment is executed? ArrayList<Integer> lst = new ArrayList<Integer>(); for (int k = 1; k <= 6;…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 673

Multiple choice Arrays
Consider the following method: public int mysteryCount(int[] p) { int count = 0; for (int i = 0; i < p.length; i++) { count++; int j…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 674

Free response 2D Arrays
Seats in a movie theater are modeled by a two-dimensional array of boolean values: true represents an occupied seat and false represents a vacant seat. Row…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 675

Multiple choice Arrays
Given the following code, which of the answers best describes the conditions needed for temp to be true, when it is returned?…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 676

Multiple choice Arraylists
Consider the following code segment: List<String> list = new ArrayList<String>(); list.add("a"); list.add("b"); list.set(1, "c");…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 677

Multiple choice Sorting And Searching
The following incomplete method is intended to sort the array a in ascending order. public void sort() { int maxCompare = a.length - 1; int lIndex = 0; int temp…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 678

Free response 2D Arrays
A crossword puzzle grid is a two-dimensional rectangular array of black and white squares. Some of the white squares are labeled with a positive number…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 679

Multiple choice 2D Arrays
Given the following method, what would the result be when m is executed? public void m(int[][] p) { int height = p.length; for…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 680

Multiple choice Recursion
What is the output from mystery(4321) when mystery is defined as follows? // preconditions: x >= 0…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 671 of 1,222
Page 68 of 123