Verityprep
Question Bank

AP® Computer Science A Multiple Choice Questions

Work through AP Computer Science A multiple-choice 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 421–430 of 2,811
  1. 421
  2. 422
  3. 423
  4. 424
  5. 425
  6. 426
  7. 427
  8. 428
  9. 429
  10. 430

Question 421

Multiple choice Unit 1: Using Objects and Methods
Consider the following code segment.
int n = 6;
n += n * 2;
n -= n / 4;
System.out.println(n);
What is printed when the code segment executes?
Pick an answer, then check it. The solution opens in a window.

Question 422

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 423

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 424

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 425

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 426

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 427

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 428

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 429

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 430

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 421 of 2,811
Page 43 of 282