Boolean Expression With Mixed Types
Develop code to create Boolean expressions with relational operators and determine the result of these expressions.
A programmer writes this complex boolean expression to validate data ranges:
int x = 15;
int y = 4;
double z = 3.8;
boolean valid = (x / y > z) && ((double)(x + y) / 2 <= z * 2) && (x % y != (int)z);
What is the value of valid?
A
false
B
true
C
The expression causes a compile-time error
D
The expression causes a runtime error
Question Leaderboard
Not enough data yet to show leaderboard.
APFIVE