wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Python: Quiz 2.03 - Basic Data Types

Total questions: 25

Worksheet time: 17mins

Name
Class
Date
1.

Which of the following is an Integer?

a)

15

b)

16.1

c)

19 > 2

d)

"The King in the North!"

2.

Which of the following is a Boolean Expression?

a)

19 > 2

b)

15 - 5

c)

10 // 3

d)

"Chaos is a Ladder"

3.

Which Data type is this?: "We do not sow"

a)

String

b)

Boolean

c)

Integer

d)

Float

4.

Insert the missing command below to output "Fear cuts deeper than swords":

(a)   ("Fear cuts deeper than swords")

5.

the result of this equation:

15 / 5

will be a...?

a)

Float

b)

String

c)

Boolean

d)

Integer

6.

(Fill in the blank)

We use the "_" character to specify a comment in Python

(a)  

7.

Make a variable called "sword" and assign to it the string value of "Ice" (mind your capitalization and syntax)

(a)  

8.

create a variable named "x" and assign it an integer value of 50

(a)  

9.

Look at this code:

x = 10

y = 12

x _ y == 120

Fill in the correct operator in the last statement to make it "True"?

(a)  

10.

Look at this code:

2my-first_name = "John"

Which 2 characters in the variable name do we need to remove or fix to make it work?

a)

2

b)

-

c)

_

d)

m

11.

how would we most efficiently check for the length of this string?:

text = "How long is this String?"

a)

len(text)

b)

count(text)

c)

How_long_is_this_string(text)

d)

Count each character manually

12.

Which letter will be returned with the last command in this code?:

text = "White Walkers"

text[0]

a)

"W"

b)

"w"

c)

None

d)

"s"

13.

Which letter will be returned with the last command in this code?:

text = "White Walkers"

text[-1]

a)

"s"

b)

"W"

c)

"w"

d)

" "

14.

What will be the output of this expression?:

text = "White Walkers"

text[0] == text[6]

a)

True

b)

False

15.

What would be the output of this expression? (Difficulty: Easy)

10 < 8

a)

True

b)

False

16.

What would be the output of this expression?: (Difficulty: Medium)

(2 * 5) >= (3 * 6)

a)

True

b)

False

17.

What would be the output of this expression?: (Difficulty: Harder)

((10 * 3) - (2 + 3)) >= ((20 - 10) * (1 + 1))

a)

True

b)

False

18.

How would we divide 10 by 5 in Python? (don't use floor division)

(a)  

19.

How would we divide 10 by 5 in Python using floor division?

(a)  

20.

How would we check if 5 is NOT equal to 6

a)

5 != 6

b)

5 <= 6

c)

5 >= 6

d)

5 == 6

21.

Which 2 operators do we use to tie (concatenate) strings together?

a)

,

b)

+

c)

==

d)

and

22.

In the string "abc", in which INDEX position is the "b" character?

a)

1

b)

2

c)

3

d)

0

23.

What would be the output of this expression?

a = "A Lannister always pays his debts."

"Stark" in a

a)

True

b)

False

24.

What will be the output of the print command in the code below?:

x = "la"

print(x*3)

a)

"lalala"

b)

"lalalalala"

c)

"lala"

d)

"la la la"

25.

What would be the output of this code?:

11 % 3

a)

2

b)

1

c)

4

d)

3.66666