wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

06. Python Dictionary - Sets Quiz

Total questions: 10

Worksheet time: 5mins

Name
Class
Date
1.

What is the main feature of a Python dictionary?

a)

Stores values in sequential order

b)

Stores data as key-value pairs

c)

Allows duplicate keys

d)

Works exactly like a list

2.

What will be the output

a)

a

b)

1

c)

2

d)

Error

3.

Which of the following is not allowed in dictionary keys

a)

Integer

b)

String

c)

List

d)

Tuple

e)

All are allowed

4.

What will happen

a)

Error

b)

z

c)

None

d)

0

e)

Nothong

5.

Which method is used to return all keys in a dictionary

a)

.keys()

b)

.values()

c)

.items()

d)

.get()

6.

What is the output

a)

{"apple": 2, "banana": 3}

b)

{"apple": 2, "banana": 5}

c)

{"banana": 5}

d)

Error

7.
a)

True

b)

False

c)

None

d)

Error

8.

What is the main characteristic of a Python set

a)

Allows duplicate elements

b)

Stores elements in order

c)

Stores only unique elements (no duplicates)

d)

Works like a dictionary with key-value pairs

9.

Which method removes an element from a set and raises an error if the element does not exist?

a)

.remove()

b)

.discard()

c)

.pop()

d)

.delete()

10.

What is the output

a)

True

b)

False

c)

None

d)

Error