Verityprep
Question Bank

AP® Computer Science A Practice Questions

Work through AP Computer Science A practice questions unit by unit, 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 2,421–2,430 of 3,140
  1. 2421
  2. 2422
  3. 2423
  4. 2424
  5. 2425
  6. 2426
  7. 2427
  8. 2428
  9. 2429
  10. 2430

Question 2421

Multiple choice Unit 4: Data Collections
Consider two different ways of storing a set of nonnegative integers in which there are no duplicates. Method One: Store the integers explicitly in an array in…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2422

Multiple choice Unit 4: Data Collections
Consider an array arr of 64 distinct int values, which are sorted in increasing order. The first element of the array, arr[0], equals 5, and the last element,…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2423

Multiple choice Unit 4: Data Collections
Consider the following program segment. /** Precondition: a[0]..a[n-1] is an initialized array of integers, * and 0 < n <= a.length. */ int c = 0; for (int i =…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2424

Multiple choice Unit 4: Data Collections
Consider the following instance variable and methods in the same class. private int[][] matrix; /** Precondition: array.length > 0. * @return the largest…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2425

Multiple choice Unit 4: Data Collections
This question refers to the findCheapest method below, which occurs in a class that has an array of AutoPart as one of its private data fields. private…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2426

Multiple choice Unit 4: Data Collections
Consider an array arr and a list list that is an ArrayList<String>. Both arr and list are initialized with string values. Which of the following code segments…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2427

Multiple choice Unit 4: Data Collections
Consider the following mergeSort method and the private instance variable a both in the same Sorter class. private int[] a; /** Sorts a[first] to a[last] in…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2428

Multiple choice Unit 4: Data Collections
A large hospital maintains a list of patients' records in no particular order. To find the record of a given patient,…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2429

Multiple choice Unit 4: Data Collections
Consider method1 and method2 below, which are identical except for the second last line of code. Each method returns a new matrix based on the input matrix mat.…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2430

Multiple choice Unit 4: Data Collections
Consider an ArrayList cards of Card objects that needs to be shuffled. The following algorithm is used for shuffling. Create a temporary ArrayList<Card> Do the…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2,421 of 3,140
Page 243 of 314