Solved

Select an Appropriate Expression to Complete the Following Method, Which

Question 38

Multiple Choice

Select an appropriate expression to complete the following method, which is designed to return the sum of the two smallest values in the parameter array numbers. public static int sumTwoLowestElements(int[] numbers)
{
PriorityQueue<Integer> values = new PriorityQueue<Integer>() ;
For (int num: numbers)
{
Values.add(num) ;
}
______________________
}


A) return values.peek() + values.peek() ;
B) return values.peek() + values.remove() ;
C) return values.remove() + values.remove() ;
D) return values.remove() * 2;

Correct Answer:

verifed

Verified

Unlock this answer now
Get Access to more Verified Answers free of charge

Related Questions