Verityprep
Question Bank · Unit 3

AP® Computer Science A Class Creation Multiple Choice Questions

Work through AP Computer Science A multiple-choice 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 41–50 of 359
  1. 41
  2. 42
  3. 43
  4. 44
  5. 45
  6. 46
  7. 47
  8. 48
  9. 49
  10. 50

Question 41

Multiple choice Writing Classes
Ashanti has decided to write and test her own version of the indexOf method, which takes two strings as parameters: /** Returns the first index k such that…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 42

Multiple choice Writing Classes
Ashanti has decided to write and test her own version of the indexOf method, which takes two strings as parameters: /** Returns the first index k such that…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 43

Multiple choice Writing Classes
Given the code snippet, public class Pokemon { private String name; private int health; public Pokemon(String name, int health) { name = name;…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 44

Multiple choice Writing Classes
Given an instance of the Athlete class called athlete, what is the proper way to set the value of the jersey number after it has been instantiated? public class…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 45

Multiple choice Writing Classes
Given an instance of the Athlete class called athlete, what is the proper way to get the value of the jersey number? public class Athlete { private String…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 46

Multiple choice Writing Classes
Given this Athlete class, which of the following setter methods for the jersey variable is correct? public class Athlete { private String first_name; private…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 47

Multiple choice Writing Classes
Mark the valid way to create an instance of Foo given the following code: public class Foo { int bar; String…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 48

Multiple choice Writing Classes
Given the following definition for the class Athlete: public class Athlete { String first_name; String last_name; int jersey; public Athlete(String first_name,…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 49

Multiple choice Writing Classes
Which methods of class Foo can be called without an actual instance of the class Foo? public…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 50

Multiple choice Writing Classes
Given the following code: public class TvShow { private String name; private int channel; public TvShow (String name, int channel) { this.name = name;…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 41 of 359
Page 5 of 36