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 281–290 of 454
  1. 281
  2. 282
  3. 283
  4. 284
  5. 285
  6. 286
  7. 287
  8. 288
  9. 289
  10. 290

Question 281

Multiple choice Using Objects
Consider the following code segment.
String s = "programming";
System.out.println(s.substring(3, 7) + "-" + s.indexOf("m"));
What is printed when the code segment executes?
Pick an answer, then check it. The solution opens in a window.

Question 282

Multiple choice Using Objects
Consider the following declarations. String s1 = "abc"; String s2 = new String("abc");…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 283

Multiple choice Using Objects
Consider the following code segment. String a = "apple"; String b = "apricot"; int r =…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 284

Multiple choice Using Objects
Consider the following code segment. String s = "keyboard";…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 285

Multiple choice Using Objects
Consider the following code segment. String email = "name.user@school.edu"; int at = email.indexOf("@"); String user =…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 286

Multiple choice Using Objects
Consider the following code segment.
int x = 3;
int y = 4;
System.out.println("score: " + x + y);
System.out.println("score: " + (x + y));
What is printed when the code segment executes?
Pick an answer, then check it. The solution opens in a window.

Question 287

Multiple choice Using Objects
Consider the following code segment. String word = "programming"; String a = word.substring(3); String b…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 288

Multiple choice Using Objects
Consider the following code segment. String s = "mississippi"; int p = s.indexOf("ss"); int q =…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 289

Multiple choice Using Objects
Consider the following code segment.
String a = "java";
String b = "java";
String c = new String("java");
System.out.println((a == b) + " " + (a == c) + " " + a.equals(c));
What is printed when the code segment executes?
Pick an answer, then check it. The solution opens in a window.

Question 290

Multiple choice Using Objects
Consider the following code segment. int x = 2; int y = 5; if (x < y && y % x == 1) { x = x + y; } if (x >…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 281 of 454
Page 29 of 46