Font size
WorksheetsCSC108 - Lecture 5
Total questions: 10
Worksheet time: 25mins
a,b,c = 5,6,7
a += b
c -= b
What integer values do a, b, and c hold?
a = 13, b = 6, c = 0
a = 11, b = 6, c = 1
a = 11, b = 0, c = 1
Runtime Error!
a = [1, 2, 3]
b = a*3
What would the output of the command print(b) be?
[1, 2, 3], [1, 2, 3], [1, 2, 3]
[[1, 2, 3], [1, 2, 3], [1, 2, 3]]
[1, 2, 3, 1, 2, 3, 1, 2, 3]
Runtime Error!
Given the following segment of code, what integer value does counter hold?
counter = -1
counter = -8
counter = -7
counter = 1
a = [2, 4, 6]
x, y, z = a
What are the values of x, y, and z?
x = 1, y = 2, z = 3
x = 2, y = 4, z = 6
This does not work!
Given the following segment of code, what is the output?
[0]
[1]
[0, 1]
"q"
Given the following segment of code, what is the output?
True
False
None
None of the Answers Provided
CHALLENGE QUESTION: Given the following segment of code, what is the correct output?
[[[0]], [[[0]], [1]], [[[0]], [[[0]], [1]], [2]]]
[[0], [[0], 1], [[0], [[0], 1], 2]]
[0, None, 1, None, 2, None]
[[[0]], [[[0]], [1]], [[[0]], [[[0]], [1]], [2]]]
Given the following segment of code, what is the correct output?
18
15
48
35
Given the following segment of code, the following are TRUE:
x == y == z
y = 81
c = 18
c = 20
(y == z) != x
Given the following segment of code, the following are TRUE:
The variables: a, b, c, and n, all remain unmodified
w = 63
w = 65
v = 9
v = 90
