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 861–870 of 2,811
  1. 861
  2. 862
  3. 863
  4. 864
  5. 865
  6. 866
  7. 867
  8. 868
  9. 869
  10. 870

Question 861

Multiple choice Unit 2: Selection and Iteration
Consider the following code segment. int num1 = value1, num2 = value2, num3 = value3; while (num1 > num2 || num1 > num3) { /* body of loop */ } You may…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 862

Multiple choice Unit 2: Selection and Iteration
Consider the following code segment. for (int n = 25; n >= 0; n /= 2)…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 863

Multiple choice Unit 2: Selection and Iteration
Consider the following loop, where n is some positive integer. for (int i = 0; i < n; i += 2) { if (/* test */) /* perform some…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 864

Multiple choice Unit 2: Selection and Iteration
Consider the code segment if (n == 1) k++; else if (n == 4) k += 4; Suppose that the given segment is rewritten in the form if (/* condition */) /* assignment…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 865

Multiple choice Unit 2: Selection and Iteration
Consider the following code snippet: public class Main { public static void main(String[] args) { boolean a = true; boolean…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 866

Multiple choice Unit 2: Selection and Iteration
Consider the following code segment: int i = 2; for (int k = 0; k <= 12; k += i) {…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 867

Multiple choice Unit 2: Selection and Iteration
Consider the following code segment: int a = 1, b = 2; for (int k = 1; k <= 2; k++) { int oldA = a; a…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 868

Multiple choice Unit 2: Selection and Iteration
Assume that the int variables a and b have been properly declared and initialized. For which of the following pairs of values of a and b is the…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 869

Multiple choice Unit 2: Selection and Iteration
Consider the following code segment, which is supposed to calculate and print the sum of the numbers from 1 to 20: int count = 0,…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 870

Multiple choice Unit 2: Selection and Iteration
Assume that the boolean variables x, y, and z have been properly declared and initialized. Given that x is true, y is true, and…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 861 of 2,811
Page 87 of 282