Describe what the values for a and b must be for the program to output \"TRUE\".
ID: 3562711 • Letter: D
Question
Describe what the values for a and b must be for the program to output "TRUE". In
other words, list up all cases when the expression will be true such as (a, b) = (0, 0),
(1, 0), etc. Assume that a and b can be either 0 or 1.
if (!(!(a == 1) && (b == 0))) System.out.println("TRUE")
I am a little confused by this question. I know that the exclamation mark negates the value and makes expression the opposite but what happens when there are two exclamation marks and when it is filled with more thn one parentheses, or does that matter?
Explanation / Answer
when a is equal to 1 and b may be 0 or 1 then true will be printed
so the values
(a,b) = (1,1) or (1,0) or (0,1)