Exam 1z0-816 All QuestionsBrowse all questions from this exam
Question 29

Given the Person class with age and name along with getter and setter methods, and this code fragment:

What will be the result?

    Correct Answer: D

    The given code sorts the list first by age in descending order due to the reversed() method and then by name in ascending order. The three Person objects have ages 44, 40, and 40 respectively. Tom has the highest age of 44, so he comes first. For the other two persons with an age of 40, the names are sorted in ascending order. The sorting results in Tom, Peter, and Aman.

Discussion
Sa16253748596Option: D

D is true