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 151–160 of 357
  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
Suppose p and q are declared as boolean variables and have been initialized to unknown…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 152

Multiple choice Boolean Expressions
Given int x = 7 and int y = 3, what is…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 153

Multiple choice Boolean Expressions
Consider the following boolean expression: !(x > 5 && y < 10) ||…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 154

Multiple choice Boolean Expressions
Consider the following code segment: int x = 5; int y = 10; boolean result = (x > 7) && (y++ <…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 155

Multiple choice Boolean Expressions
The following method is intended to return "Renaissance" for years from 1400 to 1600, inclusive, "Medieval" for years from 400 to 1399, inclusive, or "Other"…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 156

Multiple choice Boolean Expressions
What is printed by the following code? int x = 5; if (x > 3) { if (x > 7)…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 157

Multiple choice Boolean Expressions
Which of the following boolean…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 158

Multiple choice Boolean Expressions
What is the output of this code? int a = 2, b = 3, c = 4; if (a < b && b < c) a = b +…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 159

Multiple choice Boolean Expressions
Which of the following boolean expressions is…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 160

Multiple choice Boolean Expressions
What is printed? int x = 15, y = 20, z = 10; String result = ""; if (x > z && y > x) { if (y - x…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 151 of 357
Page 16 of 36