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 191–200 of 692
  1. 191
  2. 192
  3. 193
  4. 194
  5. 195
  6. 196
  7. 197
  8. 198
  9. 199
  10. 200

Question 191

Multiple choice Boolean Expressions
Assume that the boolean variables a, b, and c have been properly declared and initialized. Which of…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 192

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 193

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 194

Multiple choice Boolean Expressions
Consider the following expressions, where x and y are boolean variables with different values: I. (x || y) && (!x ||…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 195

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 196

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 197

Multiple choice Boolean Expressions
Consider the following method: private double compute(int x, int y) { double r = 0; if (!(y == 0 || x / y <= 2)) { r = 1 /…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 198

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 199

Multiple choice Boolean Expressions
When is the following Boolean expression…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 200

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 191 of 692
Page 20 of 70