Which of these methods will sort an array of floats into ascending order?
A) void arrange(float[ ] ary) {
For (int n=0; n<ary.length; n++)
For (int k=n; k<ary.length; k++)
If (ary[n] > ary[k])
{
Float x = ary[n];
Ary[n] = ary[k];
Ary[k] = x;
}
}
B) void arrange(float[ ] ary) {
For (int n=0; n<ary.length; n++)
For (int k=n; k<ary.length; k++)
If (ary[n] < ary[k])
{
Float x = ary[n];
Ary[n] = ary[k];
Ary[k] = x;
}
}
C) void arrange(float[ ] ary) {
For (int n=1; n<=ary.length; n++)
For (int k=n; k<ary.length; k++)
If (ary[n] > ary[k])
{
Float x = ary[n];
Ary[n] = ary[k];
Ary[k] = x;
}
}
D) void arrange(float[ ] ary) {
For (int n=0; n<ary.length; n++)
For (int k=n; k<ary.length; k++)
If (ary[n] > ary[k])
Float x = ary[n];
Ary[n] = ary[k];
Ary[k] = x;
}
E) none of the above
Correct Answer:
Verified
Q2: It is possible to sort an array
Q9: A polymorphic reference can refer to different
Q29: What is the efficiency of binary search?
A)
Q30: Considering the event processing classes, what is
Q32: What is printed by the following code?
public
Q34: What is printed?
public class Inherit
{
abstract class Figure
{
void
Q35: Although insertion sort and selection sort have
Q36: Which statement is completely True?
A) Java upcasts
Q37: What is printed?
public class Inherit
{
abstract class
Q38: What is printed?
public class Inherit
{
class Figure
{
void
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