Multiple Choice
Which of the following statements correctly specifies the use of lambda expressions and the comparing method of the Comparator functional interface to sort an array of countries by population, assuming the existence of a getPopulation method?
A) Arrays.sort(countries, Comparator.comparing(c1 -> c1.getPopulation() , c2 -> c2.getPopulation() ) ;
B) Arrays.sort(countries, comparing(c -> c.getPopulation() ) ) ;
C) Arrays.sort(countries, c -> c.getPopulation() ) ;
D) Arrays.sort(countries, Comparator.comparing(c -> c.getPopulation() ) ;
Correct Answer:

Verified
Correct Answer:
Verified
Q15: In big-Oh notation, suppose an algorithm requires
Q16: Which sort algorithm starts by partitioning the
Q17: How many comparisons does selection sort make
Q18: The largestPosition method below returns the index
Q19: Which of the following statements about running
Q21: If a call to the Arrays static
Q22: Suppose objects a and b are from
Q23: In the worst case, a linear search
Q24: Consider the sort method shown below for
Q25: A portion of your program includes the