WorksheetsTuples
Total questions: 12
Worksheet time: 12mins
Choose the correct about Tuples
Collection of items which are ordered
tuples cannot be changed
tuples uses square brackets
values of tuples can be accessed by indexing
Choose the correct syntax of Tuple
tuple=[200,50]
tuple=(200,50)
tuple={200,50}
How to get the index of any value of tuple
tuple.index(value)
tuple.index[value]
tuple1=(5,25,15,10,30)
print(max(tuple1))
What is printed in console?
(a)
tuple2=('p','s','r','d','b')
print(max(tuple2))
(a)
tuple1=(5,25,15,10,30, 'abc', 'pqr',2010)
print(max(tuple1))
Type error: max and min are not supported between instances of integer and string
2010, pqr
2010
pqr
True about max and min of tuples
can be applied with tuples having only integers or only alphabets
cannot be applied with tuples having only integers or only alphabets
cannot be applied to the mixed datatypes values in a tuple
tuple1 = (1,5,7,3,8)
tuple2=('c', 'w', 'f', 'q', 't')
tuple3=(1,2,3,4, 'c','g', 'u', 2010, "apple")
max() for above tuple gives?
max(tuple1) returns 8
max(tuple2) returns t
max(tuple3) returns TypeError, as it contains mixed datatype
Choose odd one out
Array
Tuple
List
tuple3=(1,2,3,4, 'c','g', 'u', 2010, "apple")
print(tuple3.index(4)) returns?
3
4
c
none
tuple2=('c', 'w', 'f', 'q', 't')
print(tuple2.index('w'))
Datatype of the output will be in?
string
integer
tuple2=('d', 'w', 'c', 'f', 'q', 'yellow','t')
min(tuple2) returns c
max(tuple2) returns yellow
max(tuple2) returns t
min(tuple2) returns d
