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,401–2,410 of 3,140
  1. 2401
  2. 2402
  3. 2403
  4. 2404
  5. 2405
  6. 2406
  7. 2407
  8. 2408
  9. 2409
  10. 2410

Question 2401

Multiple choice Unit 4: Data Collections
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 2402

Multiple choice Unit 4: Data Collections
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 2403

Multiple choice Unit 4: Data Collections
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 2404

Multiple choice Unit 4: Data Collections
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 2405

Multiple choice Unit 4: Data Collections
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 2406

Multiple choice Unit 4: Data Collections
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 2407

Multiple choice Unit 4: Data Collections
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 2408

Multiple choice Unit 4: Data Collections
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 2409

Multiple choice Unit 4: Data Collections
Consider the following code segment. int[][] mat = new int[3][4]; for (int row = 0; row < mat.length; row++) { for (int col = 0; col < mat[0].length; col++) {…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2410

Multiple choice Unit 4: Data Collections
Consider the following methods. public List<Integer> process1(int n) { List<Integer> someList = new ArrayList<Integer>(); for (int k = 0; k < n; k++)…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2,401 of 3,140
Page 241 of 314