APCSP Boolean Logic 2 — Questions and Answers
Question 1: Given x = 5, which Boolean condition evaluates to TRUE?
- x > 10 AND x < 3
- x = 3 OR x = 4
- x > 3 AND x < 10 (Correct answer)
- NOT(x = 5)
Correct answer: x > 3 AND x < 10
5 > 3 is TRUE and 5 < 10 is TRUE, so the AND expression evaluates to TRUE.
Question 2: What does the expression NOT(TRUE AND FALSE) evaluate to?
- FALSE
- UNDEFINED
- TRUE (Correct answer)
- NULL
Correct answer: TRUE
TRUE AND FALSE = FALSE, then NOT(FALSE) = TRUE.
Question 3: A login system uses the condition (username_correct AND password_correct). When does the user gain access?
- When only the username is correct
- When only the password is correct
- When either credential is correct
- When both username and password are correct (Correct answer)
Correct answer: When both username and password are correct
The AND operator requires both conditions to be TRUE for the overall expression to be TRUE, so both credentials must be correct.
Question 4: Which Boolean expression is equivalent to NOT(A OR B) according to De Morgan's law?
- A AND B
- NOT(A) AND NOT(B) (Correct answer)
- NOT(A) OR NOT(B)
- A OR B
Correct answer: NOT(A) AND NOT(B)
By De Morgan's law, NOT(A OR B) = NOT(A) AND NOT(B).
Question 5: The condition (x > 0 OR y > 0) is TRUE when:
- Both x and y are negative
- x equals y
- At least one of x or y is positive (Correct answer)
- Neither x nor y is zero
Correct answer: At least one of x or y is positive
OR is TRUE when at least one operand is TRUE, so only one of the values needs to be positive.
Question 6: A security system uses the condition (door_locked AND alarm_on). What happens to the condition when the door is unlocked?
- The overall condition is still TRUE
- The alarm_on value determines the outcome
- The overall condition becomes FALSE (Correct answer)
- The condition becomes undefined
Correct answer: The overall condition becomes FALSE
If door_locked is FALSE, the AND expression is FALSE regardless of the value of alarm_on.
Question 7: Which Boolean expression is TRUE only when n is between 1 and 10 inclusive?
- n > 1 AND n < 10
- n >= 1 OR n <= 10
- n >= 1 AND n <= 10 (Correct answer)
- NOT(n < 1) OR NOT(n > 10)
Correct answer: n >= 1 AND n <= 10
Both conditions must be true simultaneously: n >= 1 AND n <= 10 covers the entire inclusive range from 1 to 10.
Given x = 5, which Boolean condition evaluates to TRUE?