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 1–10 of 402
  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
  8. 8
  9. 9
  10. 10

Question 1

Multiple choice Writing Classes
Consider the following class definition. public class Bird { private String species; private String color; private boolean canFly; public Bird(String str,…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2

Multiple choice Writing Classes
Consider the following class definition. public class Points { private double num1; private double num2; public Points(int n1, int n2) // Line 6 { num1 = n1; //…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 3

Multiple choice Writing Classes
Consider the following class definitions. public class Person { private String name; public String getName() { return name; } } public class Book { private…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 4

Multiple choice Writing Classes
Consider the following class definition. public class SomeClass { private int x = 0; private static int y = 0; public SomeClass(int pX) { x = pX; y++; } public…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 5

Multiple choice Writing Classes
Consider the following class. public class SomeMethods { public void one(int first) { /* implementation not shown */ } public void one(int first, int second) {…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 6

Multiple choice Writing Classes
Consider the following two methods, which appear within a single class. public static void changeIt(int[] arr, int val, String word) { arr = new int[5]; val =…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 7

Multiple choice Writing Classes
Consider the following class declaration. public class StudentInfo { private String major; private int age; public String getMajor() { return major; } public…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 8

Multiple choice Writing Classes
Consider the following instance variables and incomplete method that are part of a class that represents an item. The variables years and months are used to…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 9

Multiple choice Writing Classes
Consider the following class declaration. public class SomeClass { private int num; public SomeClass(int n) { num = n; } public void increment(int more) { num =…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 10

Multiple choice Writing Classes
Consider the following two methods that appear within a single class. public void changeIt(int[] list, int num) { list = new int[5]; num = 0; for (int x = 0; x…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 1 of 402
Page 1 of 41