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

Question 151

Multiple choice Boolean Expressions
A resort wants to recommend activities for its guests, based on the temperature (degrees F) as follows: 76° and above go swimming 61°–75° go hiking 46°–60° go…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 152

Multiple choice Iteration
Consider the following code segment. for (int h = 5; h >= 0; h = h - 2) { for (int k = 0; k < 3; k++) { if ((h…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 153

Multiple choice Iteration
Consider the following code segment. int number = Integer.MAX_VALUE; while (number > 0) { number = number / 2; } for…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 154

Multiple choice Boolean Expressions
Consider the code segment. if (value == 1) count += 1; else if (value == 2) count…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 155

Multiple choice Boolean Expressions
A bank will approve a loan for any customer who fulfills one or more of the following requirements: Has a credit score ≥ 640 Has a cosigner for the loan Has a…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 156

Multiple choice Iteration
Consider the following code segment. int value = 33; boolean calculate = true; while (value > 5 || calculate) {…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 157

Multiple choice Boolean Expressions
Consider the following incomplete method. public boolean validation(int x, int y) { /* missing code */ } The following table shows several examples of the…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 158

Multiple choice Boolean Expressions
Consider the following method. public String calculate(int num1, int num2) { if (num1 >= 0 && num2 >= 0) return "Numbers are valid"; return "Numbers are not…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 159

Multiple choice Boolean Expressions
Assume truth1 and truth2 are boolean variables that have been properly declared and initialized. Consider…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 160

Multiple choice Boolean Expressions
Assume that the variable declarations have been made. int a = 7, b = 15, c = -6; Which will…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 151 of 692
Page 16 of 70