Page 344 - AI Ver 1.0 Class 9
P. 344
S. No Questions Answers
31 What will be the output of the following code? [1, 2] [3, 4] [1, 20]
a,b=[1,2],[3,4]
c=list(a)
c[1]=20
print(a,b,c)
32 What will be the output of the following code? [12, 45.5, [1, 2, 3]]
L1=["abc",12,45.5,[1,2,3]] [‘abc’, 45.5]
print(L1[1:]) 12
print(L1[::2])
print(L1[1:2])
33 What will be the output of the following code? [2, 10, 16, 34, 56]
mrks=[10,2,34,56,16] [56, 34, 16, 10, 2]
mrks.sort()
print(mrks)
mrks.reverse()
print(mrks)
34 What data type is the object below? a
L = [10, 23.5, ‘hello’, True].
a) list b) dictionary
c) array d) tuple
35 Which of the following commands will create a list? d
a) L1 = list()
b) L1 = []
c) L1 = list([1, 2, 3])
d) all of the above
36 print([1,2,3]<[1,2]) False
a) True b) False c) 0 d) 1
37 To add a new element to a list we use which of the following b
command?
a) list1.add("abc")
b) list1.append("abc")
c) list1.sum("abc")
d) list1.addlast("abc")
342 Touchpad Artificial Intelligence-IX

