0

Hi, this is a multiple choice question from my AP CS review book. I can't seem to figure out the right answer even after looking at the answer.

Which of the following will evaluate to true only if boolean expression A, B, and C are all false?

A) !A && !(B && !C)
B) !A || !B || !C
C) !(A || B || C)
D) !(A && B && C)
E) !A || !(B || !C)

3
Contributors
2
Replies
3
Views
6 Years
Discussion Span
Last Post by rubberman
0

You have 8 situations. So we check them all

false, false, false - A, B, C, D, E are TRUE
false, false, true - A, B, D, E are TRUE
false, true, false - B, D, E are TRUE
false, true, true - A, B, D, E are TRUE
true, false, false - B, D, E are TRUE
true, false, true - B, D, E are TRUE
true, true, false - B,D are TRUE
true, true, true - All FALSE

So given those, answer (C) is only true when all of them are false.

Edited by Momerath: n/a

0

Answer C is correct, but it can also be expressed like this

!(A || B || C) == (!A && !B && !C)

Why? Well you could generate a set of truth tables (ever take formal logic?), or just think about it.

if (A is true) or (B is true) or (C is true), then (A or B or C) is true.
Apply negation operator NOT to (A or B or C) is saying "if NOT (A or B or C), then results is TRUE only if they ALL are FALSE".

More confused yet? :-)

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.