CIT 332 FINAL ACTUAL EXAM NEWEST 2025/2026 WITH
COMPLETE QUESTIONS AND CORRECT ANSWERS |ALREADY
GRADED A+||BRAND NEW VERSION!
What is printed by the following statements?
alist = [3, 67, "cat", [56, 57, "dog"], [ ], 3.14, False]print(alist[4:]) - ANSWER-[[],
3.14, False]
What is the output of the following code?
studentsNames = ['Alex', 'Smith', 'William', 'Tom']if ('Smith' in studentsNames):
print ("Found")else: print ("Not found") - ANSWER-FOUND
Which of the following statement inserts 7 to the second position in list1? -
ANSWER-list1.insert(1, 7)
Which of the following statement removes the third element from list1? -
ANSWER-list1.pop(2)
Which of the following statement removes string "python" from list1? - ANSWER-
list1.remove("python")
What is the returned value from this function?
def example(L):
i=0
result = []
1|Page
, CIT 332 Final Actual EXAM
while (i < len (L)) :
result.append(L[i])
i=i+3
return result
# Call the above function as below
x = example ( [2,3,4.5,6,7,8,9,10,11,12] )
print (x) - ANSWER-Returns a list containing every third item from L starting at
index 0.
What is the output when the following function is called as below?
def function1 (values):
values[0] = 89
# Call the above function as below
list1 = [11, 12, 30]
function1(list1)
print (list1) - ANSWER-[89, 12, 30]
What's the output from the following code segment:
def mid(vals):
vals[1] = 10
nums = [1, 2, 3]
mid(nums)
print(v) - ANSWER-[1, 10, 3]
2|Page
, CIT 332 Final Actual EXAM
What will be the output of calling the function addItem from the main function?
def addNewItem (list1):
list1 += [1]
def main():
anyList = [1, 2, 3, 4]
addNewItem ( anyList )
print ( len ( anyList ) )
print ( anyList [4] )
main() - ANSWER-5
1
What is the output of the following code?
def changeValues (intValue, listValue):
intValue = 1
listValue [0] = 44
value1 = 3
list1 = [89, 15, 13]
changeValues (value1, list1)
print (value1, list1) - ANSWER-3 [44, 15, 13]
Which of the following refer to the last element in a list names? Check all that
apply. - ANSWER-names[-1]
3|Page
, CIT 332 Final Actual EXAM
names[len(names) - 1]
Analyze the following code
list1 = ['CS', 'Math', 'EE']major1, major2 = list1
which of the following statements are true? Check all that apply. - ANSWER-There
is an error because the number of variables on the left-hand side is different from
the size of the list.
Analyze the following code
nums = [3, 7, 2, 1]print(len(nums))print(nums[-1])print(nums[len(nums)]) -
ANSWER-There is an IndexError on line 4.
What is the output of the following code?
list1 = [2, 3, 21, 14, 25]print(list1[-1]) - ANSWER-25
A list may have duplicates. - ANSWER-TRUE
Given list1 = [1, 5, 9], what is sum(list1)? - ANSWER-15
Which of the following statements create empty lists? - ANSWER-li = []
li = list()
Every element in a list must be of the same type? - ANSWER-FALSE
4|Page