NEW
Font size
WorksheetsPython Data Types 207
Total questions: 21
Worksheet time: 11mins
What is the Python data type bool stand for?
string
integer
Boolean
float
What does the Python data type str stand for?
string
integer
Boolean
float
What does the Python data type float stand for?
string
integer
Boolean
floating point number
What is the output for this line of code: print(type(8))
<class 'bool'>
<class 'str'>
<class 'int'>
<class 'float'>
What is the output for this line of code: print(type(63.1))
<class 'bool'>
<class 'str'>
<class 'int'>
<class 'float'>
What is the output for this line of code: print(type('hello'))
<class 'bool'>
<class 'str'>
<class 'int'>
<class 'float'>
What is the output for this line of code: print(type(True))
<class 'bool'>
<class 'str'>
<class 'int'>
<class 'float'>
What is the stat type returned for this line of code: type("Yeah online learning!")
Boolean
string
integer
float
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)
Florence+Fernandez
Florence
Fernandez
FlorenceFernandez
Florence Fernandez
Choose the correct declaration of a float variable with the value 3.14.
pi = “3.14”
pi = int(3.14)
pi = 3.14
float pi = 3.14
Suppose you have a variable defined by the python statement, num = "6". What is the variable num's data type?
boolean
integer
string
float
Suppose you have variable x = 4 and y = 2. What will get printed to the screen when this is executed?
print(x / y)
x / y
4 / 2
2
2.0
What kind of data does an integer contain?
Positive or negative whole numbers or 0
Letters, special characters, numbers, or words
Numbers with decimal components
True or False
What does the following code print?
x = 3.5
y = 2
print(int(x))
print(x + y)
4
5.5
3
5.5
3
5
4
5
What is the final result of the expression 3**2?
3
6
1.5
9
What is the output of the following Python code?
x = 5
y = 10
print(x + y)
15
510
5 + 10
None of the above
What will be the output?
name = "Dave"
print (name)
Dave
'Dave'
name
(name)
colon :
What is Python?
A programming Language
A Game
A type of Video
None of these
