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 311–320 of 692
  1. 311
  2. 312
  3. 313
  4. 314
  5. 315
  6. 316
  7. 317
  8. 318
  9. 319
  10. 320

Question 311

Multiple choice Iteration
int x = (int)(Math.random() * 10); while (x < 5) { System.out.print(x + " "); x =…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 312

Multiple choice Iteration
Consider the following code. int x = (int)(Math.random() * 5); while (x > 0) {…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 313

Multiple choice Iteration
Consider the following code. int x = 0; while (x < 5) {…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 314

Multiple choice Boolean Expressions
Consider the following code. int x = 4; int y = 1; while…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 315

Multiple choice Boolean Expressions
public static String classify(int score) { String result = ""; if (score >= 90) result = "A"; if…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 316

Multiple choice Iteration
public static int mystery(int x) { int y = 1; while (x > 1 && y <…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 317

Multiple choice Boolean Expressions
public static boolean check(int num) { return num > 0 && num % 2…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 318

Multiple choice Boolean Expressions
public static String evaluate(int temperature, boolean isRaining) { String result; if (temperature > 30 && !isRaining) { result = "beach"; }…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 319

Multiple choice Boolean Expressions
Consider the following boolean expression: !(x >…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 320

Multiple choice Iteration
public static int mystery(int value) { int result = 0; while (value > 0) {…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 311 of 692
Page 32 of 70