Question: #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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!