
SAQ 4.1

Quiz
•
Other
•
University
•
Hard
Parker Gaston
FREE Resource
17 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Using a for loop, we can iterate through the items of a Python list in either a "by item" or a "by index" manner.
True
False
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
This function is supposed to sum all of the elements in a list of numbers. Which of the following should replace the comment line?
def sumList(myList):
acc = 0
# what goes here?
acc = acc + myList[i]
return acc
for i in range(len(myList)):
for acc in myList:
for myList:
for x in myList:
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Assuming the parameter myList is a list of integers between zero and 100, what does this function return?
def foo(myList):
x = -1
for y in myList:
if y > x:
x = y
return x
The second largest value in myList
The smallest value in myList
The second smallest value in myList
The largest value in myList
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the output of this code?
myList = [-1, 4, 5, -3, 8, 4, 1, 0, -3, 0]
acc = 0
for i in myList:
if i > 0:
acc = acc + i
acc
-7
22
7
45
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is output by the following code?
changeList = [1, 2, "buckle my shoe", 3, 4, "shut the door"]
changeList[2] = "the sky is blue"
changeList
'the sky is blue'
[1, 'the sky is blue', "buckle my shoe", 3, 4, 'shut the door']
TypeError:object does not support item assignment
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Python provides the _________ function to create a list from a range or string.
list
append
insert
[ ]
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
The __________ list method removes and returns the last item in a list.
reverse
count
Create a free account and access millions of resources
Similar Resources on Wayground
21 questions
Python QCM

Quiz
•
University
16 questions
Sung + Belt + ACC

Quiz
•
1st Grade - University
15 questions
HOW LONG HAVE YOU BEEN ...?

Quiz
•
10th Grade - Professi...
22 questions
Pet simulator x quiz

Quiz
•
KG - Professional Dev...
20 questions
Round 3

Quiz
•
University
12 questions
Merry Xmas

Quiz
•
KG - University
15 questions
सत्यनिष्ठा / Integrity

Quiz
•
University
12 questions
Agenda Review

Quiz
•
7th Grade - University
Popular Resources on Wayground
10 questions
Lab Safety Procedures and Guidelines

Interactive video
•
6th - 10th Grade
10 questions
Nouns, nouns, nouns

Quiz
•
3rd Grade
10 questions
9/11 Experience and Reflections

Interactive video
•
10th - 12th Grade
25 questions
Multiplication Facts

Quiz
•
5th Grade
11 questions
All about me

Quiz
•
Professional Development
22 questions
Adding Integers

Quiz
•
6th Grade
15 questions
Subtracting Integers

Quiz
•
7th Grade
9 questions
Tips & Tricks

Lesson
•
6th - 8th Grade
Discover more resources for Other
21 questions
Spanish-Speaking Countries

Quiz
•
6th Grade - University
20 questions
Levels of Measurements

Quiz
•
11th Grade - University
7 questions
Common and Proper Nouns

Interactive video
•
4th Grade - University
12 questions
Los numeros en español.

Lesson
•
6th Grade - University
7 questions
PC: Unit 1 Quiz Review

Quiz
•
11th Grade - University
7 questions
Supporting the Main Idea –Informational

Interactive video
•
4th Grade - University
12 questions
Hurricane or Tornado

Quiz
•
3rd Grade - University
7 questions
Enzymes (Updated)

Interactive video
•
11th Grade - University