Deck 16: Collections and Iterators
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
فتح الحزمة
قم بالتسجيل لفتح البطاقات في هذه المجموعة!
Unlock Deck
Unlock Deck
1/44
العب
ملء الشاشة (f)
Deck 16: Collections and Iterators
1
All of the following methods are part of the Collection interface except:
(a)Contains()
(b)toArray()
(c)retainAll()
(d)toString()
(a)Contains()
(b)toArray()
(c)retainAll()
(d)toString()
D
2
The method ___________ can be used to determine the number of elements in an ArrayList.
(a)length()
(b)vectorLength()
(c)size()
(d)vectorSize()
(a)length()
(b)vectorLength()
(c)size()
(d)vectorSize()
C
3
To change an existing element of a vector you must use the __________ method.
(a)add()
(b)set()
(c)change()
(d)mutate()
(a)add()
(b)set()
(c)change()
(d)mutate()
B
4
A ___________ is used to specify a wide range of parameters.
(a)Collection
(b)Iterator
(c)Vector
(d)Wildcard
(a)Collection
(b)Iterator
(c)Vector
(d)Wildcard
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 44 في هذه المجموعة.
فتح الحزمة
k this deck
5
Memory management methods of the vector class include all of the following except:
(a)remove()
(b)trimToSize()
(c)capacity()
(d)size()
(a)remove()
(b)trimToSize()
(c)capacity()
(d)size()
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 44 في هذه المجموعة.
فتح الحزمة
k this deck
6
The primary interface/interfaces for a collection class is/are:
(a)Collection< T >
(b)Set< T >
(c)List< T >
(d)All of the above
(a)Collection< T >
(b)Set< T >
(c)List< T >
(d)All of the above
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 44 في هذه المجموعة.
فتح الحزمة
k this deck
7
A ____________ is a data structure for holding elements.
(a)Collection
(b)Iterator
(c)Vector
(d)Wildcard
(a)Collection
(b)Iterator
(c)Vector
(d)Wildcard
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 44 في هذه المجموعة.
فتح الحزمة
k this deck
8
A collection is a data structure for holding elements.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 44 في هذه المجموعة.
فتح الحزمة
k this deck
9
The interface SortedSet and the concrete class _________ is designed for implementations of the Set interface that provide for rapid retrieval of elements.
(a)Vector< T >
(b)LinkedList< T >
(c)HashSet< T >
(d)TreeSet< T >
(a)Vector< T >
(b)LinkedList< T >
(c)HashSet< T >
(d)TreeSet< T >
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 44 في هذه المجموعة.
فتح الحزمة
k this deck
10
The method contains(Object o)of the ArrayList class returns a value of type:
(a)int
(b)char
(c)byte
(d)boolean
(a)int
(b)char
(c)byte
(d)boolean
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 44 في هذه المجموعة.
فتح الحزمة
k this deck
11
If you want a class that implements the Set interface and do not need any methods beyond those in the Set interface,you can use the concrete class:
(a)Vector< T >
(b)LinkedList< T >
(c)HashSet< T >
(d)TreeSet< T >
(a)Vector< T >
(b)LinkedList< T >
(c)HashSet< T >
(d)TreeSet< T >
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 44 في هذه المجموعة.
فتح الحزمة
k this deck
12
If you do not need efficient random access but need to efficiently move sequentially through the list,then use the _____________ class.
(a)Vector< T >
(b)LinkedList< T >
(c)HashSet< T >
(d)TreeSet< T >
(a)Vector< T >
(b)LinkedList< T >
(c)HashSet< T >
(d)TreeSet< T >
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 44 في هذه المجموعة.
فتح الحزمة
k this deck
13
If you want a class that implements the List interface and do not need any methods beyond those in the List interface,you can use the ____________ class.
(a)Vector< T >
(b)LinkedList< T >
(c)HashSet< T >
(d)TreeSet< T >
(a)Vector< T >
(b)LinkedList< T >
(c)HashSet< T >
(d)TreeSet< T >
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 44 في هذه المجموعة.
فتح الحزمة
k this deck
14
The hasNext()method of the Iterator interface has a return value of:
(a)byte
(b)int
(c)boolean
(d)none of the above
(a)byte
(b)int
(c)boolean
(d)none of the above
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 44 في هذه المجموعة.
فتح الحزمة
k this deck
15
All of the following are members of Java's Collection class except:
(a)Queue< T >
(b)LinkedList< T >
(c)Vector< T >
(d)Set< T >
(a)Queue< T >
(b)LinkedList< T >
(c)Vector< T >
(d)Set< T >
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 44 في هذه المجموعة.
فتح الحزمة
k this deck
16
The Collection class or interface that allows only unique elements is the ___________ class or interface.
(a)List< T >
(b)Set< T >
(c)Vector< T >
(d)all of the above
(a)List< T >
(b)Set< T >
(c)Vector< T >
(d)all of the above
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 44 في هذه المجموعة.
فتح الحزمة
k this deck
17
If you want a class that implements the Map interface and do not need any methods beyond those in the Map interface,you can use the ____________ class.
(a)Vector< T >
(b)AbstractMap< K,V >
(c)HashMap< K,V >
(d)HashSet< T >
(a)Vector< T >
(b)AbstractMap< K,V >
(c)HashMap< K,V >
(d)HashSet< T >
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 44 في هذه المجموعة.
فتح الحزمة
k this deck
18
A Java collection is any class that implements the Collection interface.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 44 في هذه المجموعة.
فتح الحزمة
k this deck
19
All of the following are methods of the Iterator interface except:
(a)clear()
(b)hasNext()
(c)next()
(d)remove()
(a)clear()
(b)hasNext()
(c)next()
(d)remove()
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 44 في هذه المجموعة.
فتح الحزمة
k this deck
20
To use Java's Vector class,you must import the ___________ package.
(a)java.Math
(b)java.Exception
(c)java.util
(d)java.lang
(a)java.Math
(b)java.Exception
(c)java.util
(d)java.lang
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 44 في هذه المجموعة.
فتح الحزمة
k this deck
21
When an interface lists a method as "optional," you do not need to implement it when defining a class that implements the interface.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 44 في هذه المجموعة.
فتح الحزمة
k this deck
22
The number of entries that may be added to a HashMap object is limited to what is specified as the initial capacity in the constructor for the HashMap object.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 44 في هذه المجموعة.
فتح الحزمة
k this deck
23
A vector can potentially encounter an ArrayIndexOutOfBoundsException.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 44 في هذه المجموعة.
فتح الحزمة
k this deck
24
Write a Java statement that changes the value of element 27 to 5.0 in the resulting vector in number 3 above.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 44 في هذه المجموعة.
فتح الحزمة
k this deck
25
An Iterator is an object that allows your code to produce the elements in a vector or other container one after the other,exactly once.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 44 في هذه المجموعة.
فتح الحزمة
k this deck
26
Write a Java statement to resize the resulting vector in number 2 above to 100.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 44 في هذه المجموعة.
فتح الحزمة
k this deck
27
What is the difference between a vector's size and a vector's capacity?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 44 في هذه المجموعة.
فتح الحزمة
k this deck
28
Write a Java statement to create a vector with initial capacity of 50.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 44 في هذه المجموعة.
فتح الحزمة
k this deck
29
What must you do before adding a primitive type to a vector?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 44 في هذه المجموعة.
فتح الحزمة
k this deck
30
The List interface is for collections that allow repetition of elements and do not impose an order on their elements.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 44 في هذه المجموعة.
فتح الحزمة
k this deck
31
Classes that implement the Set interface allows duplicate elements to occur.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 44 في هذه المجموعة.
فتح الحزمة
k this deck
32
The difference between the List interface and the Set interface is that the Set interface does not impose an order on its unique elements.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 44 في هذه المجموعة.
فتح الحزمة
k this deck
33
The V parameter in a HashMap may be any object,but the K parameter must be a String.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 44 في هذه المجموعة.
فتح الحزمة
k this deck
34
For-each loops can not be used with Collection classes.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 44 في هذه المجموعة.
فتح الحزمة
k this deck
35
Create a for loop to initially set the values of the vector created in number 1 above to the value of negative 1.0.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 44 في هذه المجموعة.
فتح الحزمة
k this deck
36
Elements of a vector must be of a primitive type,such as int,double,or char.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 44 في هذه المجموعة.
فتح الحزمة
k this deck
37
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 44 في هذه المجموعة.
فتح الحزمة
k this deck
38
The AbstractSequentialList class provides efficient implementation of sequentially moving through the list at the expense of having inefficient implementation of random access to elements.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 44 في هذه المجموعة.
فتح الحزمة
k this deck
39
Write a Java statement to recover the unused memory in the resulting vector in number 4 above.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 44 في هذه المجموعة.
فتح الحزمة
k this deck
40
All Collection classes are part of the java.util package.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 44 في هذه المجموعة.
فتح الحزمة
k this deck
41
How can one retrieve all the values of a HashMap object?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 44 في هذه المجموعة.
فتح الحزمة
k this deck
42
What is the purpose of the Java Iterator interface?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 44 في هذه المجموعة.
فتح الحزمة
k this deck
43
Compare and contrast vectors and arrays.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 44 في هذه المجموعة.
فتح الحزمة
k this deck
44
Write a method named displayList()that has one parameter of type Vector and has a return value of void.The method uses an iterator to display the contents of the Vector.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 44 في هذه المجموعة.
فتح الحزمة
k this deck