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
Already have an account?
Similar Resources on Wayground
35 questions
BSIT 3-2 - IAS - Midterm Examination - 2023
Quiz
•
University
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
Popular Resources on Wayground
5 questions
This is not a...winter edition (Drawing game)
Quiz
•
1st - 5th Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
10 questions
Identify Iconic Christmas Movie Scenes
Interactive video
•
6th - 10th Grade
20 questions
Christmas Trivia
Quiz
•
6th - 8th Grade
18 questions
Kids Christmas Trivia
Quiz
•
KG - 5th Grade
11 questions
How well do you know your Christmas Characters?
Lesson
•
3rd Grade
14 questions
Christmas Trivia
Quiz
•
5th Grade
20 questions
How the Grinch Stole Christmas
Quiz
•
5th Grade
Discover more resources for Instructional Technology
26 questions
Christmas Movie Trivia
Lesson
•
8th Grade - Professio...
20 questions
christmas songs
Quiz
•
KG - University
20 questions
Holiday Trivia
Quiz
•
9th Grade - University
15 questions
Holiday Movies
Quiz
•
University
14 questions
Christmas Trivia
Quiz
•
3rd Grade - University
20 questions
Christmas Trivia
Quiz
•
University
8 questions
5th, Unit 4, Lesson 8
Lesson
•
KG - Professional Dev...
20 questions
Disney Trivia
Quiz
•
University
