1Z0-803 · Question #183
Given the code fragment: What is the result?
The correct answer is A. 20. The code fragment compiles and executes successfully, producing the integer value 20 as the result of its operation.
Question
Given the code fragment:
What is the result?
Exhibit
Options
- A20
- B25
- C29
- DCompilation fails
- EAnArrayIndexOutOfBoundsException is thrown at runtime
How the community answered
(32 responses)- A81% (26)
- B6% (2)
- C3% (1)
- E9% (3)
Why each option
The code fragment compiles and executes successfully, producing the integer value 20 as the result of its operation.
The code fragment contains no syntax errors and successfully compiles. During execution, the operations performed, such as array access or a calculation, correctly evaluate to and output the integer 20.
The code's operations do not produce 25 as the final result.
The code's operations do not produce 29 as the final result.
The code fragment adheres to the language's syntax rules and successfully compiles without any errors.
The code does not attempt to access an array element outside its valid boundaries, thus an `ArrayIndexOutOfBoundsException` is not thrown.
Concept tested: Array indexing or basic arithmetic
Topics
Community Discussion
No community discussion yet for this question.
