Questão 1
Questão
What is the output of the following ?
tuple1 = (1120, 'a')
print(max(tuple1))
Questão 2
Questão
What is the output of the following tuple operation ?
aTuple = (100,)
print(aTuple * 2)
Responda
-
TypeError
-
(100, 100)
-
(200)
Questão 3
Questão
Select true statements regarding the Python tuple
Responda
-
We can remove the item from tuple but we cannot update items of the tuple
-
We cannot delete the tuple
-
We cannot remove the items from the tuple
-
We cannot update items of the tuple.
Questão 4
Questão
What is the output of the following tuple operation ?
aTuple = (100, 200, 300, 400, 500)
aTuple.pop(2)
print(aTuple)
Responda
-
(100, 200, 400, 500)
-
(100, 300, 400, 500)
-
AttributeError
Questão 5
Questão
Select which is true for Python tuple
Responda
-
A tuple maintains the order of items
-
We can change the tuple once created
-
We cannot change the tuple once created
-
A tuple is unordered
Questão 6
Questão
A Python tuple can also be created without using parentheses
Questão 7
Questão
Choose the correct way to access value 20 from the following tuple
aTuple = ("Orange", [10, 20, 30], (5, 15, 25))
Responda
-
aTuple[1:2][1]
-
aTuple[1:2](1)
-
aTuple[1:2][0]
-
aTuple[1][1]
Questão 8
Questão
What is the output of the following code ?
aTuple = (100, 200, 300, 400, 500)
aTuple[1] = 800
print(aTuple)
Responda
-
TypeError
-
(100, 800, 200, 300, 400, 500)
-
(800, 100, 200, 300, 400, 500)
Questão 9
Questão
What is the output of the following ?
aTuple = (10, 20, 30, 40, 50, 60, 70, 80)
print(aTuple[2:5], aTuple[:4], aTuple[3:])
Responda
-
(30, 40, 50) (10, 20, 30, 40) (40, 50, 60, 70, 80)
-
(20, 30, 40, 50) (10, 20, 30, 40) (30, 40, 50, 60, 70, 80)
-
(30, 40, 50) (10, 20, 30, 40) (40, 50, 60, 70)
-
(30, 40, 50) (10, 20, 30) (40, 50, 60, 70, 80)
Questão 10
Questão
What is the type of the following variable ?
aTuple = ("Orange")
print(type(aTuple))
Questão 11
Questão
What is the output of the following code ?
aTuple = (100, 200, 300, 400, 500)
print(aTuple[-2])
print(aTuple[-4:-1])
Questão 12
Questão
What is the output of the following ?
aTuple = "Yellow", 20, "Red"
a, b, c = aTuple
print(a)
Responda
-
(‘Yellow’, 20, ‘Red’)
-
TyepeError
-
Yellow