Font size
WorksheetsPython: Quiz 2.03 - Basic Data Types
Total questions: 25
Worksheet time: 17mins
Which of the following is an Integer?
15
16.1
19 > 2
"The King in the North!"
Which of the following is a Boolean Expression?
19 > 2
15 - 5
10 // 3
"Chaos is a Ladder"
Which Data type is this?: "We do not sow"
String
Boolean
Integer
Float
Insert the missing command below to output "Fear cuts deeper than swords":
(a) ("Fear cuts deeper than swords")
the result of this equation:
15 / 5
will be a...?
Float
String
Boolean
Integer
(Fill in the blank)
We use the "_" character to specify a comment in Python
(a)
Make a variable called "sword" and assign to it the string value of "Ice" (mind your capitalization and syntax)
(a)
create a variable named "x" and assign it an integer value of 50
(a)
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)
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?
2
-
_
m
how would we most efficiently check for the length of this string?:
text = "How long is this String?"
len(text)
count(text)
How_long_is_this_string(text)
Count each character manually
Which letter will be returned with the last command in this code?:
text = "White Walkers"
text[0]
"W"
"w"
None
"s"
Which letter will be returned with the last command in this code?:
text = "White Walkers"
text[-1]
"s"
"W"
"w"
" "
What will be the output of this expression?:
text = "White Walkers"
text[0] == text[6]
True
False
What would be the output of this expression? (Difficulty: Easy)
10 < 8
True
False
What would be the output of this expression?: (Difficulty: Medium)
(2 * 5) >= (3 * 6)
True
False
What would be the output of this expression?: (Difficulty: Harder)
((10 * 3) - (2 + 3)) >= ((20 - 10) * (1 + 1))
True
False
How would we divide 10 by 5 in Python? (don't use floor division)
(a)
How would we divide 10 by 5 in Python using floor division?
(a)
How would we check if 5 is NOT equal to 6
5 != 6
5 <= 6
5 >= 6
5 == 6
Which 2 operators do we use to tie (concatenate) strings together?
,
+
==
and
In the string "abc", in which INDEX position is the "b" character?
1
2
3
0
What would be the output of this expression?
a = "A Lannister always pays his debts."
"Stark" in a
True
False
What will be the output of the print command in the code below?:
x = "la"
print(x*3)
"lalala"
"lalalalala"
"lala"
"la la la"
What would be the output of this code?:
11 % 3
2
1
4
3.66666
