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 511–520 of 3,140
  1. 511
  2. 512
  3. 513
  4. 514
  5. 515
  6. 516
  7. 517
  8. 518
  9. 519
  10. 520

Question 511

Multiple choice Unit 1: Using Objects and Methods
Consider the following code segment. int a = 3, b = 4; System.out.println("sum: " + a +…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 512

Multiple choice Unit 1: Using Objects and Methods
Consider the following code segment. int r = Math.abs(-3 * 4) -…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 513

Multiple choice Unit 1: Using Objects and Methods
Consider the following code segment. String s = "Computer Science";…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 514

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

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

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

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

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

Multiple choice Unit 1: Using Objects and Methods
Consider the following code segment. int a = 7; int b = 2; double result = a / b +…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 520

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