wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Python Data Types 207

Total questions: 21

Worksheet time: 11mins

Name
Class
Date
1.

What is the Python data type bool stand for?

a)

string

b)

integer

c)

Boolean

d)

float

2.

What does the Python data type str stand for?

a)

string

b)

integer

c)

Boolean

d)

float

3.

What does the Python data type float stand for?

a)

string

b)

integer

c)

Boolean

d)

floating point number

4.

What is the output for this line of code: print(type(8))

a)

<class 'bool'>

b)

<class 'str'>

c)

<class 'int'>

d)

<class 'float'>

5.

What is the output for this line of code: print(type(63.1))

a)

<class 'bool'>

b)

<class 'str'>

c)

<class 'int'>

d)

<class 'float'>

6.

What is the output for this line of code: print(type('hello'))

a)

<class 'bool'>

b)

<class 'str'>

c)

<class 'int'>

d)

<class 'float'>

7.

What is the output for this line of code: print(type(True))

a)

<class 'bool'>

b)

<class 'str'>

c)

<class 'int'>

d)

<class 'float'>

8.

What is the stat type returned for this line of code: type("Yeah online learning!")

a)

Boolean

b)

string

c)

integer

d)

float

9.

What is the output of the following program? Assume the user enters “Florence”, then “Fernandez”.


first_name = input("What is your first name? ")

last_name = input("What is your last name? ")

whole_name = first_name + last_name

print(whole_name)

a)

Florence+Fernandez

b)

Florence

Fernandez

c)

FlorenceFernandez

d)

Florence Fernandez

10.

Choose the correct declaration of a float variable with the value 3.14.

a)

pi = “3.14”

b)

pi = int(3.14)

c)

pi = 3.14

d)

float pi = 3.14

11.

Suppose you have a variable defined by the python statement, num = "6". What is the variable num's data type?

a)

boolean

b)

integer

c)

string

d)

float

12.

Suppose you have variable x = 4 and y = 2. What will get printed to the screen when this is executed?

print(x / y)

a)

x / y

b)

4 / 2

c)

2

d)

2.0

13.

What kind of data does an integer contain?

a)

Positive or negative whole numbers or 0

b)

Letters, special characters, numbers, or words

c)

Numbers with decimal components

d)

True or False

14.

What does the following code print?

x = 3.5

y = 2

print(int(x))

print(x + y)

a)

4

5.5

b)

3

5.5

c)

3

5

d)

4

5

15.

What is the final result of the expression 3**2?

a)

3

b)

6

c)

1.5

d)

9

16.

What is the output of the following Python code?

x = 5

y = 10

print(x + y)

a)

15

b)

510

c)

5 + 10

d)

None of the above

17.

What will be the output?

name = "Dave"

print (name)

a)

Dave

b)

'Dave'

c)

name

d)

(name)

18.
What Python command lets the user enter an answer to a question?
a)
answer()
b)
open()
c)
print()
d)
input()
19.
What symbol is used in python to assign values to a variable?
a)
equals =
b)
plus + 
c)
forward slash /
d)

colon :

20.
What is a variable?
a)
A box(memory location) where you store values
b)
a type of graphics
c)
Data type
d)
a type of memory
21.

What is Python?

a)

A programming Language

b)

A Game

c)

A type of Video

d)

None of these