Deck 14: Generics and the Arraylist Class

ملء الشاشة (f)
exit full mode
سؤال
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()
استخدم زر المسافة أو
up arrow
down arrow
لقلب البطاقة.
سؤال
ArrayList objects do not have the array square-bracket notation.
سؤال
Which is the correct syntax for placing the string "boat" into an ArrayList name recVehicles in position 3 for the first time?
(a)recVehicles.set(3,"boat");
(b)recVehicles.set("boat",3);
(c)recVehicles.add(3,"boat");
(d)recVehicles.add("boat",3);
سؤال
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
سؤال
Class and method definitions that include parameters for types are called:
(a)generics
(b)ArrayList
(c)Base type
(d)None of the above
سؤال
You can use any primitive type as the base type of an ArrayList class.
سؤال
All of the following are methods of the ArrayList class except:
(a)length()
(b)size()
(c)set()
(d)get()
سؤال
A generic class can be instantiated as any of the following base types except:
(a)Character
(b)Array
(c)String
(d)Double
سؤال
All of the following are methods of the ArrayList class except:
(a)clear()
(b)resize()
(c)contains()
(d)trimToSize()
سؤال
All of the following are search methods of the ArrayList class except:
(a)isEmpty()
(b)lastIndexOf()
(c)indexOf()
(d)contains()
سؤال
The keyword ___________ can be used to place a bound on a type parameter.
(a)Implements
(b)Inherits
(c)Encapsulates
(d)Extends
سؤال
The remove(Object theElement)method of the ArrayList class returns:
(a)Int
(b)Double
(c)Byte
(d)Boolean
سؤال
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
سؤال
All of the following are memory management methods of the ArrayList class except:
(a)ensureCapacity()
(b)clear()
(c)isEmpty()
(d)trimToSize()
سؤال
Inheritance is the reason why some parameters of the ArrayList class are of type Base_Type and others of type Object.
سؤال
To use the Java class ArrayList,you must import the package:
(a)java.awt
(b)java.io
(c)java.util
(d)java.container
سؤال
When using ArrayLists the method _______ can be used to save memory:
(a)trimToSize()
(b)trimDown()
(c)trimOff()
(d)None of the above
سؤال
You can not use the set method to put an element at just any index.
سؤال
A/An ____________ can change the length while the program is running.
(a)Array
(b)ArrayList
(c)Type parameter
(d)None of the above
سؤال
An ArrayList object has a fixed size.
سؤال
What is the base type of the ArrayList defined in question number 2?
سؤال
What is a parameterized class?
سؤال
The Type parameter is always indicated as a T.
سؤال
Write Java statements to display the size of the resulting ArrayList from question 5 above.
سؤال
What are the three main disadvantages of an ArrayList?
سؤال
A for loop is an enhanced loop.
سؤال
The definition of a parameterized class is a class with one or more type parameters.
سؤال
Write a Java statement to create an ArrayList to hold 25 integers.
سؤال
The compiler option -Xlint is good for debugging.
سؤال
You can plug in a primitive type for a type parameter.
سؤال
A class definition can have more than one type parameter.
فتح الحزمة
قم بالتسجيل لفتح البطاقات في هذه المجموعة!
Unlock Deck
Unlock Deck
1/31
auto play flashcards
العب
simple tutorial
ملء الشاشة (f)
exit full mode
Deck 14: Generics and the Arraylist Class
1
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
2
ArrayList objects do not have the array square-bracket notation.
True
3
Which is the correct syntax for placing the string "boat" into an ArrayList name recVehicles in position 3 for the first time?
(a)recVehicles.set(3,"boat");
(b)recVehicles.set("boat",3);
(c)recVehicles.add(3,"boat");
(d)recVehicles.add("boat",3);
C
4
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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 31 في هذه المجموعة.
فتح الحزمة
k this deck
5
Class and method definitions that include parameters for types are called:
(a)generics
(b)ArrayList
(c)Base type
(d)None of the above
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 31 في هذه المجموعة.
فتح الحزمة
k this deck
6
You can use any primitive type as the base type of an ArrayList class.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 31 في هذه المجموعة.
فتح الحزمة
k this deck
7
All of the following are methods of the ArrayList class except:
(a)length()
(b)size()
(c)set()
(d)get()
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 31 في هذه المجموعة.
فتح الحزمة
k this deck
8
A generic class can be instantiated as any of the following base types except:
(a)Character
(b)Array
(c)String
(d)Double
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 31 في هذه المجموعة.
فتح الحزمة
k this deck
9
All of the following are methods of the ArrayList class except:
(a)clear()
(b)resize()
(c)contains()
(d)trimToSize()
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 31 في هذه المجموعة.
فتح الحزمة
k this deck
10
All of the following are search methods of the ArrayList class except:
(a)isEmpty()
(b)lastIndexOf()
(c)indexOf()
(d)contains()
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 31 في هذه المجموعة.
فتح الحزمة
k this deck
11
The keyword ___________ can be used to place a bound on a type parameter.
(a)Implements
(b)Inherits
(c)Encapsulates
(d)Extends
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 31 في هذه المجموعة.
فتح الحزمة
k this deck
12
The remove(Object theElement)method of the ArrayList class returns:
(a)Int
(b)Double
(c)Byte
(d)Boolean
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 31 في هذه المجموعة.
فتح الحزمة
k this deck
13
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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 31 في هذه المجموعة.
فتح الحزمة
k this deck
14
All of the following are memory management methods of the ArrayList class except:
(a)ensureCapacity()
(b)clear()
(c)isEmpty()
(d)trimToSize()
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 31 في هذه المجموعة.
فتح الحزمة
k this deck
15
Inheritance is the reason why some parameters of the ArrayList class are of type Base_Type and others of type Object.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 31 في هذه المجموعة.
فتح الحزمة
k this deck
16
To use the Java class ArrayList,you must import the package:
(a)java.awt
(b)java.io
(c)java.util
(d)java.container
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 31 في هذه المجموعة.
فتح الحزمة
k this deck
17
When using ArrayLists the method _______ can be used to save memory:
(a)trimToSize()
(b)trimDown()
(c)trimOff()
(d)None of the above
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 31 في هذه المجموعة.
فتح الحزمة
k this deck
18
You can not use the set method to put an element at just any index.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 31 في هذه المجموعة.
فتح الحزمة
k this deck
19
A/An ____________ can change the length while the program is running.
(a)Array
(b)ArrayList
(c)Type parameter
(d)None of the above
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 31 في هذه المجموعة.
فتح الحزمة
k this deck
20
An ArrayList object has a fixed size.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 31 في هذه المجموعة.
فتح الحزمة
k this deck
21
What is the base type of the ArrayList defined in question number 2?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 31 في هذه المجموعة.
فتح الحزمة
k this deck
22
What is a parameterized class?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 31 في هذه المجموعة.
فتح الحزمة
k this deck
23
The Type parameter is always indicated as a T.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 31 في هذه المجموعة.
فتح الحزمة
k this deck
24
Write Java statements to display the size of the resulting ArrayList from question 5 above.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 31 في هذه المجموعة.
فتح الحزمة
k this deck
25
What are the three main disadvantages of an ArrayList?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 31 في هذه المجموعة.
فتح الحزمة
k this deck
26
A for loop is an enhanced loop.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 31 في هذه المجموعة.
فتح الحزمة
k this deck
27
The definition of a parameterized class is a class with one or more type parameters.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 31 في هذه المجموعة.
فتح الحزمة
k this deck
28
Write a Java statement to create an ArrayList to hold 25 integers.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 31 في هذه المجموعة.
فتح الحزمة
k this deck
29
The compiler option -Xlint is good for debugging.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 31 في هذه المجموعة.
فتح الحزمة
k this deck
30
You can plug in a primitive type for a type parameter.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 31 في هذه المجموعة.
فتح الحزمة
k this deck
31
A class definition can have more than one type parameter.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 31 في هذه المجموعة.
فتح الحزمة
k this deck
locked card icon
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 31 في هذه المجموعة.