ExamVeda
Login
Home
21
What will be the output of the following code:
my_list = [1, 2, 3]
my_list[1] = 4
print(my_list)
Discuss
Answer & Solution
Answer: Option B
No explanation is given for this question. Let's Discuss on Board
22
What is the output of the following code:
my_list = [1, 2, 3, 4, 5]
print(my_list[1:4])
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board
23
What is the output of the following code:
my_list = [1, 2, 3]
my_list.append(4)
print(my_list)
Discuss
Answer & Solution
Answer: Option C
No explanation is given for this question. Let's Discuss on Board
24
What is the output of the following code:
my_list = [1, 2, 3, 4]
my_list.remove(2)
print(my_list)
Discuss
Answer & Solution
Answer: Option B
No explanation is given for this question. Let's Discuss on Board
25
What will the following code output:
my_list = [1, 2, 3]
new_list = my_list.copy()
print(new_list)
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board
26
What is the output of the following code:
my_list = [1, 2, 3]
del my_list[1]
print(my_list)
Discuss
Answer & Solution
Answer: Option B
No explanation is given for this question. Let's Discuss on Board
27
Which method is used to sort the elements of a list in ascending order?
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board
28
What is the purpose of the reverse() method for lists?
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board
29
What will be the output of the following code:
my_list = [1, 2, 3]
my_list.reverse()
print(my_list)
Discuss
Answer & Solution
Answer: Option B
No explanation is given for this question. Let's Discuss on Board
30
What is the output of the following code:
my_list = [1, 2, 3, 4]
my_list.pop()
print(my_list)
Discuss
Answer & Solution
Answer: Option B
No explanation is given for this question. Let's Discuss on Board