1
What will be the output of the following Python code?
names1 = ['Amir', 'Bala', 'Charlie']
names2 = [name.lower() for name in names1]
print(names2[2][0])
Answer & Solution
Answer: Option
D
2
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
B
3
What will be the output of the following Python code?
l1=[1,2,3]
l2=[4,5,6]
[x*y for x in l1 for y in l2]
Answer & Solution
Answer: Option
C
4
To remove string "hello" from list1, we use which command?
Answer & Solution
Answer: Option
A
5
Suppose listExample is [3, 4, 5, 20, 5, 25, 1, 3], what is list1 after listExample.pop()?
Answer & Solution
Answer: Option
A
6
Suppose list1 is [3, 5, 25, 1, 3], what is min(list1)?
Answer & Solution
Answer: Option
D
7
What will be the output of the following Python code?
b=[2,3,4,5]
a=list(filter(lambda x:x%2,b))
print(a)
Answer & Solution
Answer: Option
C
8
What will be the output of the following Python code?
points = [[1, 2], [3, 1.5], [0.5, 0.5]]
points.sort()
print(points)
Answer & Solution
Answer: Option
C
9
What will be the output of the following Python code?
def f(values):
values[0] = 44
v = [1, 2, 3]
f(v)
print(v)
Answer & Solution
Answer: Option
C
10
What will be the output of the following Python code?
s="a@b@c@d"
a=list(s.partition("@"))
print(a)
b=list(s.split("@",3))
print(b)
Answer & Solution
Answer: Option
C