Question
QUESTION 1 What is the value of aList after the following code is executed? aList = [1, 2, 3] aList.remove(2) a. [3] b. [1, 2]
QUESTION 1
What is the value of aList after the following code is executed?
aList = [1, 2, 3]
aList.remove(2)
a. [3]
b. [1, 2]
c. [1]
d. [1, 3]
QUESTION 2
What is the value of r after the following code executes?
mySet = {2, 3, 5, 7, 11}
yourSet = {5, 7, 2, 11, 3}
r = yourSet == mySet
a.True
b. 0
c. {5, 7, 2, 11, 3}
d. False
QUESTION 3
Which object type is immutable?
a. list
b. dict
c. tuple
d. set
QUESTION 4
Which operator can you use to test for item membership in a collection?
a. is
b. in
c. ==
d. @
QUESTION 5
Which real-world item best represents a hierarchical collection?
a. a box of legos
b. wiring diagrams
c. a queue of customers
d. a family tree
QUESTION 6
Which real-world item best represents a linear collection?
a. stack of bricks
b. table of contents
c. file system
d. organizational chart
QUESTION 7
An analysis of an algorithm's complexity divides its behavior into what three types of cases?
a. minimum case, maximum case, average case
b. best case, worst case, average case
c. linear case, quadratic case, logarithmic case
d. sequential case, exponential case, binary case
QUESTION 8
How can an algorithm be described in which the work it does grows as a function of the square of the problem size?
a. linear
b. quadratic
c. logarithmic
d. exponential
QUESTION 9
How can the following algorithm be described?
position = 0
while position < len(lyst):
if target == lyst[position]:
return position
position += 1return -1
a. sequential search
b. binary search
c. selection sort
d. bubble sort
QUESTION 10
How can the performance complexity of the following algorithm be described?
for x in range(numIterations):
value = value * xprint(value)
- quadratic
b. logarithmic
c. linear
d. exponential
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started