Deck 14: Generics and the Arraylist Class

ملء الشاشة (f)
exit full mode
سؤال
The keyword ___________ can be used to place a bound on a type parameter.

A)Implements
B)Inherits
C)Encapsulates
D)Extends
استخدم زر المسافة أو
up arrow
down arrow
لقلب البطاقة.
سؤال
To place an element in an ArrayList position for the first time,you usually use the method:

A)put)
B)set)
C)add)
D)place)
سؤال
Inheritance is the reason why some parameters of the ArrayList class are of type Base_Type and others of type Object.
سؤال
An ArrayList object has a fixed size.
سؤال
The removeObject theElement)method of the ArrayList class returns:

A)Int
B)Double
C)Byte
D)Boolean
سؤال
A generic class can be instantiated as any of the following base types except:

A)Character
B)Array
C)String
D)Double
سؤال
The Java standard libraries have a class named ___________ that behaves almost exactly the same as the class ArrayList.

A)Array
B)Container
C)Vector
D)All of the above
سؤال
Which is the correct syntax for placing the string "boat" into an ArrayList name recVehicles in position 3 for the first time?

A)recVehicles.set3,"boat");
B)recVehicles.set"boat",3);
C)recVehicles.add3,"boat");
D)recVehicles.add"boat",3);
سؤال
All of the following are memory management methods of the ArrayList class except:

A)ensureCapacity)
B)clear)
C)isEmpty)
D)trimToSize)
سؤال
A class obtained from a generic class by plugging in a type for the type parameter is said to ________ the generic class.

A)Inherit
B)Encapsulate
C)Instantiate
D)None of the above
سؤال
All of the following are methods of the ArrayList class except:

A)clear)
B)resize)
C)contains)
D)trimToSize)
سؤال
You can not use the set method to put an element at just any index.
سؤال
All of the following are methods of the ArrayList class except:

A)length)
B)size)
C)set)
D)get)
سؤال
Class and method definitions that include parameters for types are called:

A)generics
B)ArrayList
C)Base type
D)None of the above
سؤال
A/An ____________ can change the length while the program is running.

A)Array
B)ArrayList
C)Type parameter
D)None of the above
سؤال
ArrayList objects do not have the array square-bracket notation.
سؤال
You can use any primitive type as the base type of an ArrayList class.
سؤال
When using ArrayLists the method _______ can be used to save memory:

A)trimToSize)
B)trimDown)
C)trimOff)
D)None of the above
سؤال
All of the following are search methods of the ArrayList class except:

A)isEmpty)
B)lastIndexOf)
C)indexOf)
D)contains)
سؤال
To use the Java class ArrayList,you must import the package:

A)java.awt
B)java.io
C)java.util
D)java.container
سؤال
What are the three main disadvantages of an ArrayList?
سؤال
You can plug in a primitive type for a type parameter.
سؤال
The Type parameter is always indicated as a T.
سؤال
A for loop is an enhanced loop.
سؤال
Write Java statements to display the size of the resulting ArrayList from question 5 above.
سؤال
What is a parameterized class?
سؤال
What is the base type of the ArrayList defined in question number 2?
سؤال
Write a Java statement to create an ArrayList to hold 25 integers.
سؤال
Rewrite the following line of code,but use type inference.
ArrayList< Integer > mylist = new ArrayList< Integer >);
سؤال
A class definition can have more than one type parameter.
سؤال
The definition of a parameterized class is a class with one or more type parameters.
سؤال
The compiler option -Xlint is good for debugging.
فتح الحزمة
قم بالتسجيل لفتح البطاقات في هذه المجموعة!
Unlock Deck
Unlock Deck
1/32
auto play flashcards
العب
simple tutorial
ملء الشاشة (f)
exit full mode
Deck 14: Generics and the Arraylist Class
1
The keyword ___________ can be used to place a bound on a type parameter.

A)Implements
B)Inherits
C)Encapsulates
D)Extends
D
2
To place an element in an ArrayList position for the first time,you usually use the method:

A)put)
B)set)
C)add)
D)place)
C
3
Inheritance is the reason why some parameters of the ArrayList class are of type Base_Type and others of type Object.
True
4
An ArrayList object has a fixed size.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 32 في هذه المجموعة.
فتح الحزمة
k this deck
5
The removeObject theElement)method of the ArrayList class returns:

A)Int
B)Double
C)Byte
D)Boolean
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 32 في هذه المجموعة.
فتح الحزمة
k this deck
6
A generic class can be instantiated as any of the following base types except:

