Verityprep
Question Bank · Unit 1

AP® Computer Science A Using Objects and Methods Multiple Choice Questions

Work through AP Computer Science A multiple-choice 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.

Subtopic: Using Objects Clear filter

Questions 1–10 of 454
  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
  8. 8
  9. 9
  10. 10

Question 1

Multiple choice Using Objects
Consider the method getHours, which is intended to calculate the number of hours that a vehicle takes to travel between two mile markers on a highway if the…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2

Multiple choice Using Objects
Consider the following method. public static void message(int a, int b, int c) { if (a < 10) { if (b < 10) { System.out.print("X"); }…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 3

Multiple choice Using Objects
Consider the following method. public static void printSome(int num1, int num2) { for (int i = 0;i < num1;i++) { if (i % num2…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 4

Multiple choice Using Objects
The following categories are used by some researchers to categorize zip codes as urban, suburban, or rural based on population density. An urban zip code is a…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 5

Multiple choice Using Objects
Consider the following code segment. Assume that a is greater than zero. int a = / * value not shown * /; int b = a +…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 6

Multiple choice Using Objects
Consider the following method. public static String rearrange(String str) { String temp = ""; for (int i = str.length() - 1;i >…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 7

Multiple choice Using Objects
Consider the following method. public static String abMethod(String a, String b) { int x = a.indexOf(b); while (x >= 0) { a = a.substring(0, x) +…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 8

Multiple choice Using Objects
Consider the following methods. /** Precondition: a > 0 and b > 0 */ public static int methodOne(int a, int b) { int loopCount = 0; for (int i = 0; i < a / b;…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 9

Multiple choice Using Objects
Consider the following incomplete method, which is intended to return the number of integers that evenly divide the integer inputVal. Assume that inputVal is…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 10

Multiple choice Using Objects
Consider the following method, which is intended to return true if at least one of the three strings s1, s2, or s3 contains the substring "art". Otherwise, the…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 1 of 454
Page 1 of 46