Deck 7: Sets and Maps

ملء الشاشة (f)
exit full mode
سؤال
Using a hash table enables us to retrieve an item in O(n2) time.
استخدم زر المسافة أو
up arrow
down arrow
لقلب البطاقة.
سؤال
Collections implementing the Set interface must contain unique elements.
سؤال
Sets contain no pair of elements e1 and e2 such that e1.equals(e2), and at most one null element.
سؤال
With respect to hash tables, if there are no collisions, the performance for search and retrieval is O(n), regardless of table size.
سؤال
Although you cannot reference a specific element of a Set, you can iterate through all its elements using an Iterator object.
سؤال
The basis of ____________________ is to transform the item's key value to an integer value which will then be transformed into a table index.
سؤال
In ____________________ addressing, each hash table element (type Object) references a single key-value pair.
سؤال
The Java API implements the Set using a(n) ____________________.
سؤال
The problem with ____________________ probing is that it tends to form clusters of keys in the table, causing longer search chains.
سؤال
Mathematically, a(n) ___________________ is a set of ordered pairs whose elements are known as the key and the value.
سؤال
An alternative to open addressing is a technique called _____________________.
سؤال
An addressing technique in which each table element references a linked list that contains all the items that hash to the the same table index is referred to as _________________________.
سؤال
In ____________________ addressing, search chains can overlap, so a search chain may include items in the table that have different starting values.
سؤال
An advantage of ____________________ is that you can store more elements in the table than the number of table slots (indexes).
سؤال
One requirement on the key-value pair for a Map object is to implement the interface ____________________, which is an inner interface of interface Map.
سؤال
Method ____ creates a set view of the entries in a Map.

A) setIterator
B) getValue
C) getKey
D) entrySet
سؤال
____ occur(s) because you can only store one key-value pair in a given array element.

A) Quadratic probing
B) Hashing
C) Collisions
D) Backtracking
سؤال
If we compare hash table performance with binary search of a sorted array, the number of comparisons required by binary search is ____.

A) O(1)
B) O(n)
C) O(log2n)
D) O(log n)
سؤال
The intersection of sets A, B is a set ____.

A) whose elements belong to A but not to B
B) whose elements belong to both A and B
C) whose elements belong either to A or B or to both A and B
D) set where every element of A is also an element of B
سؤال
Which of the following is a commonly used method of the Set interface?

A) boolean ContainsAll(Collection<E> coll)
B) boolean retain<E>(E obj)
C) boolean remove(Collection coll)
D) boolean Empty()
سؤال
With respect to the Map interface, the ____ method returns the current value associated with a given key.

A) isEmpty
B) insert
C) put
D) get
سؤال
With respect to the Map interface, the ____ method either inserts a new mapping or changes the value associated with an existing mapping.

A) get
B) isEmpty
C) put
D) insert
سؤال
Which of the following is an example of a map?

A) { (J, Jane), (B, Bill), (S, Sam), (B1, Bob), (B, Bill) }
B) { (J, Jane), (B, Bill), (S, Sam), (B1, Bob), (B2, Bill) }
C) { (J, Jane), (B, Bill), (S, Sam), (B1, Bob), (J, Jane) }
D) { (S, Sam), (B, Bill), (S, Sam), (B1, Bob), (B2, Bill) }
سؤال
The union of two sets A, B is a(n) ____.

A) set whose elements belong to both A and B
B) set whose elements belong to A but not to B
C) set where every element of A is also an element of B
D) set whose elements belong either to A or B or to both A and B
سؤال
The following is an algorithm for ____.
Compute the index by taking the item's hashCode() % table.length.
If table[index] is null
The item is not in the table.
Else if table[index] is equal to the item
The item is in the table.
Else
Continue to search the table by incrementing the index until either the item is found or a null entry is found.

