
Chapter 6 - Part Two: How to Work with Lists and Tuples
Authored by Kevin Tinsley
Instructional Technology
University
Used 4+ times

AI Actions
Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...
Content View
Student View
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
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?
Similar Resources on Wayground
35 questions
BSCS 4-2 - Elective 4 - Midterm Examination - 2023
Quiz
•
University
36 questions
CONCEPTOS TECNICOS DE REDES DE COMP.
Quiz
•
University
40 questions
Quiz despre Cloud Computing
Quiz
•
University
35 questions
AI QUIZ (CLASS 10)
Quiz
•
10th Grade - University
40 questions
Unity Game Engine Overview
Quiz
•
University
35 questions
Men's Haircutting
Quiz
•
University
39 questions
ISDS 351 Midterm Practice Quiz
Quiz
•
University
35 questions
BSIT 3-2 - IAS - Midterm Examination - 2023
Quiz
•
University
Popular Resources on Wayground
8 questions
Spartan Way - Classroom Responsible
Quiz
•
9th - 12th Grade
15 questions
Fractions on a Number Line
Quiz
•
3rd Grade
14 questions
Boundaries & Healthy Relationships
Lesson
•
6th - 8th Grade
20 questions
Equivalent Fractions
Quiz
•
3rd Grade
3 questions
Integrity and Your Health
Lesson
•
6th - 8th Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
9 questions
FOREST Perception
Lesson
•
KG
20 questions
Main Idea and Details
Quiz
•
5th Grade
Discover more resources for Instructional Technology
20 questions
Disney Trivia
Quiz
•
University
7 questions
Fragments, Run-ons, and Complete Sentences
Interactive video
•
4th Grade - University
7 questions
Renewable and Nonrenewable Resources
Interactive video
•
4th Grade - University
10 questions
DNA Structure and Replication: Crash Course Biology
Interactive video
•
11th Grade - University
7 questions
Force and Motion
Interactive video
•
4th Grade - University
20 questions
Implicit vs. Explicit
Quiz
•
6th Grade - University
14 questions
Ch.3_TEACHER-led
Quiz
•
University
7 questions
Comparing Fractions
Interactive video
•
1st Grade - University