Which of the following will result in '0' output?
-
(6<=6)||(5<3)
-
!(5>9)
-
(5>3)&&(6<=6)||(5!=6)
-
(5<3)&&(6<=6)||(5!=6)
D
Correct answer
Explanation
If we take half of the expression first (6<=6)||(5!=6) the value of expression (5!=6) and (6<=6) will be Boolean true value and we know that for even one condition to be true the OR (||) operator gives Boolean true value. Now we are left with the rest of the expression (5<3)&&(Prev value obtained), we know that && operator gives Boolean true value if both the conditions are true, but here (5<3) will return Boolean false value and hence the value of the whole expression will be 0.