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 261–270 of 692
  1. 261
  2. 262
  3. 263
  4. 264
  5. 265
  6. 266
  7. 267
  8. 268
  9. 269
  10. 270

Question 261

Multiple choice Iteration
A method with parameter int n must return true if and only if n is a perfect square,…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 262

Multiple choice Boolean Expressions
What is the output of this code? int a = 2, b = 3, c = 4; if (a < b && b < c) a = b +…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 263

Multiple choice Iteration
What is the output of the following code? int x = 100; while (x > 1) { if (x %…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 264

Multiple choice Iteration
Consider the following method: public static String build(int n) { String s = ""; for (int i = 1; i <= n; i++) { for…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 265

Multiple choice Iteration
What is printed when the following code executes? int n = 256; int…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 266

Multiple choice Iteration
What is the value of result after the…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 267

Multiple choice Iteration
What is printed by the following code? int x = 1; while (x < 30)…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 268

Multiple choice Iteration
What is the value of sum? int sum = 0; for (int i = 1; i…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 269

Multiple choice Iteration
What is printed? String s = "mississippi"; int count = 0; for (int i = 0; i < s.length() - 1;…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 270

Multiple choice Iteration
Consider the following method. What does mystery(18) return? public static int mystery(int n) {…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 261 of 692
Page 27 of 70