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 1–10 of 357
  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
  8. 8
  9. 9
  10. 10

Question 1

Multiple choice Boolean Expressions
Consider the following code segment. Assume num is a properly declared and initialized int variable. if (num > 0) { if (num % 2 == 0) {…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 2

Multiple choice Boolean Expressions
Consider the following code segment. int num = /* initial value not shown */; boolean bl = true; if (num > 0) { if (num >= 100) { bl = false; } } else {…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 3

Multiple choice Boolean Expressions
Assume that a, b, and c are boolean variables that have been properly declared and…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 4

Multiple choice Boolean Expressions
Consider the following statement. Assume that a and b are properly declared and initialized boolean variables.…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 5

Multiple choice Boolean Expressions
Assume that x and y are boolean variables and have been properly initialized. (x || y)…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 6

Multiple choice Boolean Expressions
Assume that x and y are boolean variables and have been properly initialized. (x && y) &&…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 7

Multiple choice Boolean Expressions
A teacher put three bonus questions on a test and awarded 5 extra points to anyone who answered all three bonus questions correctly and no extra points…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 8

Multiple choice Boolean Expressions
Assume that x and y are boolean variables and have been properly initialized. (x &&…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 9

Multiple choice Boolean Expressions
Consider the following code segment. int x = /* some integer value */ ; int y = /* some integer value */ ; boolean result = (x < y); result = ( (x >=…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 10

Multiple choice Boolean Expressions
Assume that a and b are variables of type int. The expression !(a < b) && !(a > b)…

Sign up now. It's free!

See the full question with its answer and worked solution.

Question 1 of 357
Page 1 of 36