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 621–630 of 1,222
  1. 621
  2. 622
  3. 623
  4. 624
  5. 625
  6. 626
  7. 627
  8. 628
  9. 629
  10. 630

Question 621

Multiple choice Recursion
Consider the following method. public void printVals(String[] items, int k) { if (k > 1) { printVals(items, k - 1); System.out.print(items[k] + " ");…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 622

Multiple choice Recursion
Consider the following method. public void printVals(String[] items, int k) { if (k > 1) { printVals(items, k - 1); System.out.print(items[k] + " ");…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 623

Multiple choice Arraylists
Consider the following classes Point and Polygon. public class Point { private int x, y; public Point(int _x, int _y) { x = _x; y = _y; } public int getX() {…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 624

Multiple choice Arraylists
Consider the following classes Point and Polygon. public class Point { private int x, y; public Point(int _x, int _y) { x = _x; y = _y; } public int getX() {…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 625

Multiple choice Arrays
Consider the following code segment. int[] factors = {2, 3, 4, 7, 2, 5}; int product = 1; for (int i = 1; i <…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 626

Multiple choice Arraylists
Consider the following class. public class Buddylist { /** Contains the names of buddies. */ private ArrayList<String> buddies; public ArrayList<String>…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 627

Multiple choice Sorting And Searching
Consider the following method. /** * Returns the location of the target value in the array a, or -1 if not found. * Precondition: a[0] ... a[a.length - 1] are…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 628

Multiple choice Arrays
Consider the following incomplete method cutToAverage. public double cutToAverage(double[] amps) { double avg = 0.0; // missing code return avg; } It first…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 629

Multiple choice Arraylists
ArrayList<String> xyz = new ArrayList<String>(); xyz.add("X"); xyz.add("Y"); xyz.add("Z"); int count = 0; for (String s1 : xyz) { for…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 630

Multiple choice 2D Arrays
A grayscale image is stored in a 2D array of integers called image. Each element represents a pixel's brightness value, ranging from 0 (black) to 255 (white).…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 621 of 1,222
Page 63 of 123