1. Identify the valid declaration of L:
L = 'Mon', 23, 'hello', 60.5
a) dictionary
b) string
c) tuple
d) list
2. A tuple is declared as
T = (2, 5, 6)
What will be the value of print(T*2)?
3. Write the output of following code:
t1, t2 = 10, 20
t1, t2 = t2, t1
print(t1, t2)
4. Look at the following code:
T1 = (10, 12)
T2 = (14)
What is the type of T1 and T2?
5. Write the two ways to create an empty tuple.
6. Which of the following tuple declaration is/are correct?
a) t = (10, 20, 30)
b) t = 10, 20, 30
c) t = (10)
d) t = [10, 20, 30]
7. Suppose a tuple T is declared as T = (10, 12, 43, 39), which of the following is incorrect?
a) A = T[1]
b) T[2] = -29
c) print(T)
d) print(len(T))
8. A tuple is declared as
T = (20,40,60,80,10)
What will be the value of sum(T)?
9. A tuple is declared as
T = (20, 50, 60, 90, 80)
What will be the value of T.index(90)?
10. Write a statement in Python to declare a tuple T whose elements are Monday, Tuesday and Wednesday.
11. Identify the incorrect definition of tuple?
a) T = (10, 12, 43, 39)
b) T = 10, 12, 43, 39
c) T = (10,)
d) T = (10)
12. A tuple T is declared as
T = (12, 35, 6, 9, 8)
Write a statement to print lowest value of T?
13. Write the output of following code segments.
a = (20, 30, 40)
b = a*2
print(b)
14. Which of the following statements creates a tuple?
a) values = [1, 2, 3, 4]
b) values = {1, 2, 3, 4}
c) values = (1)
d) values = (1,)
15. Write the output of following code
t = 10,4,1,55,3
L = sorted(t)
print(L)