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 171–180 of 692
  1. 171
  2. 172
  3. 173
  4. 174
  5. 175
  6. 176
  7. 177
  8. 178
  9. 179
  10. 180

Question 171

Multiple choice Iteration
Consider the following code segment. for (int j = 0; j < 10; j++) { for (int k = 10; k > j; k--) {…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 172

Multiple choice Iteration
Consider the following code segment. boolean b1 = true; boolean b2 = true; int x = 7; while (b1 || b2) { if (x > 4) {…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 173

Multiple choice Iteration
Which of the following three code segments will produce the same output? I. int i = 1; while (i < 12) { System.out.print(i + " "); i *= 2; } II. for…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 174

Multiple choice Iteration
Consider the following code segment. double count = 6.0; for (int num = 0; num < 5; num++) { if (count != 0 && num /…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 175

Multiple choice Iteration
Consider the following code segment. double tabulate = 100.0; int repeat = 1; while (tabulate > 20) { tabulate = tabulate…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 176

Multiple choice Boolean Expressions
If a, b, and c are integers, which of the following conditions is sufficient…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 177

Multiple choice Boolean Expressions
Consider the following code segment. int num = 0, score = 10; if (num != 0 && score / num >…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 178

Multiple choice Iteration
Refer to the following program segment. for (int n = 50; n > 0; n = n / 2)…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 179

Multiple choice Iteration
Consider the following static method. public static int compute(int n) { for (int i = 1; i < 4; i++) n *= n; return n; } Which of…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 180

Multiple choice Iteration
Consider the following code segment. int num1 = value1, num2 = value2, num3 = value3; while (num1 > num2 || num1 > num3) { /* body of loop */ } You may…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 171 of 692
Page 18 of 70