No student devices needed. Know more
10 questions
Which of the following data structures is immutable?
Tuple
List
Dictionary
2d List
What does this program print?
heights = [65, 56, 67, 48, 64]
heights.sort()
heights.extend([60, 61, 62])
heights.remove(67)
print(heights)
[48, 56, 64, 65, [60, 61, 62]]
[48, 56, 60, 61, 62, 64, 65]
[48, 56, 64, 65, 60, 61, 62]
The program will error.
How many times does this program print That's a large class!?
num_students = [23, 21, 33, 35, 24, 35]
for num in num_students:
if num > 23:
print("That's a large class!")
0
1
4
6
What would the following program print to the screen when run?
my_list = [7, 0, 0, "d", "n", "o", "B"]
my_list.reverse()
for thing in my_list:
print(thing)
7
0
0
d
n
o
B
0
0
7
B
o
n
d
B
o
n
d
0
0
7
700donB
Given the following list:
my_list = ["s", "Z", "e", "c", "c", "e", "r", "h", "e", "p", "t"]
which program below would give the following output:
s
e
c
r
e
t
for index in my_list:
if index % 2 == 0:
print(my_list[index])
for index in range(my_list):
if index % 2 == 0:
print(my_list[index])
for index in len(my_list):
if index % 2 == 0:
print(my_list[index])
for index in range(len(my_list)):
if index % 2 == 0:
print(my_list[index])
Which values entered into ‘my_list’ would print a value of ‘-1’ after the program has run?
my_list = [...]
num = 0
for thing in my_list:
num = num - thing
print(num)
5, -10, 6
-10, -5, 6
-5, 10, 6
-5, 0, 10, 6
Which of the following programs would produce the following output:
1. honey
2. bread
3. jelly
4. plates
my_list = ["honey", "bread", "jelly", "plates"]
for index in range(len(my_list)):
print(str(index) + ". " + my_list)
my_list = ["honey", "bread", "jelly", "plates"]
for index in range(len(my_list)):
print(str(index+1) + ". " + my_list[index])
my_list = ["honey", "bread", "jelly", "plates"]
for index in my_list:
print(str(index+1) + ". " + my_list[index])
my_list = ["honey", "bread", "jelly", "plates"]
for index in len(my_list):
print(str(index) + ". " + my_list[index])
Which of the following programs would alter my_list to consist of the following:
[‘red’, ‘green’, ‘blue’, ‘orange’, ‘yellow’]
my_list = ['red', 'green', 'blue', 'orange']
my_list.append('yellow')
my_list = ['red', 'green', 'blue', 'orange']
my_list.extend('yellow')
my_list = ['red', 'green', 'blue', 'orange']
my_list.replace('yellow')
my_list = ['red', 'green', 'blue', 'orange']
my_list.add('yellow')
What will be the output of the following program?
my_list = [1, 2, 3, 4]
num = 5
for index in range(len(my_list)):
my_list.append(num + index)
print(my_list
[1, 2, 3, 4, 5, 5, 5, 5]
[1, 2, 3, 4, 5]
[1, 2, 3, 4, 6, 7, 8, 9]
[1, 2, 3, 4, 5, 6, 7, 8]
What kind of data structure is user_data in the following declaration?
user_data = ("TJ", 24, "artLover123")
Tuple
List
String
2d List
Explore all questions with a free account