wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Dictionary Quiz

Total questions: 10

Worksheet time: 5mins

Name
Class
Date
1.
What is a dictionary in Python?
a)
Collection of key-value pairs
b)
Collection of values only
c)
Collection of indexes
d)
Collection of functions
2.
Which symbol is used to create a dictionary?
a)
{}
b)
[]
c)
()
d)
<>
3.
Which method is used to get all keys?
a)
keys()
b)
values()
c)
items()
d)
get()
4.
Which method removes a key from dictionary?
a)
pop()
b)
add()
c)
remove()
d)
delete()
5.
Are dictionary keys unique?
a)
Yes
b)
No
c)
Sometimes
d)
Depends on value
6.
Which method returns all values?
a)
values()
b)
keys()
c)
items()
d)
pop()
7.
How do you access value of key 'age'?
a)
dict['age']
b)
dict(age)
c)
dict.age
d)
dict->age
8.
Which loop is used to read keys and values?
a)
for k,v in d.items()
b)
for i in d
c)
while d
d)
loop(d)
9.
Which datatype is dictionary?
a)
Mutable
b)
Immutable
c)
Fixed
d)
Static
10.
Which method adds or updates value?
a)
Using key assignment
b)
append()
c)
insert()
d)
add()