java Chapter 14

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

True

ArrayList objects do not have the array square-bracket notation. Answers: True False

True

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

True

A class definition can have more than one type parameter. Answers: True False

instantiate

A class obtained from a generic class by plugging in a type for the type parameter is said to ________ the generic class. Answers: Inherit Encapsulate Instantiate None of these.

False

A for loop is an enhanced loop. Answers: True False

Array

A generic class can be instantiated as any of the following base types except: Answers: Character. Array. String. Double.

ArrayList

A/An ________ can change the length while the program is running. Answers: Array ArrayList Type parameter None of these.

clear()

All of the following are memory management methods of the ArrayList class except: Answers: ensureCapacity(). clear(). isEmpty(). trimToSize().

resize()

All of the following are methods of the ArrayList class except: Answers: clear(). resize(). contains(). trimToSize().

length()

All of the following are methods of the ArrayList class except: Answers: length(). size(). set(). get().

isEmpty()

All of the following are search methods of the ArrayList class except: Answers: isEmpty(). lastIndexOf(). indexOf(). contains().

False

An ArrayList object has a fixed size. Answers: True False

generics

Class and method definitions that include parameters for types are called: Answers: generics. ArrayList. Base type. None of these.

Vector

The Java standard libraries have a class named ________ that behaves almost exactly the same as the class ArrayList. Answers: Array Container Vector All of these.

True

The compiler option -Xlint is good for debugging. Answers: True False

True

The definition of a parameterized class is a class with one or more type parameters. Answers: True False

Extends

The keyword ________ can be used to place a bound on a type parameter. Answers: Implements Inherits Encapsulates Extends

Boolean

The remove(Object theElement) method of the ArrayList class returns: Answers: Int. Double. Byte. Boolean.

add()

To place an element in an ArrayList position for the first time, you usually use the method: Answers: put(). set(). add(). place().

java.util

To use the Java class ArrayList, you must import the package: Answers: java.awt. java.io. java.util. java.container.

trimToSize()

When using ArrayLists the method ________ can be used to save memory: Answers: trimToSize() trimDown() trimOff() None of these.

recVehicles.add(3, "boat")

Which is the correct syntax for placing the string "boat" into an ArrayList name recVehicles in position 3 for the first time? Answers: recVehicles.set(3, "boat"); recVehicles.set("boat", 3); recVehicles.add(3, "boat"); recVehicles.add("boat", 3);

True

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

False

You can plug in a primitive type for a type parameter. Answers: True False

False

You can use any primitive type as the base type of an ArrayList class. Answers: True False


Kaugnay na mga set ng pag-aaral

Hematology II Week 2 obj: Immune Vs. Non-Immune Hemolytic Anemia

View Set

Health Assessment- PrepU Chapter 11 Assessing Culture

View Set

evolve Ch 17 Somatic symptom disorders pre/post/NCLEX

View Set

Physical fitness Unit 2 Quiz 1: Planning Daily Exercise

View Set