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 101–110 of 357
  1. 101
  2. 102
  3. 103
  4. 104
  5. 105
  6. 106
  7. 107
  8. 108
  9. 109
  10. 110

Question 101

Multiple choice Boolean Expressions
Consider the following code segment. if (n != 0 && x / n > 100) statement1; else…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 102

Multiple choice Boolean Expressions
What will the output be for the following poorly formatted program segment, if the input value for num is 22? int num = call to a…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 103

Multiple choice Boolean Expressions
What values are stored in x and y after execution of the following program segment? int x = 30, y =…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 104

Multiple choice Boolean Expressions
Which of the following will evaluate to true only…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 105

Multiple choice Boolean Expressions
Assume that a and b are integers. The boolean expression !(a…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 106

Multiple choice Boolean Expressions
Given that a, b, and c are integers, consider the boolean expression (a < b) || !((c…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 107

Multiple choice Boolean Expressions
In the following code segment, you may assume that a, b, and n are all type int. if (a != b && n / (a - b) >…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 108

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 109

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 110

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 101 of 357
Page 11 of 36