Multiple Choice
What is the output of the following code snippet?
Public static int check(ArrayList<Integer> listData)
{
Int sum = 0;
For (int i = 0; i < listData.size() ; i++)
{
Sum = sum + listData.get(i) ;
}
Return sum;
}
Public static void main(String[] args)
{
ArrayList<Integer> vdata = new ArrayList<Integer>() ;
Int rsum;
For (int cnt = 0; cnt < 3; cnt++)
{
Vdata.add(cnt + 1) ;
}
Rsum = check(vdata) ;
System.out.println(rsum) ;
}
A) 4
B) 2
C) 3
D) 6
Correct Answer:

Verified
Correct Answer:
Verified
Q15: Which one of the following is a
Q27: What is the output of the following
Q41: The following statement gets an element from
Q42: Which statements about the enhanced for loop
Q44: Which statement is true about the code
Q49: Why is the following method header invalid?<br>Public
Q50: Which one of the following code snippets
Q63: Which statement is true about the code
Q80: Consider the following line of code:<br>Int[] somearray
Q90: Consider the following code snippet: ArrayList<Integer> arrList