Verityprep
Question Bank · Unit 3

AP® Computer Science A Class Creation Practice Questions

Work through AP Computer Science A practice questions on Class Creation, 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 351–360 of 402
  1. 351
  2. 352
  3. 353
  4. 354
  5. 355
  6. 356
  7. 357
  8. 358
  9. 359
  10. 360

Question 351

Multiple choice Writing Classes
Consider the following methods, which appear in the same class. public static int apply(int n) { return n * 2; } public static double apply(double n)…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 352

Multiple choice Writing Classes
Consider the following class. public class Pair { private int x; private int y; public Pair(int x, int y) { x = x; y = y; } public int getX() { return x; }…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 353

Multiple choice Writing Classes
Consider the following class. public class Box { private String label; public Box(String s) { label = s; } public int labelLength() { return…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 354

Multiple choice Writing Classes
Consider the following class. public class Account { private int balance; public Account(int b) { balance = b; } public int withdraw(int amount) { if (amount >…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 355

Multiple choice Writing Classes
Consider the following method. public static void addAll(ArrayList<Integer> list) { list.add(99); list = new ArrayList<Integer>(); list.add(7); } Consider the…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 356

Multiple choice Writing Classes
Consider the following class. public class Counter { private static int total = 0; private int value; public Counter() { value = 1; total = total + value; }…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 357

Free response Writing Classes
A charity kiosk uses a class DonationJar to track cash donations. Amounts are measured in whole cents and are always non-negative. The class must support adding…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 358

Multiple choice Writing Classes
Consider the following class. public class Box { private int value; public Box(int v) { value = v; } public int get() { return value; } public void set(int v) {…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 359

Multiple choice Writing Classes
Consider the following class. public class Counter { private int n; public Counter() { n = 0; } public int bump() { n = n + 1; return n; } public int get() {…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 360

Multiple choice Writing Classes
Consider the following class. public class Point { private int x; private int y; public Point(int x, int y) { this.x = y; this.y = x + this.x; } public int…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 351 of 402
Page 36 of 41