Answered step by step
Verified Expert Solution
Question
1 Approved Answer
#1 Assume that the variable data refers to the list [10, 20, 30] . The expression data[1:3] evaluates to: ? #2 The following function performs
#1 Assume that the variable data refers to the list [10, 20, 30]. The expression data[1:3] evaluates to: ?
#2
The following function performs a search for a specific item on a list and returns ________ . Choices:
a) the index where the item is located on the list. |
b) True if the item is present on the list |
c) always False |
def someSearch(inputlist, item): first = 0 last = len(inputlist)-1 found = False while first<=last and not found: midpoint = (first + last)//2 if inputlist[midpoint] == item: found = True else: if item < inputlist[midpoint]: last = midpoint-1 else: first = midpoint+1 return found
#3
Given the following sequence of operations on a set, which of the following is a possible output?
ids = set() ids.add(100) ids.add(200) ids.add(150) ids.add(200) ids
a) {100, 150, 200, 200}
b) {200, 100, 150}
c) {100, 200, 150, 200}
d) {100,500}
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