61. What will be the output of the following Python code?
>>> a=[14,52,7]
>>>> b=a.copy()
>>> b is a
>>> a=[14,52,7]
>>>> b=a.copy()
>>> b is a
62. Suppose list1 is [3, 4, 5, 20, 5, 25, 1, 3], what is list1 after list1.reverse()?
63. What will be the output of the following Python code?
names1 = ['Amir', 'Bear', 'Charlton', 'Daman']
names2 = names1
names3 = names1[:]
names2[0] = 'Alice'
names3[1] = 'Bob'
sum = 0
for ls in (names1, names2, names3):
if ls[0] == 'Alice':
sum += 1
if ls[1] == 'Bob':
sum += 10
print sum
names1 = ['Amir', 'Bear', 'Charlton', 'Daman']
names2 = names1
names3 = names1[:]
names2[0] = 'Alice'
names3[1] = 'Bob'
sum = 0
for ls in (names1, names2, names3):
if ls[0] == 'Alice':
sum += 1
if ls[1] == 'Bob':
sum += 10
print sum
64. What is the list comprehension equivalent for: list(map(lambda x:x**-1, [1, 2, 3]))?
65. What will be the output of the following Python code?
[ord(ch) for ch in 'abc']
[ord(ch) for ch in 'abc']
66. What will be the output of the following Python code?
A = [[1, 2, 3],
[4, 5, 6],
[7, 8, 9]]
B = [[3, 3, 3],
[4, 4, 4],
[5, 5, 5]]
[B[row][col]*A[row][col] for row in range(3) for col in range(3)]
A = [[1, 2, 3],
[4, 5, 6],
[7, 8, 9]]
B = [[3, 3, 3],
[4, 4, 4],
[5, 5, 5]]
[B[row][col]*A[row][col] for row in range(3) for col in range(3)]
67. Suppose listExample is [3, 4, 5, 20, 5, 25, 1, 3], what is list1 after listExample.pop(1)?
68. What is the output when we execute list("hello")?
69. What is the output of print(k) in the following Python code snippet?
k = [print(i) for i in my_string if i not in "aeiou"]
print(k)
k = [print(i) for i in my_string if i not in "aeiou"]
print(k)
70. Write a list comprehension equivalent for the Python code shown below.
for i in range(1, 101):
if int(i*0.5)==i*0.5:
print(i)
for i in range(1, 101):
if int(i*0.5)==i*0.5:
print(i)
Read More Section(Lists in Python)
Each Section contains maximum 100 MCQs question on Lists in Python. To get more questions visit other sections.