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 1–10 of 376
  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
  8. 8
  9. 9
  10. 10

Question 1

Multiple choice Iteration
Which of the following code…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2

Multiple choice Iteration
Consider the following two code segments. Assume that the int variables m and n have been properly declared and initialized and are both greater than 0. I. for…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 3

Multiple choice Iteration
Consider the following code segment. Assume that num3 > num2 > 0. int num1 = 0; int num2 = /* initial value not shown */; int num3 = /* initial value not…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 4

Multiple choice Iteration
Consider the following code segment. for (int r = 3; r > 0; r--) { int c; for (c = 1; c < r; c++) { System.out.print("-"); } for…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 5

Multiple choice Iteration
Consider the following code segment. for (int outer = 1; outer <= 6; outer++) { for (int inner = outer; inner <= 6; inner++) { if…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 6

Multiple choice Iteration
Consider the following code segment. int count = 0; for (int x = 0; x < 4; x++) { for (int y = x; y < 4;…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 7

Multiple choice Iteration
Consider the following code segment. int value = 15; while (value < 28) {…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 8

Multiple choice Iteration
int k = a random number such that 1 ≤ k ≤ n ; for (int p = 2; p <= k; p++) for (int r = 1; r < k;…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 9

Multiple choice Iteration
Consider the following code segment. int k = 0; while (k < 10) { System.out.print((k % 3) + " ");…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 10

Multiple choice Iteration
Consider the following code segment. for (int outer = 0; outer < n; outer++) { for (int inner = 0; inner <= outer; inner++) {…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 1 of 376
Page 1 of 38