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 371–380 of 402
  1. 371
  2. 372
  3. 373
  4. 374
  5. 375
  6. 376
  7. 377
  8. 378
  9. 379
  10. 380

Question 371

Multiple choice Writing Classes
Suppose secret is declared private in class…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 372

Multiple choice Writing Classes
Consider the following class. public class Box { private int value; public Box(int v) { value = v; } public void add(int n) { value = value + n; } public int…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 373

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

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 374

Multiple choice Writing Classes
Consider the following class. public class Record { private int score; private String name; private boolean active; }…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 375

Multiple choice Writing Classes
Consider the following class. public class Marker { private static int next = 100; private int id; public Marker() { id = next;…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 376

Multiple choice Writing Classes
Consider the following class. public class ScoreCard { private int score; public ScoreCard() { this(10); } public ScoreCard(int s) { score = s; } public int…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 377

Multiple choice Writing Classes
Consider the following class. public class Wallet { private int dollars; public Wallet(int d) { dollars = d; } public int spend(int amount) { if (amount <=…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 378

Multiple choice Writing Classes
Consider the following class. public class Clock { private int hour; public Clock(int h) { hour = h; } public void advance() { hour++; if (hour == 24) hour = 0;…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 379

Free response Writing Classes
A small theater sells same-day tickets at a single service desk. Customers wait in a line, and the theater wants a TicketLine class that stores the names of…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 380

Multiple choice Writing Classes
Consider the following class definition. public class Badge { private static int next = 1; private int id; public Badge() { id = next; next = next + 2; } public…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 371 of 402
Page 38 of 41