Multiple Choice
Which one of the following code snippets accepts the integer input in an array list named num1 and stores the even integers of num1 in another array list named evennum?
A) ArrayList<Integer> num1 = new ArrayList<Integer>() ;
ArrayList<Integer> evennum = new ArrayList<Integer>() ;
Scanner in = new Scanner(System.in) ;
Int data;
For (int i = 0; i < 10; i++)
{
Data = in.nextInt() ;
Num1.add(data) ;
If (num1.get(i) % 2 == 0)
{
Evennum.add(num1.get(i) ) ;
}
}
B) ArrayList<Integer> num1 = new ArrayList<Integer>() ;
ArrayList<Integer> evennum = new ArrayList<Integer>() ;
Scanner in = new Scanner(System.in) ;
Int data;
For (int i = 0; i < 10; i++)
{
Data = in.nextInt() ;
Num1.add(data) ;
If (num1.get(i) % 2 != 0)
{
Evennum.add(num1.get(i) ) ;
}
}
C) ArrayList<Integer> num1 = new ArrayList<Integer>() ;
ArrayList<Integer> evennum = new ArrayList<Integer>() ;
Scanner in = new Scanner(System.in) ;
Int data;
For int i = 0; i < 10; i++)
{
Data = in.nextInt() ;
Num1.add(data) ;
If (num1.get(i) % 2 != 0)
{
Evennum[i] = num1[i];
}
}
D) ArrayList<Integer> num1 = new ArrayList<Integer>() ;
ArrayList<Integer> evennum = new ArrayList<Integer>() ;
Scanner in = new Scanner(System.in) ;
Int data;
For (int i = 0; i < 10; i++)
{
Data = in.nextInt() ;
Num1.add(data) ;
If (num1.get(i) % 2 == 0)
{
Evennum[i] = num1[i];
}
}
Correct Answer:

Verified
Correct Answer:
Verified
Q52: Assume the variable numbers has been declared
Q53: Consider the following code snippet, where the
Q54: Why is the following method header invalid?
Q55: Assume the following variable has been declared
Q56: Assume the array of integers values has
Q60: Which statement(s) about the size of a
Q61: Consider the following code snippet: ArrayList<Integer> num1
Q62: Which code snippet calculates the sum of
Q63: Which statement is true about the code
Q95: Why is the use of physical objects