PrepGo

AP Computer Science Principles Practice Quiz: Boolean Expressions

Written by AP Content Team, Verified for 2026 AP Exams, Last updated: May 2026

Test your understanding with short quizzes. This quiz has 16 questions to check your progress.

Question 1 of 16

According to the provided content, what are the only two possible values for a Boolean?

All Questions (16)

According to the provided content, what are the only two possible values for a Boolean?

A) 0 and 1

B) Yes and No

C) true and false

D) On and Off

Correct Answer: C

The content explicitly states, 'A Boolean value is either true or false.'

What is the result of evaluating the expression `15 > 10`?

A) true

B) false

C) 15

D) 10

Correct Answer: A

The relational operator `>` tests if the left value is greater than the right. Since 15 is greater than 10, the expression evaluates to the Boolean value `true`.

What is the result of evaluating the expression `7 ≤ 5`?

A) true

B) false

C) 7

D) 5

Correct Answer: B

The relational operator `≤` tests if the left value is less than or equal to the right. Since 7 is not less than or equal to 5, the expression evaluates to the Boolean value `false`.

What is the result of evaluating the expression `20 ≠ 20`?

A) true

B) false

C) 20

D) 0

Correct Answer: B

The relational operator `≠` tests if two entities are not equal. Since 20 is equal to 20, the statement that they are not equal is `false`.

What is the result of evaluating the expression `NOT (10 = 10)`?

A) true

B) false

C) 10

D) An error

Correct Answer: B

First, the inner expression `(10 = 10)` evaluates to `true`. The `NOT` operator is then applied to `true`. The content states that `NOT` evaluates to `false` if the condition is `true`.

Under which circumstance does the `AND` logical operator evaluate to `true`?

A) If at least one of the conditions is true

B) If both conditions are true

C) If both conditions are false

D) If only one of the conditions is true

Correct Answer: B

The content specifies, 'The AND operator evaluates to true if both condition1 and condition2 are true; otherwise it evaluates to false.'

Under which circumstance does the `OR` logical operator evaluate to `false`?

A) Only if both conditions are false

B) Only if both conditions are true

C) If at least one condition is true

D) If only one condition is false

Correct Answer: A

The content states, 'The OR operator evaluates to true if condition1 is true or if condition2 is true or if both condition1 and condition2 are true; otherwise it evaluates to false.' The only case where it is false is when both conditions are false.

What is the result of evaluating the expression `(5 > 3) AND (2 < 4)`?

A) true

B) false

C) 5

D) 2

Correct Answer: A

The expression `(5 > 3)` evaluates to `true`. The expression `(2 < 4)` also evaluates to `true`. The `AND` operator evaluates to `true` because both conditions are `true`.

What is the result of evaluating the expression `(10 = 5) OR (7 > 6)`?

A) true

B) false

C) 10

D) 7

Correct Answer: A

The expression `(10 = 5)` evaluates to `false`. The expression `(7 > 6)` evaluates to `true`. The `OR` operator evaluates to `true` because at least one of the conditions (`7 > 6`) is `true`.

What is the result of evaluating the expression `(1 ≥ 2) AND (5 = 5)`?

A) true

B) false

C) 1

D) 5

Correct Answer: B

The expression `(1 ≥ 2)` evaluates to `false`. The expression `(5 = 5)` evaluates to `true`. The `AND` operator requires both conditions to be true to evaluate to `true`. Since one condition is `false`, the entire expression evaluates to `false`.

What is the result of evaluating the expression `(8 < 4) OR (3 ≠ 3)`?

A) true

B) false

C) 8

D) 3

Correct Answer: B

The expression `(8 < 4)` evaluates to `false`. The expression `(3 ≠ 3)` also evaluates to `false`. The `OR` operator evaluates to `false` because both conditions are `false`.

What is the result of evaluating the expression `NOT ((5 > 3) AND (10 ≤ 9))`?

A) true

B) false

C) 5

D) 10

Correct Answer: A

First, evaluate the inner expressions. `(5 > 3)` is `true`. `(10 ≤ 9)` is `false`. The `AND` operator on `true` and `false` results in `false`. Finally, the `NOT` operator is applied to `false`, which evaluates to `true`.

What is the result of evaluating the expression `((2 = 2) OR (3 > 5)) AND (10 ≠ 1)`?

A) true

B) false

C) 2

D) 10

Correct Answer: A

First, evaluate the expression in the first set of parentheses: `(2 = 2)` is `true` and `(3 > 5)` is `false`. `true OR false` evaluates to `true`. Next, evaluate the second part: `(10 ≠ 1)` is `true`. Finally, evaluate `true AND true`, which results in `true`.

Let `a = 10`, `b = 20`, and `c = 10`. What is the result of evaluating the expression `(a = c) AND NOT (b < a)`?

A) true

B) false

C) 10

D) 20

Correct Answer: A

Substitute the values: `(10 = 10) AND NOT (20 < 10)`. The first part, `(10 = 10)`, is `true`. The second part, `(20 < 10)`, is `false`. Applying `NOT` to `false` gives `true`. The final expression is `true AND true`, which evaluates to `true`.

What is the primary purpose of relational operators like `>`, `<`, and `=` as described in the content?

A) To perform mathematical calculations

B) To assign values to variables

C) To test the relationship between two entities

D) To combine multiple Boolean values

Correct Answer: C

The content states that relational operators are used 'to test the relationship between two entities.' It also notes that 'A comparison using a relational operator evaluates to a Boolean value.'

According to the provided text, what type of value or expression serves as an operand for a logical operator?

A) A number or a string

B) A relational operator

C) A Boolean expression or a single Boolean value

D) A variable name

Correct Answer: C

The content explicitly states, 'The operand for a logical operator is either a Boolean expression or a single Boolean value.'