Multiple Choice
Select the statement that reveals the logic error in the following method.
public static double minimum(double[] data)
{
double smallest = 0.0;
for (int i = 0; i < data.length; i++)
{
if (data[i] < smallest)
{
smallest = data[i];
}
}
return smallest;
}
A) double m = minimum(new double[] { 1.2, -3.5, 6.6, 2.4 }) ;
B) double m = minimum(new double[] { 1.2, 23.5, 16.6, -23.4 }) ;
C) double m = minimum(new double[] { -10.2, 3.5, 62.6, 21.4 }) ;
D) double m = minimum(new double[] { 12.2, 31.5, 6.6, 2.4 }) ;
Correct Answer:

Verified
Correct Answer:
Verified
Q2: Which code snippet calculates the sum of
Q9: What is the result of the following
Q21: When a Java program terminates and reports
Q35: Which code snippet finds the largest value
Q41: Consider the following code snippet:<br>Int[][] arr =<br>{<br>{
Q43: Which one of the following is the
Q51: The binary search is faster than the
Q85: Which one of the following statements about
Q110: Consider the following code snippet:<br>Int cnt =
Q114: When an array myArray is only partially