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 121–130 of 376
  1. 121
  2. 122
  3. 123
  4. 124
  5. 125
  6. 126
  7. 127
  8. 128
  9. 129
  10. 130

Question 121

Multiple choice Iteration
Consider the following code segment: while ((x > y) || y >= z) { //code not shown } In the code segment above,…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 122

Multiple choice Iteration
Consider the following code segment: int x = 10; int y = x / 3; int z = x % 2; x++;…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 123

Multiple choice Iteration
Consider the following code segments: I. int x = 10; int y = 20; int z = 0; if (x < y && 10 < y/z) { System.out.println("Homer"); } else {…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 124

Multiple choice Iteration
Consider the following code segment: int sum = 0; for (int i = 1; i <= 5; i++) { if (i % 2 ==…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 125

Multiple choice Iteration
Consider the following code segment. for (int j = 4; j > 0; j--) { for (/* missing code */) { System.out.print(k + " "); } System.out.println(); } This code…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 126

Multiple choice Iteration
Consider the following code segment. int j = 1; while (j < 4) { for (int k = 0; k <= 4; k++) {…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 127

Multiple choice Iteration
A programmer has mistakenly placed a semicolon at the end of the while statement in the following code fragment. What will be the result of…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 128

Multiple choice Iteration
Consider the following code segment: Line 1: int count = 0; Line 2: for (int i = 0; i < 3; i++) Line 3: { Line 4: int j = 0; Line 5: while (j <…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 129

Multiple choice Iteration
How many times is "Hello" printed by the following code? for (int i = 1; i…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 130

Multiple choice Iteration
Consider the following code segment. What is the final value of product? int…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 121 of 376
Page 13 of 38