Chapter 6 - Part Two: How to Work with Lists and Tuples
Quiz
•
Instructional Technology
•
University
•
Practice Problem
•
Easy
Kevin Tinsley
Used 4+ times
FREE Resource
Enhance your content in a minute
39 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What does the add_to_list() function do in the given code?
The add_to_list() function
def add_to_list(list, item):
list.append(item) # list object changed
The calling code in the main() function
# list object created
inventory = ["staff", "hat", "bread"]
add_to_list(inventory, "robe")
print(inventory) # ["staff", "hat", "bread", "robe"]
# NOTE: no need to return list object
Adds an element to the end of a list
Removes an element from a list
Sorts the list in ascending order
Clears all elements from the list
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Why is there no need to return the list object in the add_to_list() function?
The add_to_list() function
def add_to_list(list, item):
list.append(item) # list object changed
The calling code in the main() function
# list object created
inventory = ["staff", "hat", "bread"]
add_to_list(inventory, "robe")
print(inventory) # ["staff", "hat", "bread", "robe"]
# NOTE: no need to return list object
Because the list is immutable.
Because the list is passed by reference.
Because the function automatically returns the list.
Because the list is a global variable.
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Based on the hierarchy chart for the Movie List program, which of the following is not a function listed under 'main'?
display menu
list movies
add movie
search movie
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the purpose of the 'display_menu' function in the Movie List program?
To add a new movie to the list
To display the list of movies
To show the available options to the user
To delete a movie from the list
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which command in the 'display_menu' function is used to add a movie?
list
add
del
exit
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
How does the 'list' function work in the Movie List program?
It adds a new movie to the list.
It removes a movie from the list.
It displays all movies in the list.
It sorts the movies in the list alphabetically.
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the purpose of the 'delete' function in the Movie List program?
To add a new movie to the list
To remove a movie from the list
To update the details of a movie
To sort the movies in the list
Create a free account and access millions of resources
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
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?
Similar Resources on Wayground
40 questions
General Translation Theory 2023
Quiz
•
University
36 questions
CySA+ Days 7 & 8
Quiz
•
University
35 questions
FINALS TTL
Quiz
•
University
35 questions
Electrical Fire Safety Quiz
Quiz
•
University
35 questions
A.S.E. MLR created by jb
Quiz
•
10th Grade - University
40 questions
COMP 312 - Midterm Exam
Quiz
•
University
35 questions
IT Tools
Quiz
•
University
43 questions
Chapter 24
Quiz
•
KG - Professional Dev...
Popular Resources on Wayground
10 questions
Honoring the Significance of Veterans Day
Interactive video
•
6th - 10th Grade
9 questions
FOREST Community of Caring
Lesson
•
1st - 5th Grade
10 questions
Exploring Veterans Day: Facts and Celebrations for Kids
Interactive video
•
6th - 10th Grade
19 questions
Veterans Day
Quiz
•
5th Grade
14 questions
General Technology Use Quiz
Quiz
•
8th Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
15 questions
Circuits, Light Energy, and Forces
Quiz
•
5th Grade
19 questions
Thanksgiving Trivia
Quiz
•
6th Grade
Discover more resources for Instructional Technology
20 questions
Definite and Indefinite Articles in Spanish (Avancemos)
Quiz
•
8th Grade - University
7 questions
Force and Motion
Interactive video
•
4th Grade - University
9 questions
Principles of the United States Constitution
Interactive video
•
University
18 questions
Realidades 2 2A reflexivos
Quiz
•
7th Grade - University
10 questions
Dichotomous Key
Quiz
•
KG - University
25 questions
Integer Operations
Quiz
•
KG - University
7 questions
What Is Narrative Writing?
Interactive video
•
4th Grade - University
20 questions
SER vs ESTAR
Quiz
•
7th Grade - University
