exam questions

Exam 1z0-819 All Questions

View all questions & answers for the 1z0-819 exam

Exam 1z0-819 topic 1 question 46 discussion

Actual exam question from Oracle's 1z0-819
Question #: 46
Topic #: 1
[All 1z0-819 Questions]


What is the result?

  • A. 357
  • B. 35
  • C. 235
  • D. 2357
  • E. An ArrayIndexOutOfBoundsException is thrown at runtime.
Show Suggested Answer Hide Answer
Suggested Answer: A 🗳️

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
ASPushkin
4 months, 2 weeks ago
Selected Answer: A
result += primes[i]; JLS 15.18: If just one operand to + is a String, the other operand is converted to a string, and then string concatenation is used.
upvoted 1 times
...
edwMr9
5 months, 3 weeks ago
The line that contains i++ removes the option to print the first number, that is, it verifies that it prints 357, and "A" is the correct
upvoted 1 times
...
d7bb0b2
11 months, 3 weeks ago
private static int i ; private static int primes[] = {2,3,5,7}; private static String resulet = ""; public static void main(String[] args) { while (i < primes.length) { if( i == 3) { break; } i++; resulet += primes[i]; } System.out.println(resulet); } A: is correct only know what happend with i = 2 case, event before append increment so when is 2 increment i = 3 and array contain element 3, so append its ok. After that while is break for if condition
upvoted 1 times
...
tmuralimanohar
1 year, 6 months ago
Answer: A
upvoted 1 times
...
Stavok
1 year, 6 months ago
Selected Answer: A
A is correct
upvoted 1 times
...
TADIEWA
2 years ago
A is correct
upvoted 1 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago