Hi,
I am looking at this question:
Consider the following program:
if X then RED else if Y then BLUE else if Z then YELLOW else GREEN.
Under which of the following conditions is GREEN executed?
With what proposition will GREEN only be executed here?
¬X∧¬Y ∧¬Z
¬(X∨Y ∨Z)
¬X∨¬Y ∨¬Z
¬(X∧Y ∧Z)
If I write this out in code I get:
So with the first one ¬X∧¬Y ∧¬ZCode:if X then RED elseif Y then BLUE elseif Z then YELLOW else GREEN end if
Means "NOT X AND NOT Y AND NOT Z"
So the only conclusion can be NOT RED NOT BLUE NOT YELLOW BUT GREEN.
This is correct right?
But the second one confuses me with the brackets ...
What are the rules regarding that?


LinkBack URL
About LinkBacks

