Exam 14: Generics and the Arraylist Class

arrow
  • Select Tags
search iconSearch Question
flashcardsStudy Flashcards
  • Select Tags

A class definition can have more than one type parameter.

Free
(True/False)
4.9/5
(34)
Correct Answer:
Verified

True

Write Java statements to display the size of the resulting ArrayList from question 5 above.

Free
(Short Answer)
4.7/5
(39)
Correct Answer:
Verified

System.out.println(list.size());

When using ArrayLists the method _______ can be used to save memory:

Free
(Multiple Choice)
4.8/5
(41)
Correct Answer:
Verified

A

Inheritance is the reason why some parameters of the ArrayList class are of type Base_Type and others of type Object.

(True/False)
4.8/5
(38)

A class obtained from a generic class by plugging in a type for the type parameter is said to ________ the generic class.

(Multiple Choice)
4.9/5
(35)

Write a Java statement to create an ArrayList to hold 25 integers.

(Essay)
4.8/5
(35)

You can use any primitive type as the base type of an ArrayList class.

(True/False)
4.8/5
(30)

All of the following are methods of the ArrayList class except:

(Multiple Choice)
4.8/5
(31)

You can not use the set method to put an element at just any index.

(True/False)
4.8/5
(34)

What is the base type of the ArrayList defined in question number 2?

(Short Answer)
4.7/5
(37)

The compiler option -Xlint is good for debugging.

(True/False)
4.8/5
(37)

The Type parameter is always indicated as a T.

(True/False)
4.8/5
(34)

All of the following are memory management methods of the ArrayList class except:

(Multiple Choice)
4.8/5
(32)

A generic class can be instantiated as any of the following base types except:

(Multiple Choice)
4.8/5
(38)

To place an element in an ArrayList position for the first time,you usually use the method:

(Multiple Choice)
4.9/5
(34)

What are the three main disadvantages of an ArrayList?

(Essay)
4.8/5
(46)

The remove(Object theElement)method of the ArrayList class returns:

(Multiple Choice)
4.8/5
(37)

To use the Java class ArrayList,you must import the package:

(Multiple Choice)
5.0/5
(40)

All of the following are methods of the ArrayList class except:

(Multiple Choice)
4.9/5
(37)

A/An ____________ can change the length while the program is running.

(Multiple Choice)
5.0/5
(40)
Showing 1 - 20 of 31
close modal

Filters

  • Essay(0)
  • Multiple Choice(0)
  • Short Answer(0)
  • True False(0)
  • Matching(0)