Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Variables and Data Types Knowledge Check

Total questions: 16

Worksheet time: 8mins

Name
Class
Date
1.

Which of the following values would NOT be stored in an "floating point" variable?

a)

-1.723

b)

25.0

c)

"Flowers"

d)

$4.50

2.

Which of the following values would be stored in an "integer" variable?

a)

"Seventy"

b)

7.0

c)

70

d)

False

3.

What would be displayed on the output panel when the following code is run?

data = 750

print(data)

a)

750

b)

class 'int'

c)

Error Message

d)

data

4.

Which data type would best hold the numeric value  3.14159?

a)

Boolean

b)

Integer

c)

Floating Point

d)

String

5.

Strings are a group of characters with either single or double _______  _________.

a)

Quotation Marks

b)

Exclamation Mark

c)

Backslash

d)

Asterisk

6.

True or False | Anything is a string as long as it is in quotations marks.

a)

True

b)

False

7.

True or False | You can start a string with a single quotation and end with a double quotation without receiving an error.

a)

True

b)

False

8.

True or False | You can combine an integer data type inside a string without an error.

a)

True

b)

False

9.

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.

a)

True

b)

False

10.

What would be displayed on the output panel when the following code is run?

firstName = "Strawberry"

lastName = "Shortcake"

print(firstName + lastName)

a)

StrawberryShortcake

b)

class 'str'

c)

Error Message

d)

Strawberry Shortcake

11.

What would be displayed on the output panel when the following code is run?

num1 = 3

num2 = 5

print(num1 * num2)

a)

8

b)

15

c)

Error Message

d)

class 'int'

12.

Which math operators can be used with numeric variables when using Python? Select ALL that apply.

a)

Addition (+)

b)

Subtraction (-)

c)

Multiplication (*)

d)

Division (/)

e)

Modulus (%)

13.

What would be displayed on the output panel when the following code is run?

myGPA = 3.5

print("Congratulations, your GPA is " + myGPA)

a)

Congratulations, your GPA is 3.5

b)

Error Message

c)

class 'string'

14.

What built in Python function is used to convert an integer or floating point to a string value?

a)

type()

b)

print()

c)

str()

15.

What built in Python function is used to display results on the output console display?

a)

type()

b)

print()

c)

str()

16.

What built in Python function is used to display the data type of a variable value?

a)

type()

b)

print()

c)

str()