
Mini Quiz II Review Exercises
Authored by Kyriaki Mengoudi
Education
University
Used 3+ times

AI Actions
Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...
Content View
Student View
9 questions
Show all answers
1.
MULTIPLE SELECT QUESTION
30 sec • 1 pt
Which of the statements below are reasons we might iterate over a list by position, rather than by value? Select all that apply.
To modify the values in a list.
We never need to iterate by position.
To make sure we don’t modify the values in a list.
To iterate over two related lists at the same time
2.
OPEN ENDED QUESTION
3 mins • 1 pt
What does the variable new_list contain after the following code runs?
values = [2, 4, 6, 8, 10, 12] new_list = [] for num in values[:3]: new_list.append(num * 2)
Evaluate responses using AI:
OFF
3.
OPEN ENDED QUESTION
3 mins • 1 pt
What does the variable numbers contain after the following code runs? numbers = [5, 15, 25, 35, 45] for i in range(1, len(numbers)): numbers[i] = numbers[i] + numbers[i - 1]
Evaluate responses using AI:
OFF
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following Python snippets is best for calling a function named foo that takes no parameters and returns an int? Select only one option (the best answer) below.
foo = ()
foo()
foo = def()
result = foo()
5.
OPEN ENDED QUESTION
3 mins • 1 pt
What will the following Python code print? def func(p1): x = p1 * 2 return x def main(): x = 4 func(x) print(x * 2) print(func(x * 2)) main()
Evaluate responses using AI:
OFF
6.
OPEN ENDED QUESTION
3 mins • 1 pt
What will the following Python code print? def big_vals(lst, k): new_lst = [] for num in lst: if num > k: new_lst.append(num) return new_lst def main(): results = big_vals([1, 2, 3, 4, 5], 3) print(results) main()
Evaluate responses using AI:
OFF
7.
MULTIPLE SELECT QUESTION
30 sec • 1 pt
For the 2D list lst = [[2, 4, 6, 8], [1, 2, 3, 4]], circle all the expressions below that produce no error and access a one-dimensional list.
lst
lst[0]
lst[1]
lst[1][1]
lst[2]
Access all questions and much more by creating a free account
Create resources
Host any resource
Get auto-graded reports

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple
Others
Already have an account?