71. Suppose list1 = [0.5 * x for x in range(0, 4)], list1 is:
72. What will be the output of the following Python code?
>>>list1 = [1, 3]
>>>list2 = list1
>>>list1[0] = 4
>>>print(list2)
>>>list1 = [1, 3]
>>>list2 = list1
>>>list1[0] = 4
>>>print(list2)
73. What will be the output of the following Python code?
data = [[[1, 2], [3, 4]], [[5, 6], [7, 8]]]
def ttt(m):
v = m[0][0]
for row in m:
for element in row:
if v < element: v = element
return v
print(ttt(data[0]))
data = [[[1, 2], [3, 4]], [[5, 6], [7, 8]]]
def ttt(m):
v = m[0][0]
for row in m:
for element in row:
if v < element: v = element
return v
print(ttt(data[0]))
74. What will be the output of the following Python code?
word1="Apple"
word2="Apple"
list1=[1,2,3]
list2=[1,2,3]
print(word1 is word2)
print(list1 is list2)
word1="Apple"
word2="Apple"
list1=[1,2,3]
list2=[1,2,3]
print(word1 is word2)
print(list1 is list2)
75. Suppose list1 is [4, 2, 2, 4, 5, 2, 1, 0], Which of the following is correct syntax for slicing operation?
76. What will be the output of the following Python code?
names1 = ['Amir', 'Bala', 'Chales']
if 'amir' in names1:
print(1)
else:
print(2)
names1 = ['Amir', 'Bala', 'Chales']
if 'amir' in names1:
print(1)
else:
print(2)
77. What will be the output of the following Python code?
a=165
b=sum(list(map(int,str(a))))
print(b)
a=165
b=sum(list(map(int,str(a))))
print(b)
78. What will be the output of the following Python code?
a=[[]]*3
a[1].append(7)
print(a)
a=[[]]*3
a[1].append(7)
print(a)
79. What will be the output of the following Python code?
def unpack(a,b,c,d):
print(a+d)
x = [1,2,3,4]
unpack(*x)
def unpack(a,b,c,d):
print(a+d)
x = [1,2,3,4]
unpack(*x)
80. What will be the output of the following Python code snippet?
print([if i%2==0: i; else: i+1; for i in range(4)])
print([if i%2==0: i; else: i+1; for i in range(4)])
Read More Section(Lists in Python)
Each Section contains maximum 100 MCQs question on Lists in Python. To get more questions visit other sections.