31
What will be the output of the following Python code snippet?
x = [i**+1 for i in range(3)]; print(x);
Answer & Solution
Answer: Option
A
32
What will be the output of the following Python code?
print(list(zip((1,2,3),('a'),('xxx','yyy'))))
print(list(zip((2,4),('b','c'),('yy','xx'))))
Answer & Solution
Answer: Option
D
33
What will be the output of the following Python code snippet?
Answer & Solution
Answer: Option
C
34
What will be the output of the following Python code?
l1=[10, 20, 30]
l2=[-10, -20, -30]
l3=[x+y for x, y in zip(l1, l2)]
print(l3)
Answer & Solution
Answer: Option
D
35
Suppose list1 is [1, 3, 2], What is list1 * 2?
Answer & Solution
Answer: Option
C
36
What will be the output of the following Python code?
def example(L):
''' (list) -> list
'''
i = 0
result = []
while i < len(L):
result.append(L[i])
i = i + 3
return result
Answer & Solution
Answer: Option
A
37
What will be the output of the following Python code?
a=[1,2,3]
b=a.append(4)
print(a)
print(b)
Answer & Solution
Answer: Option
B
38
What will be the output of the following Python code snippet?
print([i+j for i in "abc" for j in "def"])
Answer & Solution
Answer: Option
D
39
What will be the output of the following Python code?
>>>names = ['Amir', 'Bear', 'Charlton', 'Daman']
>>>print(names[-1][-1])
Answer & Solution
Answer: Option
D
40
To add a new element to a list we use which command?
Answer & Solution
Answer: Option
B