Question: 6 -
What will be the output of below Python code?list1=["tom","mary","simon"]
list1.insert(5,8)
print(list1)
-
Error
-
["tom", "mary", "simon", 8]
-
["tom", "mary", "simon", 5]
-
[8, "tom", "mary", "simon"]
Answer:
["tom", "mary", "simon", 8]
Solution not available.
Question: 7 -
What will be the output of following Python code?list1=["Python","Java","c","C","C++"]
print(min(list1))
-
C++
-
c
-
C
-
min function cannot be used on string elements
Answer:
C
Solution not available.
Question: 8 -
What will be the result after the execution of above Python code?list1=[3,2,5,7,3,6]
list1.pop(3)
print(list1)
-
[2,5,7,3,6]
-
[2,5,7,6]
-
[3,2,5,3,6]
-
[3,2,5,7,3,6]
Answer:
[3,2,5,3,6]
Solution not available.
Question: 9 -
The elements of a list are arranged in descending order. Which of the following two will give same outputs?
i. print(list_name.sort())
ii. print(max(list_name))
iii. print(list_name.reverse())
iv. print(list_name[-1])
-
iii, iv
-
i, iii
-
i, ii
-
ii, iii
Answer:
i, iii
Solution not available.
Question: 10 -
What will be the output of below Python code?list1=[1,3,5,2,4,6,2]
list1.remove(2)
print(sum(list1))
-
20
-
19
-
18
-
21
Answer:
21