Correct Answer : B
Execution of program starts from main
. Inside main
are 2
variables namely d1, d2
which are initialized to 21.5
and 0.5
respectively. Another variable of type boolean
is declared called condition
.
condition = (d1 / d2) < 15 = (21.5 / 0.5) < 15 = 43.0 < 15 = false
Since ternary operator is used integer variable result
will be assigned to 77
if the condition is true
and 99
is assigned if condition is false
. As condition is false
, result
holds 99
which is displayed using display statement. So the output will be result = 99