Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Python Data Types Quiz

Total questions: 10

Worksheet time: 5mins

Name
Class
Date
1.

What are the different data types in Python?

a)

integer, float, string, list, tuple, dictionary, set, and boolean

b)

cat, dog, bird, fish

c)

red, blue, green, yellow

d)

apple, banana, orange, grape

2.

Explain the difference between mutable and immutable data types in Python.

a)

Mutable data types can only be used once, while immutable data types can be reused

b)

Mutable data types are only used for integers, while immutable data types are used for strings

c)

Mutable data types are always larger in size than immutable data types

d)

Mutable data types can be changed after creation, while immutable data types cannot be changed.

3.

Give examples of numeric data types in Python.

a)

dict, set, tuple

b)

int, float, complex

c)

str, bool, list

d)

char, double, real

4.

What is the use of the 'str' data type in Python?

a)

To store and manipulate text

b)

To create loops and conditions

c)

To store images and videos

d)

To perform mathematical operations

5.

How are lists and tuples different in Python?

a)

Lists can be modified after creation, while tuples cannot be modified after creation.

b)

Lists and tuples are the same in Python

c)

Lists and tuples cannot store different data types in Python

d)

Tuples can be modified after creation, while lists cannot be modified after creation

6.

Explain the concept of type conversion in Python.

a)

Type conversion in Python refers to the process of converting lists into dictionaries.

b)

Type conversion in Python refers to the process of converting text into images.

c)

Type conversion in Python refers to the process of converting one data type into another.

d)

Type conversion in Python refers to the process of converting integers into floats.

7.

What is the purpose of the 'bool' data type in Python?

a)

To perform mathematical operations

b)

To store text values

c)

To represent boolean values

d)

To represent date and time values

8.

Discuss the importance of understanding data types in programming.

a)

It has no importance in programming

b)

It only makes the code more complicated

c)

Data types are not relevant in programming

d)

It helps in efficient memory usage, proper data manipulation, and avoiding errors.

9.

How are dictionaries and sets different in Python?

a)

Dictionaries are key-value pairs while sets are unordered collections of unique elements.

b)

Dictionaries are ordered while sets are unordered

c)

Dictionaries can only store integers while sets can store any data type

d)

Dictionaries can have duplicate elements while sets cannot

10.

Explain the concept of type inference in Python.

a)

Type inference in Python refers to the process of converting one data type to another automatically

b)

The interpreter automatically determines the data type of a variable based on the value assigned to it.

c)

Type inference is the process of explicitly specifying the data type of a variable in Python

d)

Type inference is not supported in Python and all data types must be explicitly declared