NEW
Font size
WorksheetsTEST PAPER-TUPLE
Total questions: 10
Worksheet time: 5mins
What is the output of the following piece of code when executed in Python shell?
a=('Check')*3
('Check','Check','Check')
* Operator not valid for tuples
('CheckCheckCheck')
What is the output of the following
aTuple = (10, 20, 30, 40, 50, 60, 70, 80)
print(aTuple[:4:-1])
(30,40,50)
(20,30,40,50)
(80,70,60)
(80,60,40,30)
Choose the correct way to access value 20 from the following tuple
aTuple = ("abc","Apple",[1,0,3,20])
aTuple[1:2][1]
aTuple[1:2](1)
aTuple[2][3]
aTuple[1][3]
What is the output of the following
aTuple = ("Yellow", 20.4, "Red")
a, b, c = aTuple
len(b)
4
Error
3
predict the output:
t=(20,30,10,23,45,87,11)
sorted(T,reverse=False)
print(t)
Error
(10,11,20,23,30,45,87)
(87,45,30,23,20,11,10)
(20,30,10,23,45,87,11)
Select most suitable code to create a tuple with a single element:
t=('a',)
t=['a']
t=('a')
What will be the output of the following Python code?
t=(1,2,4,3)
t.sorted()
print(t)
(1,2,3,4)
(2,4,3,1)
(4,3,2,1)
(1,2,3,4)
What will be the output of the following Python code?
t1 = (1, 2, 4, 3)
t2 = (1, 2, 3, 4)
t1 ==t2
Error
True
None
False
What will be the output of the following Python code?
my_tuple = (1, 2, 3, 4)
my_tuple+=((5, 6, 7) ,)
print len(my_tuple)
7
5
Error
1
Suppose t = (1, 2, 4, 3), which of the following is incorrect?
print(t.sort())
print(t[3])
print(max(t))
print(len(t))
