Verityprep
Question Bank · Unit 2

AP® Computer Science A Selection and Iteration Multiple Choice Questions

Work through AP Computer Science A multiple-choice questions on Selection and Iteration, 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.

Subtopic: Iteration Clear filter

Questions 81–90 of 376
  1. 81
  2. 82
  3. 83
  4. 84
  5. 85
  6. 86
  7. 87
  8. 88
  9. 89
  10. 90

Question 81

Multiple choice Iteration
Consider the following code segment. for (int j = 0; j < 10; j++) { for (int k = 10; k > j; k--) {…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 82

Multiple choice Iteration
Consider the following code segment. boolean b1 = true; boolean b2 = true; int x = 7; while (b1 || b2) { if (x > 4) {…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 83

Multiple choice Iteration
Which of the following three code segments will produce the same output? I. int i = 1; while (i < 12) { System.out.print(i + " "); i *= 2; } II. for…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 84

Multiple choice Iteration
Consider the following code segment. double count = 6.0; for (int num = 0; num < 5; num++) { if (count != 0 && num /…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 85

Multiple choice Iteration
Consider the following code segment. double tabulate = 100.0; int repeat = 1; while (tabulate > 20) { tabulate = tabulate…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 86

Multiple choice Iteration
Refer to the following program segment. for (int n = 50; n > 0; n = n / 2)…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 87

Multiple choice Iteration
Consider the following static method. public static int compute(int n) { for (int i = 1; i < 4; i++) n *= n; return n; } Which of…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 88

Multiple choice 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 89

Multiple choice 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 90

Multiple choice 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 81 of 376
Page 9 of 38