DATA STRUCTURES AND ALGORITHMS
EXAM QUESTIONS WITH 100%
CORRECT ANSWERS L LATEST
VERSION 2025/2026.
A program can modify the elements of an existing list. True or False - ANS True
The size of a list is determined when the list is created and can not change. True or False -
ANS False
All elements of a list must have the same type. True or False - ANS False
The statement del my_list[2] produces a new list without the element in position 2. True or
False. - ANS False
The statement my_list1 + my_list2 produces a new list. True or False - ANS True
Assume that my_list is [0, 5, 10, 15]. What value is returned by sum(my_list)? - ANS 30
Assume that my_list is [0, 5, 10, 15]. What value is returned by max(my_list)? - ANS 15
Assume that my_list is [0, 5, 10, 15]. What value is returned by any(my_list)? - ANS True
1 @COPYRIGHT 2025/2026 ALLRIGHTS RESERVED.
,Assume that my_list is [0, 5, 10, 15]. What value is returned by all(my_list)? - ANS False
Assume that my_list is [0, 5, 10, 15]. What value is returned by min(my_list)? - ANS 0
Given the list nums = [[10, 20, 30], [98, 99]], what does nums[0][0] evaluate to? - ANS 10
Given the list nums = [[10, 20, 30], [98, 99]], what does nums[1][1] evaluate to? - ANS 99
Given the list nums = [[10, 20, 30], [98, 99]], what does nums[0] evaluate to? -
ANS [10,20,30]
Create a nested list nums whose only element is the list [21, 22, 23]. - ANS nums =
[[21,22,23]]
1) Assume the following list has been created:
scores = [[75,100,82,76], [85,98,89,99], [75,82,85,5]]
Write an indexing expression that gets the element from scores whose value is 100. -
ANS scores[0][1]
scores = [[75,100,82,76], [85,98,89,99], [75,82,85,5]]
How many elements does scores contain? (The result of len(scores)). - ANS 3 that are lists.
Assume that the following code has been evaluated: nums = [1,1,2,3,5,8,13]. What is the result
of nums[1:5]? - ANS [1,2,3,5]
nums = [1,1,2,3,5,8,13].
What is the result of nums[5:10]? - ANS [8,13]
2 @COPYRIGHT 2025/2026 ALLRIGHTS RESERVED.
, nums = [1,1,2,3,5,8,13].
What is the result of nums [3:-1]? - ANS [3,5,8
Given the following code: nums = [0,25,50,75,100]:
The result of evaluating nums[0:5:2] is [25, 75]. - ANS False [0,50,100]. Indexs 0 through 5
stepping 2.
nums = [0,25,50,75,100]
The result of evaluating nums[0:-1:3] is [0, 75]. - ANS True. Index 0 going backwards stepping
3.
Consider the following program:
nums = [10, 20, 30, 40, 50]
for pos, value in enumerate(nums):
tmp = value / 2
if (tmp % 2) == 0:
nums[pos] = tmp
What's the final value of nums[1]? - ANS 10
Iterating over a list and deleting elements from the original list might cause a logical program
error. - ANS True
A programmer can iterate over a copy of a list to safely make changes to that list. - ANS True
Twice the value of each element in the list variable x. - ANS [i*2 for i in x]
The absolute value of each element in x. Use the abs() function to find the absolute value of a
number. - ANS [abs(i) for i in x]
3 @COPYRIGHT 2025/2026 ALLRIGHTS RESERVED.
EXAM QUESTIONS WITH 100%
CORRECT ANSWERS L LATEST
VERSION 2025/2026.
A program can modify the elements of an existing list. True or False - ANS True
The size of a list is determined when the list is created and can not change. True or False -
ANS False
All elements of a list must have the same type. True or False - ANS False
The statement del my_list[2] produces a new list without the element in position 2. True or
False. - ANS False
The statement my_list1 + my_list2 produces a new list. True or False - ANS True
Assume that my_list is [0, 5, 10, 15]. What value is returned by sum(my_list)? - ANS 30
Assume that my_list is [0, 5, 10, 15]. What value is returned by max(my_list)? - ANS 15
Assume that my_list is [0, 5, 10, 15]. What value is returned by any(my_list)? - ANS True
1 @COPYRIGHT 2025/2026 ALLRIGHTS RESERVED.
,Assume that my_list is [0, 5, 10, 15]. What value is returned by all(my_list)? - ANS False
Assume that my_list is [0, 5, 10, 15]. What value is returned by min(my_list)? - ANS 0
Given the list nums = [[10, 20, 30], [98, 99]], what does nums[0][0] evaluate to? - ANS 10
Given the list nums = [[10, 20, 30], [98, 99]], what does nums[1][1] evaluate to? - ANS 99
Given the list nums = [[10, 20, 30], [98, 99]], what does nums[0] evaluate to? -
ANS [10,20,30]
Create a nested list nums whose only element is the list [21, 22, 23]. - ANS nums =
[[21,22,23]]
1) Assume the following list has been created:
scores = [[75,100,82,76], [85,98,89,99], [75,82,85,5]]
Write an indexing expression that gets the element from scores whose value is 100. -
ANS scores[0][1]
scores = [[75,100,82,76], [85,98,89,99], [75,82,85,5]]
How many elements does scores contain? (The result of len(scores)). - ANS 3 that are lists.
Assume that the following code has been evaluated: nums = [1,1,2,3,5,8,13]. What is the result
of nums[1:5]? - ANS [1,2,3,5]
nums = [1,1,2,3,5,8,13].
What is the result of nums[5:10]? - ANS [8,13]
2 @COPYRIGHT 2025/2026 ALLRIGHTS RESERVED.
, nums = [1,1,2,3,5,8,13].
What is the result of nums [3:-1]? - ANS [3,5,8
Given the following code: nums = [0,25,50,75,100]:
The result of evaluating nums[0:5:2] is [25, 75]. - ANS False [0,50,100]. Indexs 0 through 5
stepping 2.
nums = [0,25,50,75,100]
The result of evaluating nums[0:-1:3] is [0, 75]. - ANS True. Index 0 going backwards stepping
3.
Consider the following program:
nums = [10, 20, 30, 40, 50]
for pos, value in enumerate(nums):
tmp = value / 2
if (tmp % 2) == 0:
nums[pos] = tmp
What's the final value of nums[1]? - ANS 10
Iterating over a list and deleting elements from the original list might cause a logical program
error. - ANS True
A programmer can iterate over a copy of a list to safely make changes to that list. - ANS True
Twice the value of each element in the list variable x. - ANS [i*2 for i in x]
The absolute value of each element in x. Use the abs() function to find the absolute value of a
number. - ANS [abs(i) for i in x]
3 @COPYRIGHT 2025/2026 ALLRIGHTS RESERVED.