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 381–390 of 546
  1. 381
  2. 382
  3. 383
  4. 384
  5. 385
  6. 386
  7. 387
  8. 388
  9. 389
  10. 390

Question 381

Multiple choice Using Objects
Consider the following method. public static String classify(int n) { if (n < 0) { return "neg"; } else if (n == 0) { return "zero"; } else if (n < 10) { return…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 382

Multiple choice Using Objects
Consider the following code segment. String s = "abracadabra"; int p = s.indexOf("ab", 1); int c = s.indexOf("c");…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 383

Multiple choice Using Objects
Consider the following code segment. String a = "hello"; String b = "he" + "llo"; String c = "he"; String d = c +…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 384

Multiple choice Using Objects
Consider the following code segment. String s = "Computer Science A"; int p = s.indexOf(" "); int q = s.indexOf(" ", p + 1); String first = s.substring(0, p);…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 385

Multiple choice Using Objects
Consider the following declarations.
String s1 = "AP";
String s2 = s1 + "CSA";
String s3 = "APCSA";
Which of the following statements must be true?
Pick an answer, then check it. The solution opens in a window.

Question 386

Multiple choice Using Objects
Consider the following code segment. String code = "practice"; String part =…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 387

Multiple choice Using Objects
Consider the following code segment. String a = "cat"; String b = "car"; boolean x = a.compareTo(b) > 0;…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 388

Multiple choice Using Objects
What is printed by the following code segment? String s…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 389

Multiple choice Using Objects
Consider the following code segment.
String s = "computer";
String t = s.substring(0, s.indexOf("u")) + s.substring(5);
What value is stored in t ?
Pick an answer, then check it. The solution opens in a window.

Question 390

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

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 381 of 546
Page 39 of 55