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.

Questions 21–30 of 359
  1. 21
  2. 22
  3. 23
  4. 24
  5. 25
  6. 26
  7. 27
  8. 28
  9. 29
  10. 30

Question 21

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 22

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 23

Multiple choice Writing Classes
Mark the valid way to create an instance of Athlete given the following Athlete class definition: public class Athlete { String first_name; String last_name;…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 24

Multiple choice Writing Classes
Class members that should be public are I. Constructors II. Instance Variables III. Accessors/Mutators IV. Methods…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 25

Multiple choice Writing Classes
Which of the following is a…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 26

Multiple choice Writing Classes
Suppose you have the following methods defined public double increaseWidth(double num){ num += 10; return num; } public double increaseWidth(Rectangle rect){…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 27

Multiple choice Writing Classes
What would be printed the first time printPhrases was called from main? public class PrintQuestion { private static String…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 28

Multiple choice Writing Classes
What would the value of the static variable phrase be after the first time printPhrases was called from main? public class PrintQuestion { private…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 29

Multiple choice Writing Classes
Consider the following method and code segment in the same class. public void process (String s) { s = s.substring(2, 3) +…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 30

Multiple choice Writing Classes
Consider the following method. public int guess(int num1, int num2) { if (num1 % num2 == 0) return num2; else return…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 21 of 359
Page 3 of 36