Solved

What Is the Value of the Cnt Variable After the Execution

Question 19

Multiple Choice

What is the value of the cnt variable after the execution of the code snippet below? ArrayList<Integer> somenum = new ArrayList<Integer>() ;
Somenum.add(1) ;
Somenum.add(2) ;
Somenum.add(1) ;
Int cnt = 0;
For (int index = 0; index < somenum.size() ; index++)
{
If (somenum.get(index) % 2 == 0)
{
Cnt++;
}
}


A) 1
B) 2
C) 3
D) 0

Correct Answer:

verifed

Verified

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

Related Questions