nerdexam
Oracle

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.

Using Operators and Decision Constructs

Question

Given the code fragment:

What is the result?

Options

  • A28false29
  • B285 < 429
  • Ctrue
  • DCompilation fails

How the community answered

(14 responses)
  • A
    7% (1)
  • C
    86% (12)
  • D
    7% (1)

Why each option

The program executes a boolean expression within the provided code fragment and prints its evaluation result to the console.

A28false29

This choice is incorrect as it implies a specific sequence of numerical and boolean output that does not match a simple `true` evaluation.

B285 < 429

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`.

CtrueCorrect

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.

DCompilation fails

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

#boolean expressions#comparison operators

Community Discussion

No community discussion yet for this question.

Full 1Z0-803 Practice