exam questions

Exam 1z0-811 All Questions

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

Exam 1z0-811 topic 1 question 19 discussion

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

Given the code fragment:

What is the result?

  • A. 9
    12
  • B. 10
    10
  • C. 9
    9
  • D. 10
    14
Show Suggested Answer Hide Answer
Suggested Answer: B 🗳️

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
dvpreddy
4 months, 3 weeks ago
Delete line 3 and compile the code, you will get 10 10. Hope this explains the reason.
upvoted 2 times
...
dvpreddy
4 months, 3 weeks ago
I have run the code and got 10 and 10 as output. Please check yourself if you are in doubt.
upvoted 2 times
...
tombatossals
4 months, 3 weeks ago
Selected Answer: B
Correct answer is B, because the "concat" method doesn't mutate the original string, it returns a new string.
upvoted 2 times
...
zoe12345
5 months, 1 week ago
The initial string str is "Hello Java", which has a length of 10 characters. The length() method is used to get the length of the string, and it's printed to the console, resulting in 10. The concat method is used to concatenate the string "SE 8" to the end of the original string. The result of the concatenation is "Hello JavaSE 8", which has a length of 14 characters. The length() method is again used to get the length of the string after concatenation, and it's printed to the console, resulting in 14.
upvoted 1 times
Yousef10
4 months, 3 weeks ago
my friend , last information in your comment is wrong , the answer will be 10 10 because concat did not change the original string ! ! !
upvoted 2 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