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
Q41: Which one of the following statements is
Q44: Consider the following method:
Public static int mystery(int
Q45: What is the output of the following
Q46: Why is the following method header invalid?
Public
Q47: Consider the following code snippet. Which statement
Q50: Which one of the following is the
Q53: Consider the following code snippet:
Int[][] numarray =
{
{
Q56: Which one of the following statements is
Q60: Consider the following code snippet in Java
Q74: How many elements can be stored in
Unlock this Answer For Free Now!
View this answer and more for free by performing one of the following actions
Scan the QR code to install the App and get 2 free unlocks
Unlock quizzes for free by uploading documents