Comparing Boolean Expressions - AP Computer Science A

  1. Which expression is equivalent to !(a || b)?
    !a && !b. De Morgan's Law: negate OR, flip to AND, negate operands.
  2. What is the result of the expression: !true?
    false. NOT operator flips true to false.
  3. Determine the result of: true && (false || true).
    true. Parentheses first: (false || true) is true, then true && true.
  4. Which expression is equivalent to !(a && b)?
    !a || !b. De Morgan's Law: negate AND, flip to OR, negate operands.
  5. Evaluate: (false && false) || (true && false).
    false. Both AND operations are false, so false OR false is false.
  6. Determine the result of: true || (false && true).
    true. true OR anything is always true.
  7. What is the result of the expression: true || false?
    true. OR returns true if at least one operand is true.
  8. Evaluate: true && (!false || false).
    true!false is true, (true || false) is true, true && true is true.
  9. What does the '!' operator do in a Boolean expression?
    Negates the Boolean value. The NOT operator flips true to false and vice versa.
  10. Determine the result of: (true || false) && !false.
    true. (true || false) is true, and true && true is true.
  11. What is the precedence order of the operators: &&, ||, ! ?
    !, &&, ||. NOT has highest precedence, then AND, then OR.
  12. Determine the result of: !(false || (true && true)).
    false. (true && true) is true, (false || true) is true, !(true) is false.
  13. Determine the result of: (true || false) && false.
    false. (true || false) is true, but true && false is false.
  14. What is the result of the expression: !false?
    true. NOT operator flips false to true.
  15. Determine the result of: !(true && (false || true)).
    false. Inner expression is true, so !(true) is false.
  16. Evaluate: !(false && (true || false)).
    true. (false && anything) is false, so !(false) is true.
  17. Evaluate the expression: false || !true.
    false. false OR !true becomes false OR false equals false.
  18. What is the result of: (true && true) || false?
    true. (true && true) is true, and true OR false is true.
  19. What Boolean operator is represented by '&&'?
    Logical AND. Returns true only when both operands are true.
  20. What is the result of the expression: true && false?
    false. AND requires both operands to be true.
  21. Evaluate: true || (!false && false).
    true. true OR anything is always true.
  22. Determine the result of: (true && false) || true.
    true. (true && false) is false, but false || true is true.
  23. What Boolean operator is represented by '||'?
    Logical OR. Returns true when at least one operand is true.
  24. Evaluate: false && (!false || true).
    false. false AND anything is always false.

Study these flashcards