CNIT 155 FINAL PURDUE TEST PAPER 2026
COMPLETE SOLUTION SET
◉ Which is an example of using the extend method to add a whole
list to the end of a list? Answer: 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") Answer: Names = ["William", "Scott",
"Hannah", "Sophia"]
◉ T or F: Append, extend, and insert return something. Answer:
False
◉ What will be the result of this code?
colors = colors.append("yellow") Answer: ERROR
colors = None
◉ What will be the result of this code?
colors.append("yellow") Answer: Changes colors to have "yellow" at
end
,◉ What will be the result of this code?
colors + primaries Answer: ERROR
Longer list will be thrown out
◉ What will be the result of this code?
colors = colors + primaries Answer: Returns a new list
◉ T or F: You can delete from a list by index. Answer: True
◉ Which is an example of deleting from a list using index? Answer:
del list[index]
◉ Deleting from a list using index... Answer: 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? Answer: del list[2 : 5]
# removes elements at positions 2, 3, and 4
◉ What does colors.remove("blue") do? Answer: Searches for the
first occurrence of "blue and deleters it
, ◉ What does the "search and destroy" method do? Answer: 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? Answer: Gives a runtime error
◉ Which is an example fo the "search and destroy" method using
del? Answer: if "blue" in colors:
pos =
colors.index("blue")
del colors[pos]
◉ What does the reverse method do to a list? Answer: Reverses the
order of a list
◉ Which is an example of using the reverse method on a list?
Answer: mylist = ["red", "green", "blue"]
mylist.reverse()
print(mylist) gives ["blue", "green", "red"]
COMPLETE SOLUTION SET
◉ Which is an example of using the extend method to add a whole
list to the end of a list? Answer: 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") Answer: Names = ["William", "Scott",
"Hannah", "Sophia"]
◉ T or F: Append, extend, and insert return something. Answer:
False
◉ What will be the result of this code?
colors = colors.append("yellow") Answer: ERROR
colors = None
◉ What will be the result of this code?
colors.append("yellow") Answer: Changes colors to have "yellow" at
end
,◉ What will be the result of this code?
colors + primaries Answer: ERROR
Longer list will be thrown out
◉ What will be the result of this code?
colors = colors + primaries Answer: Returns a new list
◉ T or F: You can delete from a list by index. Answer: True
◉ Which is an example of deleting from a list using index? Answer:
del list[index]
◉ Deleting from a list using index... Answer: 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? Answer: del list[2 : 5]
# removes elements at positions 2, 3, and 4
◉ What does colors.remove("blue") do? Answer: Searches for the
first occurrence of "blue and deleters it
, ◉ What does the "search and destroy" method do? Answer: 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? Answer: Gives a runtime error
◉ Which is an example fo the "search and destroy" method using
del? Answer: if "blue" in colors:
pos =
colors.index("blue")
del colors[pos]
◉ What does the reverse method do to a list? Answer: Reverses the
order of a list
◉ Which is an example of using the reverse method on a list?
Answer: mylist = ["red", "green", "blue"]
mylist.reverse()
print(mylist) gives ["blue", "green", "red"]