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 371–380 of 546
  1. 371
  2. 372
  3. 373
  4. 374
  5. 375
  6. 376
  7. 377
  8. 378
  9. 379
  10. 380

Question 371

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 372

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 373

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 374

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 375

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 376

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 377

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 378

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 379

Multiple choice Using Objects
Consider the following code segment.
String s = "alphabet";
int x = s.length() - s.indexOf("bet");
System.out.println(x);
What is printed when the code segment executes?
Pick an answer, then check it. The solution opens in a window.

Question 380

Multiple choice Using Objects
Consider the following code segment. int x = 18; int count = 0; while (x > 2) { x = x / 2;…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 371 of 546
Page 38 of 55