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 41–50 of 776
  1. 41
  2. 42
  3. 43
  4. 44
  5. 45
  6. 46
  7. 47
  8. 48
  9. 49
  10. 50

Question 41

Multiple choice Primitive Types
Consider the following code segment. double x = 5 * 4 / 2 - 5 / 2 * 4;…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 42

Multiple choice Using Objects
Assume that String variables str1 and str2 have been properly declared and initialized. Which of the following boolean expressions…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 43

Multiple choice Using Objects
Which of the following methods are equivalent (always return the same value for the same values of input parameters)? I. public boolean fun(int a, int b, int c)…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 44

Multiple choice Using Objects
Consider the following code segment. int n = IO.readInt(); // read an int value n = Math.abs(n); while (n >=…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 45

Multiple choice Using Objects
Consider the following code segment. int x = (int) (2 * Math.random()) + (int) (2 *…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 46

Multiple choice Using Objects
Consider the following method, which prints a message depending on whether the equation \(x^2 + bx + c = 0\) has a positive solution. public static void…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 47

Multiple choice Primitive Types
What is printed when the following statement is…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 48

Multiple choice Using Objects
Consider the following method. / * * Returns the greatest common divisor of a and b. * Precondition: a > 0 and b > 0 * / public static int gcd(int a, int b)…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 49

Multiple choice Primitive Types
The statement System.out.println (Integer.MAX_VALUE); prints 2147483647. What…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 50

Multiple choice Primitive Types
Which of the following…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 41 of 776
Page 5 of 78