Exam 1z0-819 All QuestionsBrowse all questions from this exam
Question 86

Given:

and the code fragment:

Which two Map objects group all employees with a salary greater than 30 by neighborhood? (Choose two.)

    Correct Answer: A, C

    To group all employees with a salary greater than 30 by neighborhood, we need to use both the predicate to filter the employees and the function/method to group by neighborhood. The correct options are those that correctly implement these functionalities without syntax errors. 'A' uses the function 'f' to group and the predicate 'p' to filter while 'C' uses 'getNeighborhood' to group and the predicate 'p' to filter. Both of these implementations are correct and compile without issues.

Discussion
dillemanOptions: AC

If you think about it this makes sence without knowing too much about the exact syntax. A: We use the function f to group and the predicate p to filter. This is correct. B: We use the predicate p both to filter and group. This does not compile since groping does not take a predicate. C: We use the getNeighborhood-method to group and the predicate to filter. This is correct. D: We correctly use the predicate to filter but use both the function and the getNeighborhood to group and this method is already defined in the function. This does not look correct with double grouping on that method. E: This is a copy of C but with extra parentheses in the end and this does not compile.

RoxyFoxy

Your explanation is brilliant! Thank you, dilleman!

SampsOptions: AC

correct answers are A and C

ASPushkinOption: C

same as 210 answer: A, C

ASPushkin

tested D uses function f() with Optional but left site uses directly String - not compiled

mendjijetOption: D

Correct are A and D Tested C and E does not compile because their provide a Map<String, List<Employee>> not Map<Optional<String>, List<employee>> B is not correct

[Removed]Option: A

Tested, A and C.

Omnisumem

And maybe C - if we need two correct answers...

OmnisumemOption: A

Tested: A.

[Removed]

A & B are correct

tmuralimanoharOption: C

Answer: C