Solved

Which One of the Following Is the Correct Code Snippet

Question 83

Multiple Choice

Which one of the following is the correct code snippet for calculating the largest value in an integer array list aList?


A) int max = 0;
For (int count = 1; count < aList.size() ; count++)
{
If (aList.get(count) > max)
{
Max = aList.get(count) ;
}
}
B) int max = aList.get(0) ;
For (int count = 1; count < aList.size() ; count++)
{
If (aList.get(count) > max)
{
Max = aList.get(count) ;
}
}
C) int max = aList[1];
For (int count = 1; count < aList.size() ; count++)
{
If (aList.get(count) > max)
{
Max = aList.get(count) ;
}
}
D) int max = aList.get(0) ;
For (int count = 1; count > aList.size() ; count++)
{
If (aList.get(count) >= max)
{
Max = aList.get(count) ;
}
}

Correct Answer:

verifed

Verified

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

Related Questions