Solved

Which One of the Following Is the Correct Code Snippet

Question 43

Multiple Choice

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


A) int maximum = 0;
For (int counter = 1; counter < arrList.size() ; counter++)
{
If (arrList.get(counter) > maximum)
{
Maximum = arrList.get(counter) ;
}
}
B) int maximum = arrList.get(0) ;
For (int counter = 1; counter < arrList.size() ; counter++)
{
If (arrList.get(counter) > maximum)
{
Maximum = arrList.get(counter) ;
}
}
C) int maximum = arrList.get(1) ;
For (int counter = 1; counter < arrList.size() ; counter++)
{
If (arrList.get(counter) > maximum)
{
Maximum = arrList.get(counter) ;
}
}
D) int maximum = arrList.get(0) ;
For (int counter = 1; counter > arrList.size() ; counter++)
{
If (arrList.get(counter) < maximum)
{
Maximum = arrList.get(counter) ;
}
}

Correct Answer:

verifed

Verified

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

Related Questions