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 501–510 of 1,222
  1. 501
  2. 502
  3. 503
  4. 504
  5. 505
  6. 506
  7. 507
  8. 508
  9. 509
  10. 510

Question 501

Multiple choice Arrays
A Clock class has hours, minutes, and seconds represented by int values. It also has each of the following methods: setTime to change the time on a Clock to the…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 502

Multiple choice 2D Arrays
Consider the following method that will access a square matrix mat. /** Precondition: mat is initialized and is a square matrix. */ public static void…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 503

Multiple choice Sorting And Searching
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 504

Multiple choice Sorting And Searching
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 505

Multiple choice Arrays
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 506

Multiple choice 2D Arrays
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 507

Multiple choice Arrays
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 508

Multiple choice Arrays
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 509

Multiple choice Arrays
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 510

Multiple choice Sorting And Searching
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 501 of 1,222
Page 51 of 123