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.

Subtopic: Iteration Clear filter

Questions 151–160 of 383
  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
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 152

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 153

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 154

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 155

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 156

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 157

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 158

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 159

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 160

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 151 of 383
Page 16 of 39