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 431–440 of 2,811
  1. 431
  2. 432
  3. 433
  4. 434
  5. 435
  6. 436
  7. 437
  8. 438
  9. 439
  10. 440

Question 431

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 432

Multiple choice Unit 1: Using Objects and Methods
Consider the following code segment.
double r = 7.5 % 2.0;
int q = 17 % 5;
System.out.println(r + " " + q);
What is printed when the code segment executes?
Pick an answer, then check it. The solution opens in a window.

Question 433

Multiple choice Unit 1: Using Objects and Methods
Consider the following code segment.
int x = 6;
x += 2;
x *= x - 3;
x -= 10;
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 434

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

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

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

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

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

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

Multiple choice Unit 1: Using Objects and Methods
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 431 of 2,811
Page 44 of 282