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,541–2,550 of 3,140
  1. 2541
  2. 2542
  3. 2543
  4. 2544
  5. 2545
  6. 2546
  7. 2547
  8. 2548
  9. 2549
  10. 2550

Question 2541

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 2542

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 2543

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 2544

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 2545

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 2546

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 2547

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 2548

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 2549

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 2550

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 2,541 of 3,140
Page 255 of 314