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 91–100 of 546
  1. 91
  2. 92
  3. 93
  4. 94
  5. 95
  6. 96
  7. 97
  8. 98
  9. 99
  10. 100

Question 91

Multiple choice Using Objects
What will this method call output given yesOrNo(true)? public String…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 92

Multiple choice Using Objects
Given the following call, what value would be returned for findTheMiddle(2110890125)? public static String findTheMiddle(int number) { String stringNum = "" +…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 93

Multiple choice Using Objects
What will the following code output when executed? String breakfast = new String("Pizza"); String lunch = new String("Pizza"); String dinner = breakfast; if…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 94

Multiple choice Using Objects
The following code is intended to return only even numbers. If an even number is passed to the method, it should return that number. If an odd number or zero is…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 95

Multiple choice Using Objects
Given the following statements, which options will print true? String ursa = new String("2849"); String major = new String("2849"); I.…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 96

Multiple choice Using Objects
The following method is designed to return true if the passed phrase contains either the word cat or dog. public boolean containsPet(String input){ if…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 97

Multiple choice Using Objects
What will the following code output when executed? String word = "elementary"; if (word.length() > 8) { System.out.println("Long Word"); } if…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 98

Multiple choice Using Objects
What is…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 99

Multiple choice Using Objects
What does this method call output? public double doubleOrNothing(double…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 100

Free response Using Objects

Given a string name, e.g. "Bob", return a greeting of the form "Hello Bob!".

helloName("Bob") → "Hello Bob!"
helloName("Alice") → "Hello Alice!"
helloName("X") → "Hello X!"

public String helloName(String name) {
}
The answer and the full solution open in a window.
Question 91 of 546
Page 10 of 55