Question: 1. Since you create an instance of ArrayList of strings using new ArrayList (), should the constructor in the ArrayList class be defined as public
1. Since you create an instance of ArrayList of strings using new ArrayList
public ArrayList
a.true b.false
2. Can a generic class have multiple generic parameters?
a.true b.false
3.Which of the following statements are correct?
a.A generic type can be defined for a static method b.A generic type can be specified as a subtype of another type c.To invoke a generic method, prefix the method name with the actual type in angle brakets d.You can develop a generic method for sorting an array of Comparable objects
4.Which of the following statement(s) are correct?
a.Generics give us the capability to parametertize types. b.We can define a class or a method with generic types, which the compiler replaces with concrete types c.The key benefit of generics is to enable errors to be detected at compile time rather than at runtime. d. A generic class or method permits us to specify allowable types of objects that the class or method can work with.
5. A generic type defined in a class, interface, or a static method is called a formal generic type, which can be replaced later with an actual concrete type.
a.true b.false
6.Array list provides random access of the elements in the list.
a.True b.False
7.Once an array list is created the length of the array cannot be increased.
a.True b.False
8.A size of array list does not need to be fixed when it is created.
a.True b.False
9.More than one type of data can be stored in array list. For example, we can store integer and double in a same array.
a.True b.False
10.In multi-dimensional array you can create an array of arrays of which the member arrays can be of different sizes in each dimension.
a.True b.False
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
