(false && true) || false || true
Explanation:
Let's evaluate the expression step by step:
Expression:
(false && true) || false || true
In C (and most C-like languages), the logical operators work like this:
- && (logical AND): true if both operands are true
- || (logical OR): true if any one operand is true
- false is equivalent to 0
- true is equivalent to 1
So replacing the keywords with their integer equivalents:
(0 && 1) || 0 || 1
Step-by-step evaluation:
0 && 1 = 0
(because both need to be true (non-zero), but the first is false (0))
Now the expression becomes:
0 || 0 = 0
Then, 0 || 1 = 1
β Final Result: 1
Hence, the correct answer is: (D) 1
0 || 0 || 1