1 What will be the output of the following code:
import java.util.ArrayList;
import java.util.List;
public class ListDemo {
public static void main (String args[])
{
List list=new ArrayList();
list.add(2);
list.add(3);
m(list);
public static void m(List list) {
System.out.println(list);
}
}}
- 3.0
- 3
- Runtime exception
- Compile time exception
Correct!Wrong!2 Which of the below is valid way to instantiate an array in java?
- int myArray [] [] = {1,2,3,4};
- int myArray [] = {1, 3, 5};
- int [] myArray = (5, 4, 3);
- int [] myArray = {“1”, “2”, “3”};
Correct!Wrong!3 Which of those doesn’t have an index based structure?
- List
- Map
- Set
- None of the above
Correct!Wrong!4 Which interface should be implemented for sorting on basis of many criteria’s?
- Comparator
- Comparable
- Serializable
- None of the above
Correct!Wrong!5 We can invoke any number of methods by one instance only
- True
- False
Correct!Wrong!6 What will be the output of the below program?
- Prints “c = 65”
- Compile Time Error
- Prints “c = A”
- Runtime Error
Correct!Wrong!
0 Comments