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 171–180 of 402
  1. 171
  2. 172
  3. 173
  4. 174
  5. 175
  6. 176
  7. 177
  8. 178
  9. 179
  10. 180

Question 171

Multiple choice Writing Classes
Suppose a class MyTest has an instance variable score: private int score…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 172

Multiple choice Writing Classes
Consider the following method from ClassX. private int modXY(int x, int y) { r = x / y; return x % y; } If ClassX compiles with no errors, which of the…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 173

Multiple choice Writing Classes
Consider the following class: public class Sphere { public static final double PI = 3.14159; public static double…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 174

Multiple choice Writing Classes
Consider the following class Pentagon, which represents a regular pentagon: public class Pentagon { public static final double GOLDEN_RATIO = (1 +…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 175

Free response Writing Classes
This question involves an implementation of a system, represented by the class Car, that tracks a car's fuel usage and average gas mileage. The class Car…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 176

Multiple choice Writing Classes
Consider the following method: private int swap(int a, int b) { if (a < b) { b = a; a = b; } return b - a; } What are…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 177

Multiple choice Writing Classes
Consider the following class Particle: public class Particle { public static final int START_POS = 100; private double velocity; private…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 178

Multiple choice Writing Classes
Consider the following class: public class Game { private static int bestScore; private int score; private String player; // constructors and methods not shown…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 179

Multiple choice Writing Classes
public class BookInfo { private String title; private String author; private int numPages; // constructor not shown public String toString() { return title + "…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 180

Multiple choice Writing Classes
Consider the following classes: public class BookInfo { private String title; private String author; private int numPages; // constructor not shown public…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 171 of 402
Page 18 of 41