A)Character
B)Array
C)String
D)Double
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 32 في هذه المجموعة.
فتح الحزمة
k this deck
7
The Java standard libraries have a class named ___________ that behaves almost exactly the same as the class ArrayList.

A)Array
B)Container
C)Vector
D)All of the above
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 32 في هذه المجموعة.
فتح الحزمة
k this deck
8
Which is the correct syntax for placing the string "boat" into an ArrayList name recVehicles in position 3 for the first time?

A)recVehicles.set3,"boat");
B)recVehicles.set"boat",3);
C)recVehicles.add3,"boat");
D)recVehicles.add"boat",3);
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 32 في هذه المجموعة.
فتح الحزمة
k this deck
9
All of the following are memory management methods of the ArrayList class except:

A)ensureCapacity)
B)clear)
C)isEmpty)
D)trimToSize)
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 32 في هذه المجموعة.
فتح الحزمة
k this deck
10
A class obtained from a generic class by plugging in a type for the type parameter is said to ________ the generic class.

A)Inherit
B)Encapsulate
C)Instantiate
D)None of the above
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 32 في هذه المجموعة.
فتح الحزمة
k this deck
11
All of the following are methods of the ArrayList class except:

A)clear)
B)resize)
C)contains)
D)trimToSize)
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 32 في هذه المجموعة.
فتح الحزمة
k this deck
12
You can not use the set method to put an element at just any index.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 32 في هذه المجموعة.
فتح الحزمة
k this deck
13
All of the following are methods of the ArrayList class except:

A)length)
B)size)
C)set)
D)get)
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 32 في هذه المجموعة.
فتح الحزمة
k this deck
14
Class and method definitions that include parameters for types are called:

A)generics
B)ArrayList
C)Base type
D)None of the above
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 32 في هذه المجموعة.
فتح الحزمة
k this deck
15
A/An ____________ can change the length while the program is running.

A)Array
B)ArrayList
C)Type parameter
D)None of the above
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 32 في هذه المجموعة.
فتح الحزمة
k this deck
16
ArrayList objects do not have the array square-bracket notation.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 32 في هذه المجموعة.
فتح الحزمة
k this deck
17
You can use any primitive type as the base type of an ArrayList class.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 32 في هذه المجموعة.
فتح الحزمة
k this deck
18
When using ArrayLists the method _______ can be used to save memory:

A)trimToSize)
B)trimDown)
C)trimOff)
D)None of the above
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 32 في هذه المجموعة.
فتح الحزمة
k this deck
19
All of the following are search methods of the ArrayList class except:

A)isEmpty)
B)lastIndexOf)
C)indexOf)
D)contains)
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 32 في هذه المجموعة.
فتح الحزمة
k this deck
20
To use the Java class ArrayList,you must import the package:

A)java.awt
B)java.io
C)java.util
D)java.container
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 32 في هذه المجموعة.
فتح الحزمة
k this deck
21
What are the three main disadvantages of an ArrayList?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 32 في هذه المجموعة.
فتح الحزمة
k this deck
22
You can plug in a primitive type for a type parameter.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 32 في هذه المجموعة.
فتح الحزمة
k this deck
23
The Type parameter is always indicated as a T.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 32 في هذه المجموعة.
فتح الحزمة
k this deck
24
A for loop is an enhanced loop.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 32 في هذه المجموعة.
فتح الحزمة
k this deck
25
Write Java statements to display the size of the resulting ArrayList from question 5 above.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 32 في هذه المجموعة.
فتح الحزمة
k this deck
26
What is a parameterized class?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 32 في هذه المجموعة.
فتح الحزمة
k this deck
27
What is the base type of the ArrayList defined in question number 2?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 32 في هذه المجموعة.
فتح الحزمة
k this deck
28
Write a Java statement to create an ArrayList to hold 25 integers.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 32 في هذه المجموعة.
فتح الحزمة
k this deck
29
Rewrite the following line of code,but use type inference.
ArrayList< Integer > mylist = new ArrayList< Integer >);
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 32 في هذه المجموعة.
فتح الحزمة
k this deck
30
A class definition can have more than one type parameter.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 32 في هذه المجموعة.
فتح الحزمة
k this deck
31
The definition of a parameterized class is a class with one or more type parameters.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 32 في هذه المجموعة.
فتح الحزمة
k this deck
32
The compiler option -Xlint is good for debugging.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 32 في هذه المجموعة.
فتح الحزمة
k this deck
locked card icon
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 32 في هذه المجموعة.