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.

Questions 171–180 of 740
  1. 171
  2. 172
  3. 173
  4. 174
  5. 175
  6. 176
  7. 177
  8. 178
  9. 179
  10. 180

Question 171

Multiple choice Iteration
Consider this program segment. int newNum = 0, temp; int num = k; //k is some predefined integer value ≥ 0 while (num > 10) { temp = num % 10; num /= 10; newNum…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 172

Multiple choice Iteration
Consider the method reverse. /** Returns n with its digits reversed. * - Example: If n = 234, method reverse returns 432. * - Precondition: n > 0. */ int…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 173

Multiple choice Iteration
Consider the following output: 0 1 0 2 4 0 3 6 9 0 4 8 12 16 Which of the following code segments will produce this output? (A) for (int x = 1; x < 5; x++) {…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 174

Multiple choice Boolean Expressions
The speed limit of a stretch of highway is 55 miles per hour (mph). The highway patrol issues speeding tickets to anyone caught going faster than 55 miles per…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 175

Multiple choice Iteration
Consider the following code segment: while ((x > y) || y >= z) { System.out.print("*"); } In the code segment above,…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 176

Multiple choice Iteration
Consider the following code segment: int a = 0; for (int i = 0; i < 10; i++) { for (int k = 0; k <= 5; k++)…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 177

Multiple choice Iteration
Consider the following code segment. int count = 1; int value = 31; while (value >= 10) { value = value -…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 178

Multiple choice Iteration
Consider the following code segment. int incr = 1; for (int i = 0; i < 10; i+= incr) {…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 179

Multiple choice Iteration
Which of the following code segments will print exactly eight "$" symbols? I. for (int i = 0; i < 8; i++) {…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 180

Multiple choice Iteration
Consider the following code segment. int a = /* value supplied within program */ int b = /* value supplied within program */ if (/* missing condition */) {…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 171 of 740
Page 18 of 74