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 61–70 of 376
  1. 61
  2. 62
  3. 63
  4. 64
  5. 65
  6. 66
  7. 67
  8. 68
  9. 69
  10. 70

Question 61

Multiple choice Iteration
The following fragment intends that a user will enter a list of positive integers at the keyboard and terminate the list with a sentinel. int value = 0; final…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 62

Multiple choice Iteration
Consider this code segment. int x = 10, y = 0; while (x > 5) { y = 3; while (y < x) { y *= 2; if (y % x == 1)…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 63

Multiple choice Iteration
What output will be produced by this code segment? (Ignore spacing.) for (int i = 5; i >=…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 64

Multiple choice Iteration
Consider this program segment. int newNum = 0, temp; int num = k; //k is some predefined integer value ≥ 0 while (num > 10) { temp = num % 10; num /= 10; newNum…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 65

Multiple choice Iteration
Consider the method reverse. /** Returns n with its digits reversed. * - Example: If n = 234, method reverse returns 432. * - Precondition: n > 0. */ int…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 66

Multiple choice Iteration
Consider the following output: 0 1 0 2 4 0 3 6 9 0 4 8 12 16 Which of the following code segments will produce this output? (A) for (int x = 1; x < 5; x++) {…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 67

Multiple choice Iteration
Consider the following code segment: while ((x > y) || y >= z) { System.out.print("*"); } In the code segment above,…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 68

Multiple choice Iteration
Consider the following code segment: int a = 0; for (int i = 0; i < 10; i++) { for (int k = 0; k <= 5; k++)…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 69

Multiple choice Iteration
Consider the following code segment. int count = 1; int value = 31; while (value >= 10) { value = value -…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 70

Multiple choice Iteration
Consider the following code segment. int incr = 1; for (int i = 0; i < 10; i+= incr) {…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 61 of 376
Page 7 of 38