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 321–330 of 692
  1. 321
  2. 322
  3. 323
  4. 324
  5. 325
  6. 326
  7. 327
  8. 328
  9. 329
  10. 330

Question 321

Multiple choice Iteration
public static int countDown(int start) { int count = 0; for (int i =…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 322

Multiple choice Boolean Expressions
public static boolean isSpecial(int num) { return num…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 323

Multiple choice Iteration
public static int process(int limit) { int total = 0; for (int i = 1;i <=…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 324

Multiple choice Iteration
public static String buildPattern(int rows) { String result = ""; for (int i = 1;i <= rows;i++) { for…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 325

Multiple choice Boolean Expressions
public static int findMax(int num1, int num2, int num3) { int max = num1; if (num2 > num1) max = num2; if (num3 >…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 326

Multiple choice Iteration
public static int trace(int num) { int result = 0; while (num > 1) { if (num % 2 == 0)…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 327

Multiple choice Iteration
public static String encrypt(String word) { String result = ""; for (int i = 0;i < word.length();i++) { if (i % 2 == 0) { result + =…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 328

Multiple choice Boolean Expressions
What is printed?
int x = 4, y = 10, z = 4;
boolean a = !(x > y) && !(z == x);
boolean b = (x < y) || (z > x);
boolean c = !(x == z || y < x);
System.out.println(a + " " + b + " " + c);
Pick an answer, then check it. The solution opens in a window.

Question 329

Multiple choice Iteration
What is printed?
int n = 100;
int count = 0;
while (n > 1)
{
    n = n / 2;
    count++;
}
System.out.println(count);
Pick an answer, then check it. The solution opens in a window.

Question 330

Multiple choice Boolean Expressions
What is printed?
int x = 8;
boolean c1 = (x > 5 && x < 8);
boolean c2 = !(x >= 10) || x == 8;
boolean c3 = (x < 0 || x > 12) && x != 8;
System.out.println(c1 + " " + c2 + " " + c3);
Pick an answer, then check it. The solution opens in a window.
Question 321 of 692
Page 33 of 70