Tuples
1.
Which of the following is a Python tuple?
2.
Suppose t = (1, 2, 4, 3), which of the following is incorrect?
3.
What will be the output of the following Python code?
>>>t=(1,2,4,3)
>>>t[1:3]
4.
What will be the output of the following Python code?
>>>t=(1,2,4,3)
>>>t[1:-1]
5.
What will be the output of the following Python code?
>>>t = (1, 2, 4, 3, 8, 9)
>>>[t[i] for i in range(0, len(t), 2)]
6.
What will be the output of the following Python code?
d = {"john":40, "peter":45}
d["john"]
7.
What will be the output of the following Python code?
>>>t = (1, 2)
>>>2 * t
8.
What will be the output of the following Python code?
>>>t1 = (1, 2, 4, 3)
>>>t2 = (1, 2, 3, 4)
>>>t1 < t2
9.
What will be the output of the following Python code?
>>>my_tuple = (1, 2, 3, 4)
>>>my_tuple.append( (5, 6, 7) )
>>>print len(my_tuple)
10.
What will be the output of the following Python code?
>>>my_tuple = (1, 2, 3, 4)
>>>my_tuple.append( (5, 6, 7) )
>>>print len(my_tuple)