CNIT 155 CORE EXAMS SET 2025/2026 QUESTIONS WITH
ANSWERS RATED A+
✔✔To get both indices and elements in transversing a list, use... - ✔✔A loop controlled
with range(len(list)) with subscripting
for index in range(len(scores)):
print (index,"\t"
,grade[i])
Enumerate(mylist) to control the
for loop
for index, grade in enumerate(scores):
print (index,"\t"
,grade)
✔✔Which is an example of using the extend method to add a whole list to the end of a
list? - ✔✔scores = [ 85, 72, 56, 98, 84, 72]
scores.extend([55, 88, 79])
✔✔What will be the result of the code below?
Names = ["William", "Scott", "Sophia"]
Names.insert (2, "Hanah") - ✔✔Names = ["William", "Scott", "Hannah", "Sophia"]
✔✔T or F: Append, extend, and insert return something. - ✔✔False
✔✔What will be the result of this code?
colors = colors.append("yellow") - ✔✔ERROR
colors = None
✔✔What will be the result of this code?
colors.append("yellow") - ✔✔Changes colors to have "yellow" at end
✔✔What will be the result of this code?
colors + primaries - ✔✔ERROR
Longer list will be thrown out
✔✔What will be the result of this code?
colors = colors + primaries - ✔✔Returns a new list
✔✔T or F: You can delete from a list by index. - ✔✔True
✔✔Which is an example of deleting from a list using index? - ✔✔del list[index]
, ✔✔Deleting from a list using index... - ✔✔Removes the element at position index and
shifts down the following elements to fill in the gap
✔✔Which is an example of deleting a range from a list by using a slice? - ✔✔del list[2 :
5]
# removes elements at positions 2, 3, and 4
✔✔What does colors.remove("blue") do? - ✔✔Searches for the first occurrence of "blue
and deleters it
✔✔What does the "search and destroy" method do? - ✔✔Searches for and removes a
specific value from a list
✔✔What happens if the specific value can not be found using the "search and destroy"
method? - ✔✔Gives a runtime error
✔✔Which is an example fo the "search and destroy" method using del? - ✔✔if "blue" in
colors:
pos =
colors.index("blue")
del colors[pos]
✔✔What does the reverse method do to a list? - ✔✔Reverses the order of a list
✔✔Which is an example of using the reverse method on a list? - ✔✔mylist = ["red",
"green", "blue"]
mylist.reverse()
print(mylist) gives ["blue", "green", "red"]
✔✔T or F: After using the reverse method on a list, the original order is lost. - ✔✔True
✔✔T or F: The reverse method does not return a value. - ✔✔True
✔✔What will be the result of this code?
mylist = mylist.reverse() - ✔✔ERROR
mylist becomes None
✔✔Which is an example of a new reversed copy of the list? (original list remains
unchanged) - ✔✔backwards = list(reversed(mylist))
✔✔Reverse is a.... - ✔✔Method that mutates the list that is its argument
ANSWERS RATED A+
✔✔To get both indices and elements in transversing a list, use... - ✔✔A loop controlled
with range(len(list)) with subscripting
for index in range(len(scores)):
print (index,"\t"
,grade[i])
Enumerate(mylist) to control the
for loop
for index, grade in enumerate(scores):
print (index,"\t"
,grade)
✔✔Which is an example of using the extend method to add a whole list to the end of a
list? - ✔✔scores = [ 85, 72, 56, 98, 84, 72]
scores.extend([55, 88, 79])
✔✔What will be the result of the code below?
Names = ["William", "Scott", "Sophia"]
Names.insert (2, "Hanah") - ✔✔Names = ["William", "Scott", "Hannah", "Sophia"]
✔✔T or F: Append, extend, and insert return something. - ✔✔False
✔✔What will be the result of this code?
colors = colors.append("yellow") - ✔✔ERROR
colors = None
✔✔What will be the result of this code?
colors.append("yellow") - ✔✔Changes colors to have "yellow" at end
✔✔What will be the result of this code?
colors + primaries - ✔✔ERROR
Longer list will be thrown out
✔✔What will be the result of this code?
colors = colors + primaries - ✔✔Returns a new list
✔✔T or F: You can delete from a list by index. - ✔✔True
✔✔Which is an example of deleting from a list using index? - ✔✔del list[index]
, ✔✔Deleting from a list using index... - ✔✔Removes the element at position index and
shifts down the following elements to fill in the gap
✔✔Which is an example of deleting a range from a list by using a slice? - ✔✔del list[2 :
5]
# removes elements at positions 2, 3, and 4
✔✔What does colors.remove("blue") do? - ✔✔Searches for the first occurrence of "blue
and deleters it
✔✔What does the "search and destroy" method do? - ✔✔Searches for and removes a
specific value from a list
✔✔What happens if the specific value can not be found using the "search and destroy"
method? - ✔✔Gives a runtime error
✔✔Which is an example fo the "search and destroy" method using del? - ✔✔if "blue" in
colors:
pos =
colors.index("blue")
del colors[pos]
✔✔What does the reverse method do to a list? - ✔✔Reverses the order of a list
✔✔Which is an example of using the reverse method on a list? - ✔✔mylist = ["red",
"green", "blue"]
mylist.reverse()
print(mylist) gives ["blue", "green", "red"]
✔✔T or F: After using the reverse method on a list, the original order is lost. - ✔✔True
✔✔T or F: The reverse method does not return a value. - ✔✔True
✔✔What will be the result of this code?
mylist = mylist.reverse() - ✔✔ERROR
mylist becomes None
✔✔Which is an example of a new reversed copy of the list? (original list remains
unchanged) - ✔✔backwards = list(reversed(mylist))
✔✔Reverse is a.... - ✔✔Method that mutates the list that is its argument