No student devices needed. Know more
20 questions
What will run when the following code is executed?
Count = 0
while count < 10:
print count
count += 1
0,1,2,3,4,5,6,7,8,9,10
0,1,2,3,4,5,6,7,8,9
1,2,3,4,5,6,7,8,9,
0,1,2,3,4,5,6,7,8,9,10,11
What will run when the following code is executed?
def my_function(x):
for i in range(0, len(x)):
x[i] = x[i]
return x
print my_function(range(5))
0,1,2,3,4,5
1,2,3,4,5
0,1,2,3,4
None of these choices
What will run when the following code is executed?
N = [3, 5, 7]
def double_list(x):
for i in range(0, len(x)):
x[i] = x[i] *2
3,10,7
6,10,14
3,5,7
[6,10,14]
What will run when the following code is executed?
N = [3, 5, 7]
def print_list(x):
for i in range(0, len(x)):
print x[i]
print_list(n)
3,5,7
[3,5,7]
{3,5,7}
None of the above
What will run when the following code is executed?
def list_function(x):
x[2] = x[2] +12
return x
n = [26, 29, 32]
print x[2]
32
29
44
None of these choices
What will run when the following code is executed?
N = [10, 20, 35]
n.append(42)
print n
10,20,35,42
{10,20,35,42}
*10,20,35,42*
[10,20,35,42]
What will run when the following code is executed?
N = [22, 13, 5]
N[0] = n[0] * 3
print N[0]
22
66
15
None of the above
What will run when the following code is executed?
n = [1,2,3,5,7,8]
print n[2]
2
3
5
7
What will run when the following code is executed?
n = [10, 15, 25, 35, 45]
n.append(14)
print n
10,15,25,35,45,14
[10,15,25,35,45,14]
{10,15,25,35,45}
None of these options
What will run when the following code is executed?
n = [0, 11, 13, 15, 22, 35]
n.pop(0)
print n
[0, 11, 13, 15, 22, 35]
[0,13, 15, 22, 35]
[0, 11, 13, 15, 22,]
[11, 13, 15, 22, 35]
What will run when the following code is executed?
def list_function(x):
x[1] = x[1] + 3
return x
n = [3, 5, 7]
print list_function(n)
3,5,7
[3,8,7]
3,8,7
{3,8,7}
What will run when the following code is executed?
n = [3, 5, 7]
def list_extender(lst):
lst.append(9)
return lst
print list_extender(n)
[9,3,5,7]
9,3,5,7
3,5,7,9
[3,5,7,9]
What is a condition?
A loop never exits
An expression that decides whether the loop is going to continue being executed or not
A statement that creates a function to determine the variance of a set of items
None of the above
What does the term “break” mean?
A function that has not defined properly
A loop that never exits
A one-line statement that means exit the current loop
None of the above
What does the “+=” represent?
The break statement
The number of items in a list
The increment of how much that specific count will run
None of the above
An “if” statement is an alternate way to stop a counting loop from running.
True
False
What does the term “.randint”?
Random Integer
A method of spell-check
An alternate way of "breaking" a counting loop
None of the above
In Python, the else block will continue to execute anytime the loop condition is evaluated to "False".
True
False
"String manipulation" is useful for loops if you want to modify some content in a string.
True
False
What does the term "enumerate" mean?
Works by supplying a corresponding index to each element in the list
Automatically sets the counting loops “start” number
Automatically sets the counting loops “end” number
None of the above
Explore all questions with a free account