NEW
Font size
Worksheets06. Python Dictionary - Sets Quiz
Total questions: 10
Worksheet time: 5mins
What is the main feature of a Python dictionary?
Stores values in sequential order
Stores data as key-value pairs
Allows duplicate keys
Works exactly like a list
What will be the output
a
1
2
Error
Which of the following is not allowed in dictionary keys
Integer
String
List
Tuple
All are allowed
What will happen
Error
z
None
0
Nothong
Which method is used to return all keys in a dictionary
.keys()
.values()
.items()
.get()
What is the output
{"apple": 2, "banana": 3}
{"apple": 2, "banana": 5}
{"banana": 5}
Error
True
False
None
Error
What is the main characteristic of a Python set
Allows duplicate elements
Stores elements in order
Stores only unique elements (no duplicates)
Works like a dictionary with key-value pairs
Which method removes an element from a set and raises an error if the element does not exist?
.remove()
.discard()
.pop()
.delete()
What is the output
True
False
None
Error
