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 611–620 of 1,222
  1. 611
  2. 612
  3. 613
  4. 614
  5. 615
  6. 616
  7. 617
  8. 618
  9. 619
  10. 620

Question 611

Multiple choice 2D Arrays
Consider the following class definition: public class Matrix { private double[][] data; public Matrix(int rows, int cols) { // < missing statements > } public…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 612

Multiple choice 2D Arrays
Consider the following class definition: public class Matrix { private int[][] data; public Matrix(int rows, int cols) { data = new int[rows][cols]; } public…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 613

Multiple choice Arrays
Consider the following class: public class ArraySorter { public static void sort(int[] arr) { for (int i = 0; i < arr.length; i++) { for (int j = arr.length -…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 614

Multiple choice Sorting And Searching
Merge sort takes about18ms for80000 random values and40ms for160000. Which…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 615

Multiple choice Sorting And Searching
The Binary Search algorithm is designed to work with an array sorted in ascending order. Under which of the following circumstances will the algorithm find a…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 616

Multiple choice Arraylists
What is printed when the code segment is executed? ArrayList<Integer> lst = new ArrayList<Integer>(); int k = 2; while (lst.size() <…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 617

Multiple choice Arrays
Consider the following three implementations of a method rotate90Degrees and the code segments used to test them. I. public int[] rotate90Degrees(int[] v) {…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 618

Multiple choice Arrays
String[] a = {"A", "B"}; String[] b = a; String[] c = {a[0], a[1]}; String letter = a[0]; a[0] = a[1]; a[1] =…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 619

Multiple choice Arrays
What is the value of v[4] after the following code segment is executed? int d = 1;…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 620

Multiple choice Recursion
Consider the following method. public void splat(String s) { if (s.length() < 8)…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 611 of 1,222
Page 62 of 123