A) rehashing
B) accessing an item in a hash table
C) deleting an item in a hash table
D) inserting an item in a hash table
سؤال
A NavigableSet (NavigableMap) allows the programmer to create _____________ of a Set (Map).
سؤال
A NavigableSet (NavigableMap) can be traversed in reverse order.
فتح الحزمة
قم بالتسجيل لفتح البطاقات في هذه المجموعة!
Unlock Deck
Unlock Deck
1/27
auto play flashcards
العب
simple tutorial
ملء الشاشة (f)
exit full mode
Deck 7: Sets and Maps
1
Using a hash table enables us to retrieve an item in O(n2) time.
False
2
Collections implementing the Set interface must contain unique elements.
True
3
Sets contain no pair of elements e1 and e2 such that e1.equals(e2), and at most one null element.
True
4
With respect to hash tables, if there are no collisions, the performance for search and retrieval is O(n), regardless of table size.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 27 في هذه المجموعة.
فتح الحزمة
k this deck
5
Although you cannot reference a specific element of a Set, you can iterate through all its elements using an Iterator object.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 27 في هذه المجموعة.
فتح الحزمة
k this deck
6
The basis of ____________________ is to transform the item's key value to an integer value which will then be transformed into a table index.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 27 في هذه المجموعة.
فتح الحزمة
k this deck
7
In ____________________ addressing, each hash table element (type Object) references a single key-value pair.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 27 في هذه المجموعة.
فتح الحزمة
k this deck
8
The Java API implements the Set using a(n) ____________________.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 27 في هذه المجموعة.
فتح الحزمة
k this deck
9
The problem with ____________________ probing is that it tends to form clusters of keys in the table, causing longer search chains.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 27 في هذه المجموعة.
فتح الحزمة
k this deck
10
Mathematically, a(n) ___________________ is a set of ordered pairs whose elements are known as the key and the value.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 27 في هذه المجموعة.
فتح الحزمة
k this deck
11
An alternative to open addressing is a technique called _____________________.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 27 في هذه المجموعة.
فتح الحزمة
k this deck
12
An addressing technique in which each table element references a linked list that contains all the items that hash to the the same table index is referred to as _________________________.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 27 في هذه المجموعة.
فتح الحزمة
k this deck
13
In ____________________ addressing, search chains can overlap, so a search chain may include items in the table that have different starting values.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 27 في هذه المجموعة.
فتح الحزمة
k this deck
14
An advantage of ____________________ is that you can store more elements in the table than the number of table slots (indexes).
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 27 في هذه المجموعة.
فتح الحزمة
k this deck
15
One requirement on the key-value pair for a Map object is to implement the interface ____________________, which is an inner interface of interface Map.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 27 في هذه المجموعة.
فتح الحزمة
k this deck
16
Method ____ creates a set view of the entries in a Map.

A) setIterator
B) getValue
C) getKey
D) entrySet
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 27 في هذه المجموعة.
فتح الحزمة
k this deck
17
____ occur(s) because you can only store one key-value pair in a given array element.

A) Quadratic probing
B) Hashing
C) Collisions
D) Backtracking
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 27 في هذه المجموعة.
فتح الحزمة
k this deck
18
If we compare hash table performance with binary search of a sorted array, the number of comparisons required by binary search is ____.

A) O(1)
B) O(n)
C) O(log2n)
D) O(log n)
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 27 في هذه المجموعة.
فتح الحزمة
k this deck
19
The intersection of sets A, B is a set ____.

A) whose elements belong to A but not to B
B) whose elements belong to both A and B
C) whose elements belong either to A or B or to both A and B
D) set where every element of A is also an element of B
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 27 في هذه المجموعة.
فتح الحزمة
k this deck
20
Which of the following is a commonly used method of the Set interface?

A) boolean ContainsAll(Collection<E> coll)
B) boolean retain<E>(E obj)
C) boolean remove(Collection coll)
D) boolean Empty()
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 27 في هذه المجموعة.
فتح الحزمة
k this deck
21
With respect to the Map interface, the ____ method returns the current value associated with a given key.

A) isEmpty
B) insert
C) put
D) get
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 27 في هذه المجموعة.
فتح الحزمة
k this deck
22
With respect to the Map interface, the ____ method either inserts a new mapping or changes the value associated with an existing mapping.

A) get
B) isEmpty
C) put
D) insert
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 27 في هذه المجموعة.
فتح الحزمة
k this deck
23
Which of the following is an example of a map?

A) { (J, Jane), (B, Bill), (S, Sam), (B1, Bob), (B, Bill) }
B) { (J, Jane), (B, Bill), (S, Sam), (B1, Bob), (B2, Bill) }
C) { (J, Jane), (B, Bill), (S, Sam), (B1, Bob), (J, Jane) }
D) { (S, Sam), (B, Bill), (S, Sam), (B1, Bob), (B2, Bill) }
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 27 في هذه المجموعة.
فتح الحزمة
k this deck
24
The union of two sets A, B is a(n) ____.

A) set whose elements belong to both A and B
B) set whose elements belong to A but not to B
C) set where every element of A is also an element of B
D) set whose elements belong either to A or B or to both A and B
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 27 في هذه المجموعة.
فتح الحزمة
k this deck
25
The following is an algorithm for ____.
Compute the index by taking the item's hashCode() % table.length.
If table[index] is null
The item is not in the table.
Else if table[index] is equal to the item
The item is in the table.
Else
Continue to search the table by incrementing the index until either the item is found or a null entry is found.

A) rehashing
B) accessing an item in a hash table
C) deleting an item in a hash table
D) inserting an item in a hash table
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 27 في هذه المجموعة.
فتح الحزمة
k this deck
26
A NavigableSet (NavigableMap) allows the programmer to create _____________ of a Set (Map).
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 27 في هذه المجموعة.
فتح الحزمة
k this deck
27
A NavigableSet (NavigableMap) can be traversed in reverse order.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 27 في هذه المجموعة.
فتح الحزمة
k this deck
locked card icon
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 27 في هذه المجموعة.