Multiple Choice
Consider the following code snippet:
Public static void main(String[] args)
{
ArrayList<String> names = new ArrayList<String>() ;
Names.add("John") ;
Names.add("Jerry") ;
Names.add("Janet") ;
ArrayList<String> names = reverse(names) ;
}
Public static ArrayList<String> reverse(ArrayList<String> names)
{
ArrayList<String> result = new ArrayList<String>() ;
For (int i = names.size() - 1; i >= 0; i--)
{
Result.add(names.get(i) ) ;
}
Return <String>result;
}
Which statement is true after the main method is executed?
A) names contains "Janet", "Jerry", "John" in this order
B) names contains "John", "Jerry", "Janet" in this order
C) reverse method has a bound error
D) Compilation error due to the return statement in reverse method
Correct Answer:

Verified
Correct Answer:
Verified
Q2: What is the output of the given
Q12: Which one of the following statements is
Q17: How many elements can be stored in
Q17: What is the output of the following
Q19: What is the value of the cnt
Q25: Consider the following method:<br>Public static int mystery(int
Q28: Consider the following code snippet:<br>Int[][] arr =<br>{<br>{
Q61: Consider the following code snippet: ArrayList<Integer> num1
Q62: Which code snippet calculates the sum of
Q83: Which one of the following is the