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 481–490 of 1,222
  1. 481
  2. 482
  3. 483
  4. 484
  5. 485
  6. 486
  7. 487
  8. 488
  9. 489
  10. 490

Question 481

Multiple choice Arraylists
Consider the following code segment. ArrayList<String> list = new ArrayList<String>(); list.add("P"); list.add("Q"); list.add("R");…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 482

Multiple choice Arraylists
Consider the following instance variable and method. private ArrayList<Integer> nums; /** Precondition: nums.size > 0 */ public void numQuest() { int k = 0;…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 483

Multiple choice Arrays
public class TimeRecord { private int hours; private int minutes; // 0<=minutes<60 public TimeRecord(int h, int m) { hours = h; minutes = m; } /** @return the…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 484

Multiple choice Sorting And Searching
Consider the following instance variable and method. private int[] arr; /** Precondition: arr contains no duplicates; * the elements in arr are in sorted order.…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 485

Multiple choice Arrays
Consider the following instance variable and method findLongest with line numbers added for reference. Method findLongest is intended to find the longest…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 486

Multiple choice Arrays
Consider the following instance variable and method findLongest with line numbers added for reference. Method findLongest is intended to find the longest…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 487

Multiple choice Arrays
Consider the following instance variable and method. private int[] myStuff; /** Precondition: myStuff contains int values in no particular order. */ public int…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 488

Multiple choice Recursion
Consider the following method. / * * @param x x >= 0 * / public void mystery(int x) { System.out.print(x % 10); if ((x / 10)…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 489

Multiple choice Recursion
Consider the following recursive method. public static int mystery(int n) { if (n == 0) return…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 490

Multiple choice Arrays
Consider the following instance variable and method. private int[] arr; /** Precondition: arr.length > 0 */ public int checkArray() { int loc = arr.length /…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 481 of 1,222
Page 49 of 123