Boolean Logic & Conditional Statements
What would be the result of the Boolean expression ?
null
"7 > 3"
true
false
When chaining together multiple equality checks with logical ORs in Java (||
) for different integer variables where two have equal value, what boolean result occurs?
Compilation error due to operator precedence
Runtime exception due to invalid comparison
True
False
Given two variables boolean x = true;
and boolean y = false;
, what would be the result of (x || y) && !(x && y)
?
The expression causes a compile-time error.
null
true
false
When checking if a string str
is neither null nor empty using short-circuit evaluation, which expression is most efficient?
str != null || !str.isEmpty()
str != null && !str.isEmpty()
str == null || str.isEmpty()
str != "" && str != null
What will the expression (7 >= 7) evaluate to?
null
true
error
false
Which modification ensures that the boolean expression (a == b || c)
evaluates as false only when both a != b
and not-c
are true?
Inverting all operators as (a != b && !c)
Removing '==' and using (a = b || c)
Adding parentheses as (a == b || c) && !(a != b && !c)
Reversing operands as (b == a || c)
If , what does the expression evaluate to?
zero
-5
false
true

How are we doing?
Give us your feedback and let us know how we can improve
What alteration ensures that boolean expression yields same result as X && (!Y) for all possible boolean values X,Y?
Replace ‘||’ with ‘&&’
Enclose ‘!Y’ within another negation ‘(!!Y)’
Replace ‘!((!X)’ with ‘(X)’
No alteration needed; they’re equivalent expressions.
What is the result of the boolean expression ?
<
false
true
=
What is the result of the boolean expression ?
!=
false
true