Filters
Question type

Study Flashcards

What is the value of set S after the following operations? S = set([ 3, 9, 6 ]) S.add(6) S.add(4) S.remove(6)


A) {3 9 6 4}
B) {3 9 4}
C) {3 9 6}
D) {3 4 6 9}

E) A) and B)
F) A) and C)

Correct Answer

verifed

verified

Referring to the keysToIndexes function, what is the result of the following statement? keysToIndexes([ 39, 18, 4, 51, 6, 28 ], 9)


A) [ 4, 1, 5, 7, 6, 2 ]
B) [ 3, 0, 4, 6, 6, 1 ]
C) [ 2, 0, 3, 5, 5, 0 ]
D) [ 8, 3, 6, 0, 1, 4 ]

E) A) and B)
F) B) and C)

Correct Answer

verifed

verified

Two keys that hash to the same index is called a collision.

A) True
B) False

Correct Answer

verifed

verified

The data in sets and dictionaries are ordered by position by default.

A) True
B) False

Correct Answer

verifed

verified

The simplest implementations of sets are subclasses of which other class?


A) bags
B) queues
C) stacks
D) lists

E) None of the above
F) All of the above

Correct Answer

verifed

verified

What strategy for implementing sets attempts to approximate random access into an array for insertions, removals, and searches?


A) indexing
B) linking
C) hashing
D) keying

E) A) and C)
F) C) and D)

Correct Answer

verifed

verified

If S1 and s2 are sets, the expression s1.issubset(s2) returns True if s2 is a subset of s1 .

A) True
B) False

Correct Answer

verifed

verified

The dictionary constructor has two optional collection arguments: a collection of keys and a collection of corresponding values.

A) True
B) False

Correct Answer

verifed

verified

Much like a list, a set contains items that are in a particular order.

A) True
B) False

Correct Answer

verifed

verified

What happens when two keys map to the same index after a hashing function has been applied?


A) the array is lengthened
B) a collision occurs
C) the second item is mapped to the next cell
D) the hash is reapplied with a random value

E) B) and C)
F) A) and D)

Correct Answer

verifed

verified

Showing 41 - 50 of 50

Related Exams

Show Answer