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.

Questions 131–140 of 692
  1. 131
  2. 132
  3. 133
  4. 134
  5. 135
  6. 136
  7. 137
  8. 138
  9. 139
  10. 140

Question 131

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 132

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 133

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 134

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 135

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 136

Multiple choice Boolean Expressions
The speed limit of a stretch of highway is 55 miles per hour (mph). The highway patrol issues speeding tickets to anyone caught going faster than 55 miles per…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 137

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 138

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 139

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 140

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 131 of 692
Page 14 of 70