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 251–260 of 546
  1. 251
  2. 252
  3. 253
  4. 254
  5. 255
  6. 256
  7. 257
  8. 258
  9. 259
  10. 260

Question 251

Multiple choice Using Objects
Consider the following expressions involving strings in Java: I. "Boston".equals(new String("Boston")); II. "Bos" + "ton" == new…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 252

Multiple choice Using Objects
Consider the following code segment: double pi = 3.14159; int r = 10; int area = (int)(pi *…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 253

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

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 254

Multiple choice Using Objects
Consider the following code segment: String phrase = "Hello, world!"; int index = phrase.indexOf("world"); if (index >= 0) {…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 255

Multiple choice Using Objects

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 256

Multiple choice Using Objects
Given the following code segment: String s = "ALASKA"; int…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 257

Multiple choice Using Objects
What is the result when the following code segment is compiled and executed?…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 258

Multiple choice Using Objects
Consider the following code segment. String s = "ban"; ArrayList<String> words = new ArrayList<String>(); words.add(s); words.add(s.substring(1));…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 259

Multiple choice Using Objects
Consider the following method. public int locate(String str, String oneLetter) { int j = 0; while (j < str.length() &&…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 260

Multiple choice Using Objects
Consider the following code segment. String a = "A"; String b = a;// Line 1 String c = a + 1;// Line 2 String d = b +…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 251 of 546
Page 26 of 55