InfytQ Collections -Quiz 4

Question 1

Time: 00:00:00

import collections
a=collections.OrderedDict((bin(x),x) for x in range(3))
print(*a)


What is the output of the above code?

0 1 10

0 1 10

0b00 0b01 0b10

0b00 0b01 0b10

0 1 2

0 1 2

0b0 0b1 0b10

0b0 0b1 0b10

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 2

Time: 00:00:00
What is orderedDict?

dict subclass that remembers the order entries were added

dict subclass that remembers the order entries were added

dict subclass for counting hashable objects

dict subclass for counting hashable objects

dict-like class for creating a single view of multiple mappings

dict-like class for creating a single view of multiple mappings

Dict subclass that does not maintain order

Dict subclass that does not maintain order

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 3

Time: 00:00:00
___ groups multiple dicts into a single

Map

Map

Unordered dict

Unordered dict

Chain map

Chain map

None of the above

None of the above

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 4

Time: 00:00:00
Which removes duplicates from input

Lists

Lists

Tuples

Tuples

arrays

arrays

Sets

Sets

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 5

Time: 00:00:00
What is deque?

List which can delete at both ends

List which can delete at both ends

List like container which can append and delete at both ends

List like container which can append and delete at both ends

Deletes queue

Deletes queue

Type of a queue  which is used to delete

Type of a queue  which is used to delete

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 6

Time: 00:00:00

from collections import Counter 
print(Counter(['B','A','B','A','B','A','B','Y']))


What is the output of the above code?

Counter({'B': 4, 'A': 3, 'Y': 1})

Counter({'B': 4, 'A': 3, 'Y': 1})

Counter({'B': 4, 'A': 4, 'Y': 1})

Counter({'B': 4, 'A': 4, 'Y': 1})

Counter({'A': 3, 'B': 4, 'Y': 1})

Counter({'A': 3, 'B': 4, 'Y': 1})

Counter({'Y': 1, 'A': 3, 'B': 4})

Counter({'Y': 1, 'A': 3, 'B': 4})

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 7

Time: 00:00:00

from collections import defaultdict
d = defaultdict(int)
L = [1,2,3,4,3,2,1]
for i in L:
d[i] += L[i]
print(d)

defaultdict(<class 'int'>, {1: 8, 2: 6, 3: 8, 4: 3})

defaultdict(<class 'int'>, {1: 8, 2: 6, 3: 8, 4: 3})

defaultdict(<class 'int'>, {1: 4, 2: 6, 3: 8, 4: 3})

defaultdict(<class 'int'>, {1: 4, 2: 6, 3: 8, 4: 3})

defaultdict(<class 'int'>, {2: 4,1: 6, 3: 8, 4: 3})

defaultdict(<class 'int'>, {2: 4,1: 6, 3: 8, 4: 3})

defaultdict(<class 'int'>, {1: 4, 2: 6, 3: 8, 4: 3})

defaultdict(<class 'int'>, {1: 4, 2: 6, 3: 8, 4: 3})

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 8

Time: 00:00:00
Collections are containers that used to store collections of data.

True

True

False

False

Maybe True

Maybe True

Maybe False

Maybe False

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

["0","40","60","80","100"]
["Need more practice!","Keep trying!","Not bad!","Good work!","Perfect!"]

Personalized Analytics only Availble for Logged in users

Analytics below shows your performance in various Mocks on PrepInsta

Your average Analytics for this Quiz

Rank

-

Percentile

0%

Completed

0/0

Accuracy

0%

Comments