Verityprep
Question Bank

AP® Computer Science A Multiple Choice Questions

Work through AP Computer Science A multiple-choice 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,321–2,330 of 2,811
  1. 2321
  2. 2322
  3. 2323
  4. 2324
  5. 2325
  6. 2326
  7. 2327
  8. 2328
  9. 2329
  10. 2330

Question 2321

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

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

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

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

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

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

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

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

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

Multiple choice Unit 4: Data Collections
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 2,321 of 2,811
Page 233 of 282