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
Q76: Which one of the following is a
Q77: Which one of the following is the
Q79: Consider the following code snippet:
Int val =
Q81: What is the output of the following
Q82: What is the output of the following
Q83: What is the output of the code
Q84: Consider the following code snippet:
Int[][] arr =
{
{
Q85: 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