Boolean Logic Flashcards
7 cards from real APCSP practice questions. Tap to flip, then mark Knew It or Still Learning — missed cards come back until you master them.
Read the first 7 Boolean Logic flashcards as text
What does the XOR (exclusive OR) operator return?
Answer: TRUE when exactly one input is TRUE
XOR returns TRUE only when exactly one of its inputs is TRUE, unlike regular OR which also returns TRUE when both inputs are TRUE.
According to De Morgan's first law, NOT(A AND B) is equivalent to:
Answer: NOT(A) OR NOT(B)
De Morgan's first law states: NOT(A AND B) = NOT(A) OR NOT(B).
Which expression is equivalent to NOT(A OR B) by De Morgan's second law?
Answer: NOT(A) AND NOT(B)
De Morgan's second law states: NOT(A OR B) = NOT(A) AND NOT(B).
Why are Boolean conditions used in if-statements in programming?
Answer: To determine which branch of code to execute
Boolean conditions in if-statements evaluate to TRUE or FALSE to control which code path the program follows.
A spam filter marks email as spam if: (has_suspicious_link OR from_unknown_sender) AND NOT(in_whitelist). When is email NOT marked as spam?
Answer: When the sender is in the whitelist
If in_whitelist is TRUE, then NOT(in_whitelist) is FALSE, making the entire AND expression FALSE so the email is not marked as spam.
How many rows are needed in a truth table for a Boolean expression with two inputs?
Answer: 4
With two binary inputs, there are 2² = 4 possible combinations: (F,F), (F,T), (T,F), and (T,T).
Boolean logic is fundamental to computing primarily because computers internally represent all data as:
Answer: Binary digits (0 and 1)
Computers use binary (0s and 1s) at the hardware level, and Boolean logic directly operates on these binary values to perform all computations.