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:
Verified
Q72: What is the output of the following
Q73: Consider the following code snippet: ArrayList<Double> somedata
Q74: What is the value of myArray[1][2] after
Q76: Which one of the following is a
Q79: Consider the following code snippet:
Int val =
Q80: What is the output of the following
Q81: What is the output of the following
Q82: What is the output of the following
Q92: What should you check for when calculating
Q100: Which one of the following is a
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