Q1
<question multiple>
<p><pre><code>a = [10, 20, 30]
a.append(40) print(a) a[3] = 50 print(a) What is the final output of the list 'a' above?
Q2
a = [10, 20, 30]
a.append(40)
a[4] = 50
print(a)
What is the output when you run the above set of statements?
Q3
<question>
<p><pre><code>a = [10, '20', True]
print(type(a[2])) What is the output of the above code?
Q4
<question>
<p><pre><code>a = (10, '20', True)
a.remove(10) print(a) What is the output of the above code?
Q5
<question>
<p><pre><code>a = [10, 20, 30]
a[0] = 40 print(a) What is the output of the above code?
Q6
a = [10, 20]
print(len(a))
What is the output of the above code?
Q7
a = [10, 'b', [2, 20, 30], False]
In the above code, you see that the third element of list 'a' is another list. You are required to change the second element '20' of this inner list to '50'. I.e., after the change, your list would be
a = [10, 'b', [2, 50, 30], False]
Choose the statement which can make this change</p>
<answer>a[1][1] = 50</answer>
<answer correct>a[2][1] = 50</answer>
<answer>a[1][2] = 50</answer>
<explanation>First you get the third element of 'a' by using 'a[2]' and then get the second element of this list using the index position '1' of this expression.</explanation>
</question>
Q8
a = [10, 'b', (2, 20, 30), False]
In the above code, you see that the third element of list 'a' is a tuple. You can change the second element '20' of this tuple to '50' because it is inside a list
Q9
a = [10, 'b', (2, 20, 30), False]
a[2] = 40
a
What is the output of the above code segment?