Boolean Expressions (College Board AP® Computer Science Principles): Exam Questions

9 mins9 questions
1
1 point

The variable age holds a person's age as an integer. Which expression evaluates to true exactly when a person is a teenager (at least 13 and at most 19)?

  • (age ≥ 13) OR (age ≤ 19)

  • (age ≥ 13) AND (age ≤ 19)

  • (age > 13) AND (age < 19)

  • NOT (age ≥ 13)

2
1 point

What is the value of the following expression?

(7 ≠ 4) OR (2 > 5)

  • true

  • false

  • 7

  • 2

3
1 point

Which two of the following expressions evaluate to true?

Select two answers.

  • (5 > 3) AND (2 < 1)

  • NOT (4 = 4)

  • (10 ≥ 10) OR (1 > 9)

  • NOT (3 > 8)

4
1 point

What is the value of the following expression?

NOT (8 < 3)

  • true

  • false

  • 8

  • 3

5
1 point

Which of the following expressions evaluates to false?

  • 12 ≠ 7

  • 4 ≤ 4

  • 10 > 15

  • 6 = 6

6
1 point

What is displayed when the following code segment is executed?

temp ← 30
isHot ← temp > 25
isFreezing ← temp < 0
DISPLAY(isHot AND NOT isFreezing)
  • false

  • true

  • 30

  • 25

7
1 point

What is the value of the following expression?

NOT (7 > 9 OR 3 = 3)

  • true

  • 7

  • 3

  • false

8
1 point

What is displayed when the following code segment is executed?

a ← 4
b ← 9
result ← a < b AND NOT (a ≥ b)
DISPLAY(result)
  • false

  • 4

  • true

  • 9

9
1 point

The variable stock holds the number of items in a warehouse as an integer. Which expression evaluates to true exactly when stock is outside the valid range of 1 to 100 inclusive?

  • stock < 1 OR stock > 100

  • stock < 1 AND stock > 100

  • stock ≥ 1 AND stock ≤ 100

  • NOT (stock > 100)