Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1 The expression data[1] evaluates to a 10 b 20 2 The expression data[1:3] evalu

ID: 3665261 • Letter: 1

Question

1 The expression data[1] evaluates to

a 10

b 20

2 The expression data[1:3] evaluates to

a [10, 20, 30]

b [20, 30]

3 The expression data.index(20) evaluates to

a 1

b 2

c True

4 The expression data + [40, 50] evaluates to

a [10, 60, 80]

b [10, 20, 30, 40, 50]

5 After the statement data[1] = 5, data evaluates to

a [5, 20, 30]

b [10, 5, 30]

6 After the statement data.insert(1, 15), data evaluates to

a [15, 10, 20, 30]

b [10, 15, 30]

c [10, 15, 20, 30]

For questions 7–10, assume that the variable info refers to the dictionary

{“name”:”Sandy”, “age”:17}.

7 The expression info.keys() evaluates to

a (“name”, “age”)

b [“name”, “age”]

8 The expression info.get(“hobbies”, None) evaluates to

a “knitting”

b None

c 1000

9 The method to remove an entry from a dictionary is named

a delete

b pop

c remove

10 Which of the following are immutable data structures?

a dictionaries and lists
b strings and tuples

Explanation / Answer

For Q1 to Q6, you haven't provided the data variable. I am assuming that it is [10,20,30]
Q1. b
Q2 b
Q3 a
Q4 b
Q5 b
Q6 a
Q7 b
Q8 b
Q9 b
Q10 a