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 151–160 of 376
  1. 151
  2. 152
  3. 153
  4. 154
  5. 155
  6. 156
  7. 157
  8. 158
  9. 159
  10. 160

Question 151

Multiple choice Iteration
This method computes the digit sum of a positive integer. What does it print when n = 156?…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 152

Multiple choice Iteration
What is printed? int total = 0; for (int i = 1; i <= 50; i++) { if (i…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 153

Multiple choice Iteration
What is printed? int count = 0; for (int i = 1; i <= 4; i++) { for…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 154

Multiple choice Iteration
What is printed? String s = "COMPUTER"; String result = ""; for (int i = 0; i <…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 155

Multiple choice Iteration
Consider the following method. public static int…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 156

Multiple choice Iteration
What is printed? int count = 0; for (int i = 1; i <= 50; i++) { if…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 157

Multiple choice Iteration
What is printed? int sum = 0; for (int i = 1; i <= 3; i++) { for…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 158

Multiple choice Iteration
The following code generates a well-known sequence. What is printed? int a = 1, b = 1; for…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 159

Multiple choice Iteration
What is printed? int x = 1; for (int i = 0; i <…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 160

Multiple choice Iteration

What is printed?

int product = 1;
for (int i = 1; i <= 6; i++) {
    if (i % 2 == 0) {
        product *= i;
    }
}
System.out.println(product);
Pick an answer, then check it. The solution opens in a window.
Question 151 of 376
Page 16 of 38