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.

Subtopic: Iteration Clear filter

Questions 141–150 of 376
  1. 141
  2. 142
  3. 143
  4. 144
  5. 145
  6. 146
  7. 147
  8. 148
  9. 149
  10. 150

Question 141

Multiple choice Iteration
What does the following method return for n = 7? public static boolean check(int n) { if (n < 2)…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 142

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 143

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 144

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 145

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 146

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 147

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 148

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 149

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 150

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 141 of 376
Page 15 of 38