Verityprep
Question Bank · Unit 4

AP® Computer Science A Data Collections Multiple Choice Questions

Work through AP Computer Science A multiple-choice 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 591–600 of 1,079
  1. 591
  2. 592
  3. 593
  4. 594
  5. 595
  6. 596
  7. 597
  8. 598
  9. 599
  10. 600

Question 591

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 592

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 593

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 594

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 595

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 596

Multiple choice Arraylists
Consider the following class. public class BankAccount { private int balance; public BankAccount() { balance = 0; } public BankAccount(int amt) { balance = amt;…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 597

Multiple choice Arraylists
Consider the following code segment. ArrayList<Integer> numbers = new ArrayList<Integer>(); numbers.add(0); numbers.add(1); for (int k = 1; k <= 3; k++) { int n…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 598

Multiple choice Arraylists
Consider the following code segment: ArrayList<String> cities = new ArrayList<String>(); cities.add("Atlanta"); cities.add("Boston");…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 599

Multiple choice Recursion
Consider the following method: public String filter(String str, String pattern) { int pos = str.indexOf(pattern); if (pos == -1) return str; else return…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 600

Multiple choice Arrays
Consider the following code segment: int[] arr = {4, 3, 2, 1, 0}; for (int k = 1; k < arr.length; k++) {…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 591 of 1,079
Page 60 of 108