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
Q32: It may be necessary to "grow" an
Q37: What is the value of the count
Q38: Consider using a deck of cards as
Q41: Which one of the following statements is
Q43: Which one of the following code snippets
Q45: Consider the following code snippet:
Int cnt =
Q47: Is there any thing wrong with the
Q73: Which one of the following statements is
Q74: How many elements can be stored in
Q82: Java 7 introduced enhanced syntax for declaring
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