Verityprep
Question Bank · Unit 2

AP® Computer Science A Selection and Iteration Practice Questions

Work through AP Computer Science A practice 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 301–310 of 740
  1. 301
  2. 302
  3. 303
  4. 304
  5. 305
  6. 306
  7. 307
  8. 308
  9. 309
  10. 310

Question 301

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 302

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 303

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 304

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 305

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 306

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 307

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 308

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 309

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 310

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 301 of 740
Page 31 of 74