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

Verified
Correct Answer:
Verified
Q1: Suppose you wish to write a method
Q15: Which one of the following is a
Q27: What is the output of the following
Q46: What is the output of the following
Q49: Why is the following method header invalid?<br>Public
Q53: When an array reading and storing input
Q63: Which statement is true about the code
Q80: Consider the following line of code:<br>Int[] somearray
Q91: Which statement is true about the code
Q93: Which code snippet prints out the elements