18. What is the result of the following?
A. 1
B. 2
C. 2.4
D. 1.2 and 2.4
E. There is no output.
F. The code does not compile.
G. An exception is thrown.
1 : something that results as a consequence, issue, or conclusion; also : beneficial or tangible effect : fruit
2 : something obtained by calculation or investigation
Campbell Ritchie wrote:Please tell us which book it is as well as the question number. That reduces problems about copyright and makes it easier for us to find the original.
Campbell Ritchie wrote: I find it surprising that you think that isn't part of the result.
[OCP 17 book] | [OCP 11 book] | [OCA 8 book] [OCP 8 book] [Practice tests book] [Blog] [JavaRanch FAQ] [How To Ask Questions] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
John Schubert wrote:
Campbell Ritchie wrote:Please tell us which book it is as well as the question number. That reduces problems about copyright and makes it easier for us to find the original.
Sorry it is the OCP Java SE 8 Certified Programmer Study Guide, chapter 4 (I thought I wrote it in the title, but apparently I didn't)
Campbell Ritchie wrote: I find it surprising that you think that isn't part of the result.
When I read result, and there is a terminal operation like count, I immediately associate it to a possible correct answer, because it is the result of the stream, and a stream is a computation, fitting the second definition more. The two numbers do not look like THE result, because they are two things (the printing of the two numbers might have been a better candidate for a result). The "and" particle was never printed to the console, so that confused me even more. Maybe if the numbers were collected into a list they could have been considered a result by me.
All this confusion would have not existed had the question asked for the output instead (after all we come from a series of previous questions asking for the output as well).
Or maybe keep the question as is but rewrite the correct option as:
D. 1.2 and 2.4 are printed
[OCP 17 book] | [OCP 11 book] | [OCA 8 book] [OCP 8 book] [Practice tests book] [Blog] [JavaRanch FAQ] [How To Ask Questions] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2