WorksheetsVariables and Data Types Knowledge Check
Total questions: 16
Worksheet time: 8mins
Which of the following values would NOT be stored in an "floating point" variable?
-1.723
25.0
"Flowers"
$4.50
Which of the following values would be stored in an "integer" variable?
"Seventy"
7.0
70
False
What would be displayed on the output panel when the following code is run?
data = 750
print(data)
750
class 'int'
Error Message
data
Which data type would best hold the numeric value 3.14159?
Boolean
Integer
Floating Point
String
Strings are a group of characters with either single or double _______ _________.
Quotation Marks
Exclamation Mark
Backslash
Asterisk
True or False | Anything is a string as long as it is in quotations marks.
True
False
True or False | You can start a string with a single quotation and end with a double quotation without receiving an error.
True
False
True or False | You can combine an integer data type inside a string without an error.
True
False
True or False | When concatenating strings together, Python will not add a space. You must either add spaces to your variables values or adda manual space.
True
False
What would be displayed on the output panel when the following code is run?
firstName = "Strawberry"
lastName = "Shortcake"
print(firstName + lastName)
StrawberryShortcake
class 'str'
Error Message
Strawberry Shortcake
What would be displayed on the output panel when the following code is run?
num1 = 3
num2 = 5
print(num1 * num2)
8
15
Error Message
class 'int'
Which math operators can be used with numeric variables when using Python? Select ALL that apply.
Addition (+)
Subtraction (-)
Multiplication (*)
Division (/)
Modulus (%)
What would be displayed on the output panel when the following code is run?
myGPA = 3.5
print("Congratulations, your GPA is " + myGPA)
Congratulations, your GPA is 3.5
Error Message
class 'string'
What built in Python function is used to convert an integer or floating point to a string value?
type()
print()
str()
What built in Python function is used to display results on the output console display?
type()
print()
str()
What built in Python function is used to display the data type of a variable value?
type()
print()
str()
