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: Boolean Expressions Clear filter

Questions 111–120 of 357
  1. 111
  2. 112
  3. 113
  4. 114
  5. 115
  6. 116
  7. 117
  8. 118
  9. 119
  10. 120

Question 111

Multiple choice Boolean Expressions
Assume that a, b, and c have been declared and correctly initialized with int values. Consider the following…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 112

Multiple choice Boolean Expressions
Consider the following method. public int pathways(int n) { int ans; if (n < -5) ans = 1; else if (n < 0) ans = 2; else if…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 113

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 114

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 115

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 116

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 117

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 118

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 119

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 120

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 111 of 357
Page 12 of 36