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 251–260 of 692
  1. 251
  2. 252
  3. 253
  4. 254
  5. 255
  6. 256
  7. 257
  8. 258
  9. 259
  10. 260

Question 251

Multiple choice Iteration
What is the value of result after the following executes? String result = "";…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 252

Multiple choice Iteration
What is the value of sum after the following executes? int sum =…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 253

Multiple choice Boolean Expressions
Which of the following boolean…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 254

Multiple choice Iteration
Consider the following code: int count = 0; for (int i = 0; i < 4; i++) { for…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 255

Multiple choice Iteration
What is the output of the following code? int n = 4; for (int i = 1; i <= n; i++)…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 256

Multiple choice Iteration
Which of the following code segments correctly counts the number of vowels in a String s? (Assume lowercase only.) // Segment I int count = 0; for (int i = 0; i…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 257

Multiple choice Iteration
Consider the following method that is supposed to check whether a String is a palindrome. public static boolean isPalindrome(String s) { int left = 0, right =…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 258

Multiple choice Iteration
What does the following method return when called as mystery(6)? public static int mystery(int…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 259

Multiple choice Iteration
The following code is meant to find the GCD of two positive integers using Euclid's algorithm. Which correctly completes…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 260

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 251 of 692
Page 26 of 70