wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Exploring Python Data Types

Total questions: 10

Worksheet time: 5mins

Name
Class
Date
1.

What is a data type in Python?

a)

A data type in Python is a method for executing functions.

b)

A data type in Python is a way to store files on disk.

c)

A data type in Python is a framework for building applications.

d)

A data type in Python is a classification that defines the type of value a variable can hold.

2.

Name the basic numeric data types in Python.

a)

int, float, complex

b)

boolean

c)

string

d)

list

3.

What data type would you use to store a person's name?

a)

float

b)

string

c)

integer

d)

boolean

4.

How do you represent a list of items in Python?

a)

A list in Python is represented using curly braces, e.g., {'item1', 'item2', 'item3'}.

b)

A list in Python is represented using parentheses, e.g., ('item1', 'item2', 'item3').

c)

A list in Python is represented using square brackets, e.g., ['item1', 'item2', 'item3'].

d)

A list in Python is represented using angle brackets, e.g., .

5.

What is the difference between a tuple and a list?

a)

Tuples are created using square brackets, while lists use parentheses.

b)

Lists can contain only numbers, while tuples can contain any data type.

c)

Tuples can be resized while lists cannot.

d)

The main difference is that tuples are immutable while lists are mutable.

6.

Which data type is used for true or false values?

a)

boolean

b)

string

c)

integer

d)

float

7.

How do you create a dictionary in Python?

a)

Dictionaries are created with parentheses, such as: ('key', 'value').

b)

You can create a dictionary in Python using curly braces, like this: {'key': 'value'}.

c)

You can create a dictionary using square brackets, like this: ['key': 'value'].

d)

You must use a list to create a dictionary, for example: ['key', 'value'].

8.

What data type would you use to store a decimal number?

a)

string

b)

float or double

c)

integer

d)

boolean

9.

Can a list contain different data types?

a)

Lists can only contain numbers or strings.

b)

No, a list can only contain one data type.

c)

Yes, a list can contain different data types.

d)

A list cannot contain any data types.

10.

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

a)

The 'str' data type is used to represent boolean values in Python.

b)

The 'str' data type is meant for storing binary data in Python.

c)

The 'str' data type is used for numerical calculations in Python.

d)

The 'str' data type is used to represent text data in Python.