What type of error is shown by following statement? >>>t1 =(1, 2) >>>t2
1. ValueError
2.TypeError
3.NameError
4.None of the above
Which of the following is/are features of tuple?
1.Tuple is immutable
2.Tuple is a sequence data type
3.In tuple, elements are enclosed in Parenthesis.
4.All the above
Which of the following statement will create an empty tuple?
1.P = ( ) b.
2.Q = tuple( )
3.Both of the above
4.None of the above
Write the output of the following. >>> t1=((1,2),(3,4),(9,)) >>>max(t1)
1.9
2.(9,)
3.(3,4)
4.None of the above
Write the output of the following: a=(1, 2, 3, 2, 3, 4, 5) print(min(a) + max(a) + a.count(2))
1.13
2.6
3.8
4.Error
Write the output of the following: t1 = (23, 45, 67, 43, 21, 41) print(t1[1:2])
1. (45)
2.(45,)
3.(45, 67)
4.None of the above
>>>min(t1) will return an error if the tuple t1 contains value of mixed data type.
1.True
2.False
3.Error
4.None of the above
In tuples values are enclosed in __________________
1.a. Square brackets
2.Curly brackets
3.Parenthesis
4.None of the above
Tuples are __________________
1.Mutable
2.Immutable
3.Mutable to some extent
4.None of the above
What is the length of the given tuple? >>> t1=(1,2,(3,4,5)
1.1
2.2
3.3
4.4
Which function returns the length of tuple?
1.a. length( )
2.len( )
3.size( )
4.None of the above
Which mathematical operator is used to replicate a tuple?
1. Addition
2.Multiplication
3.Exponent
4.Modulus
Which of the following function return the frequency of particular element in tuple?
1.index( )
2. max( )
3.count( )
4.None of the above
Which of the following function return the frequency of particular element in tuple?
1.index( )
2. max( )
3.count( )
4.None of the above
Which of the following function return the frequency of particular element in tuple?
1.index( )
2. max( )
3.count( )
4.None of the above
Which of the following is a tuple with single element?
1.t = (1,)
2. t = 1,
3.Both of the above
4.None of the above
Which of the following is not a function of tuple?
1.update( )
2.min( )
3.max( )
4.count( )
Which of the following statement will return an error. T1 is a tuple.
1.T1 + (23)
2. T1 + [3]
3.Both of the above
4.None of the above
Write the output of the following : >>>t1 = (1,2) >>> t2 = (1.0, 2.0) >>> t1 == t2
1.True
2.False
3.Error
4.None of the above
Write the output of the following : >>>t1 = (1,2) >>> t2 = (2,1) >>> t1 == t2
1.True
2.False
3.Error
4.None of the above
Write the output of the following : a=("Amit", "Sumit","Ashish","Sumanta") for i in a: print(len(i)**2)
1.0 1 4 9
2.16 25 36 49
3.Error
4.1 4 9 16
Write the output of the following. a=(23,34,65,20,5) print(a[0]+a.index(5))
1.28
2.29
3.27
4.26
Write the output of the following: >>>t1 = (1,2,3,4,5) >>>t2=t1 >>>t2
1.Error
2.(1,2,3,4,5)
3.1,2,3,4,5
4.[1,2,3,4,5]
Write the output of the following: a=(23,34,65,20,5) s=0 for i in a: if i%2==0: s=s+a[i] print(s)
1.54
2.93
3.94
4.Error
Write the output of the following: a=(6,8,9,"Sumanta",1) for i in a: print(str(i)*2)
1.66 88 99 SumantaSumanta 11
2.66 88 99 Error
3.Error
4.66 88 99 SumantaSumanta Error