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.

Subtopic: Using Objects Clear filter

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

Question 21

Multiple choice Using Objects
Assume that the following variable declarations have been made. double d = Math.random(); double r; Which…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 22

Multiple choice Using Objects
Consider the following instance variables and method that appear in a class representing student information. private int assignmentsCompleted; private double…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 23

Multiple choice Using Objects
Consider the following method. public int sol(int lim) { int s = 0; for (int outer = 1;outer <= lim;outer++) { for…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 24

Multiple choice Using Objects
Consider the following code segment public static void test(int[] a, int y) { if (a.length > 1) { a[1] = a[1] * 2; y…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 25

Multiple choice Using Objects
Given the following code: String s1 = new String("bye"); String s2 = new String("bye now"); String s3 = s2.substring(0,…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 26

Multiple choice Using Objects
What is the output from the following code? String s = "Computer Science is fun!"; String s1 =…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 27

Multiple choice Using Objects
Consider the following method. public static boolean outOfRange(int value) { if (value < 0 || value > 100) return true; else return false; } Which of the…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 28

Multiple choice Using Objects
Consider the following method. public void sample(int num1, int num2) { int result = 99; if (num1 == num2) {result = 0;} else if (num1>num2){result = 1;} else…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 29

Multiple choice Using Objects
Consider the following method. public static void conditionTest(int num1, int num2) { if ((num1>0) && (num2>0)) { if (num1>num2) System.out.println("A"); else…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 30

Multiple choice Using Objects
What is the output from the following code? String s = "Computer Science is fun!"; String s1 =…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 21 of 546
Page 3 of 55