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.

Subtopic: Writing Classes Clear filter

Questions 231–240 of 402
  1. 231
  2. 232
  3. 233
  4. 234
  5. 235
  6. 236
  7. 237
  8. 238
  9. 239
  10. 240

Question 231

Multiple choice Writing Classes
Consider a class Pair with two int fields first and second. A method swap is intended to…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 232

Multiple choice Writing Classes
Consider the following class: public class Wallet { private double balance; public Wallet(double initial) { balance = initial; } public void spend(double…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 233

Multiple choice Writing Classes
A BankAccount class has a private field balance and a method: public void deposit(double amount) { if…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 234

Multiple choice Writing Classes
A toString method for a Point class should return a…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 235

Free response Writing Classes
Write a complete class TemperatureLog that tracks daily temperature readings. Below is a specification table showing how the class should behave: STATEMENT…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 236

Multiple choice Writing Classes
Consider the following class: public class Accumulator { private int total = 0; private int count = 0; public void add(int n) { total += n; count++; } public…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 237

Multiple choice Writing Classes
A class has two instance variables int x and int y. Which method…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 238

Multiple choice Writing Classes
A class Fraction has fields int numerator and int denominator. An equals method should return true when two…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 239

Multiple choice Writing Classes
Which of the following best describes the difference…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 240

Multiple choice Writing Classes
Consider a class Counter with a private int count initialized to 0. A method reset()…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 231 of 402
Page 24 of 41