The question is:
Assume that p
, q
and r
are boolean variables. Consider the following expression:
!(p && !q || r)
Which of the following expressions is equivalent to the given expression?
A. (p && r) || (!q && r)
B. (!p && !q) || (!p && r)
C. (!p || q ) && !r
D. (!p || q && !r)
E. (!p || q) || r
I solved it as D. But the answer is C. What the law of associativity for boolean operators? Can anyone explain why it should be C?
Thanks, Mita
Boolean algebra uses this operator precedence: NOT, AND, OR
So the original expression can be rewritten as:
without changing meaning. To preserve that order of operations after the negation:
which is your C) answer