Font size
WorksheetsaXQtMjktMTEtMjAyMg==
Total questions: 10
Worksheet time: 5mins
Ways to create list in python
list1 = list()
list1 = []
list1 = list([1, 2, 3])
list(range(5))
Suppose list1 is [2, 33, 222, 14, 2], What is list1[-1]?
Error
None
25
2
output of the following snippet
hello='world' print(list(hello)[-1])
hello
world
w
d
diffrence between list.append() and list.extends()
both are same
append add single element but extends add another list to the end
there is no extends() method
no diffrence
first_list = [1, 5, 5, 5, 5, 1]
second_list = [1, 2, 3, 4, 5, 6]
print(first_list+second_list)
[1, 5, 5, 5, 5, 1, 1, 2, 3, 4, 5, 6]
[2,7,8,9,10,7]
Error
[0,0,0,0,0,0]
What is the output of the following nested loop
10 Table 20 Chair
20 Table
10 Chair 10 Chair 20 Table 20 Table
10 Chair 10 Table 20 Chair 20 Table
What is the output of the following range() function
for num in range(2,-5,-1): print(num, end=", ")
2, 1, 0
2, 1, 0, -1, -2, -3, -4, -5
2, 1, 0, -1, -2, -3, -4
2, -5, 1
Suppose list1 is [2, 33, 222, 14, 25], What is list1[:-1]?
[2, 33, 222, 14]
Error
25
[25, 14, 222, 33, 2]
What will be the output of the following Python code?
11
12
21
22
Suppose list1 is [1, 3, 2], What is list1 * 2?
[2, 6, 4]
[1, 3, 2, 1, 3]
[1, 3, 2, 1, 3, 2]
[1, 3, 2, 3, 2, 1]
