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

Questions 71–80 of 316
  1. 71
  2. 72
  3. 73
  4. 74
  5. 75
  6. 76
  7. 77
  8. 78
  9. 79
  10. 80

Question 71

Multiple choice Boolean Expressions
Consider the following code segment. int num1 = 2; int num2 = 13; int result = 4; if ((num1 < 5) && (num2 < 5)) result = num1 - num2; else if ((num1 ==…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 72

Multiple choice Boolean Expressions
Assume that k, m, and n have been declared and correctly initialized with int values. Consider the following statement.…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 73

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 74

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 75

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 76

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 77

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 78

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 79

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 80

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 71 of 316
Page 8 of 32