1Z0-803 · Question #149
Given the code fragment: What is the result?
The correct answer is C. true. The program executes a boolean expression within the provided code fragment and prints its evaluation result to the console.
Question
Given the code fragment:
What is the result?
Options
- A28false29
- B285 < 429
- Ctrue
- DCompilation fails
How the community answered
(14 responses)- A7% (1)
- C86% (12)
- D7% (1)
Why each option
The program executes a boolean expression within the provided code fragment and prints its evaluation result to the console.
This choice is incorrect as it implies a specific sequence of numerical and boolean output that does not match a simple `true` evaluation.
This choice is incorrect as it includes unparsed symbols and numbers, which would not be the direct output if a boolean expression evaluates to `true`.
C is correct because the provided code fragment contains a boolean expression that evaluates to `true`, and this value is directly printed to the console.
This choice is incorrect; if the program successfully produces an output like `true`, it means it compiled and ran without errors.
Concept tested: Boolean expression evaluation and output
Source: https://docs.oracle.com/javase/tutorial/java/nutsandbolts/op2.html
Topics
Community Discussion
No community discussion yet for this question.