Question: 6 -
What will be the output of below Python code?tupl=()
tupl1=tupl*2
print(len(tupl1))
-
Error as tuple object has no attribute to len
-
2
-
0
-
1
Answer:
0
Solution not available.
Question: 7 -
Which of the following two Python codes will give same output?
(i) print(tupl[:-1])
(ii) print(tupl[0:5])
(iii) print(tupl[0:4])
(iv) print(tupl[-4:])If tupl=(5,3,1,9,0)
-
ii, iv
-
i, ii
-
i, iv
-
i, iii
Answer:
i, iii
Solution not available.
Question: 8 -
What will be the output of below Python code?tupl=("annie","hena","sid")
print(tupl[-3:0])
-
None
-
("annie")
-
()
-
Error as slicing is not possible in tuple.
Answer:
()
Solution not available.
Question: 9 -
What will be the output of below Python code?tupl=([2,3],"abc",0,9)
tupl[0][1]=1
print(tupl)
-
([2,1],"abc",0,9)
-
([2,3],"abc",0,9)
-
Error
-
([1,3],"abc",0,9)
Answer:
([2,1],"abc",0,9)
Solution not available.
Question: 10 -
Which of the following options will not result in an error when performed on tuples in Python where tupl=(5,2,7,0,3)?
-
tupl.append(2)
-
tupl.sort()
-
tupl1=tupl+tupl
-
tupl[1]=2
Answer:
tupl1=tupl+tupl