Verityprep
Question Bank · Unit 1

AP® Computer Science A Using Objects and Methods Practice Questions

Work through AP Computer Science A practice questions on Using Objects and Methods, 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 111–120 of 776
  1. 111
  2. 112
  3. 113
  4. 114
  5. 115
  6. 116
  7. 117
  8. 118
  9. 119
  10. 120

Question 111

Multiple choice Using Objects
Consider the following class: public class RaffleTicket { private String ownerName; private int ticketNum; public RaffleTicket(String name) { ownerName = name;…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 112

Multiple choice Using Objects
Consider the following class: public class RandomCalculator { private int x; private int y; public RandomCalculator(int one, int two) { x = one; y = two; }…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 113

Multiple choice Using Objects
Consider the following code segment: String str = "I am"; str += 10 + 3; String age = "years…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 114

Multiple choice Using Objects
Which of the following code segments would correctly assign word from the String sentence = "Grab the last word" to the variable lastWord? I. String lastWord =…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 115

Multiple choice Using Objects
Consider the following class: public class Greetings { private String greetings; public Greetings(String greeting) { greetings = greeting;…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 116

Multiple choice Using Objects
A science teacher wants to create an Elements class for the Periodic Table. They want to include several attributes to the Elements class: the atomic weight,…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 117

Multiple choice Using Objects
Which of the following will execute…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 118

Multiple choice Using Objects
Consider the following method. public void processString (String str) { str = str.substring(2, 3) + str.substring(1, 2) + str.substring(0, 1); } What is…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 119

Multiple choice Using Objects
Given String str = "RETRIEVER"; int index =…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 120

Multiple choice Using Objects
Consider the mystery method below. public static String mystery(String str1, String str2) { int index =…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 111 of 776
Page 12 of 78