Verityprep
Question Bank

AP® Computer Science A Practice Questions

Work through AP Computer Science A practice questions unit by unit, 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.

Questions 531–540 of 3,140
  1. 531
  2. 532
  3. 533
  4. 534
  5. 535
  6. 536
  7. 537
  8. 538
  9. 539
  10. 540

Question 531

Multiple choice Unit 1: Using Objects and Methods
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 532

Multiple choice Unit 1: Using Objects and Methods
Consider the following code segment. int n = 25; int m = 4; double r = (n + 1) / m * 1.0…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 533

Multiple choice Unit 1: Using Objects and Methods
Consider the following code segment. int x = 4; int y = x++; y += ++x; x *= y -…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 534

Multiple choice Unit 1: Using Objects and Methods
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 535

Multiple choice Unit 1: Using Objects and Methods
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 536

Multiple choice Unit 1: Using Objects and Methods
Consider the following code segment. int a = 18; int b = 5; double x = a…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 537

Multiple choice Unit 1: Using Objects and Methods
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 538

Multiple choice Unit 1: Using Objects and Methods
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 539

Multiple choice Unit 1: Using Objects and Methods
Consider the following code segment. Integer n = new Integer(7); Double d = new…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 540

Multiple choice Unit 1: Using Objects and Methods
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 531 of 3,140
Page 54 of 314