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 91–100 of 376
  1. 91
  2. 92
  3. 93
  4. 94
  5. 95
  6. 96
  7. 97
  8. 98
  9. 99
  10. 100

Question 91

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

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

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

Multiple choice Iteration
Consider the following code segment. int n = 1, d = 1, s = 1; while (n <= 5) { System.out.print(s +…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 95

Multiple choice Iteration
Consider the following code segment: int num = 5; while (num >= 0) { num -=…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 96

Multiple choice Iteration
I. int i = 1; while (i II. for (int i = 0; i < 5; i++) { System.out.print(2*i + 1); } III. for…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 97

Multiple choice Iteration
Consider the following code segment: int x = <integer value>, y = <another integer value>; while (x > y && x % y != 0) { x -=…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 98

Multiple choice Iteration
What is printed when the following code segment is executed? int sum = 0, d = -1; for (int count =…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 99

Multiple choice Iteration
Consider the following method: /* * Returns the number of times the digit d occurs in the decimal representation of * Precondition: n and d are non-negative…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 100

Multiple choice Iteration
Which of the following code segments will produce the following output? 1 22 333 4444 Code Segments: I. for (int i = 1; i < 5; i++) { for (int j = i; j > 0;…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 91 of 376
Page 10 of 38