Deck 14: Generics and the Arraylist Class
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
فتح الحزمة
قم بالتسجيل لفتح البطاقات في هذه المجموعة!
Unlock Deck
Unlock Deck
1/31
العب
ملء الشاشة (f)
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()
(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);
(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
(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
(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()
(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
(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()
(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()
(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
(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
(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
(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()
(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
(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
(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
(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