Test
Tuples in Python
Este test tiene tiempo límite, así que se abre en el reproductor de siempre.
Preguntas del test (12)
1What is the output of the following ?
tuple1 = (1120, 'a')
print(max(tuple1))- ATypeError
- B1120
- C‘a’
2What is the output of the following tuple operation ?
aTuple = (100,)
print(aTuple * 2)- ATypeError
- B(100, 100)
- C(200)
3Select true statements regarding the Python tuple
- AWe can remove the item from tuple but we cannot update items of the tuple
- BWe cannot delete the tuple
- CWe cannot remove the items from the tuple
- DWe cannot update items of the tuple.
4What is the output of the following tuple operation ?
aTuple = (100, 200, 300, 400, 500)
aTuple.pop(2)
print(aTuple)- A(100, 200, 400, 500)
- B(100, 300, 400, 500)
- CAttributeError
5Select which is true for Python tuple
- AA tuple maintains the order of items
- BWe can change the tuple once created
- CWe cannot change the tuple once created
- DA tuple is unordered
6A Python tuple can also be created without using parentheses
- AVerdadero
- BFalso
7Choose the correct way to access value 20 from the following tuple
aTuple = ("Orange", [10, 20, 30], (5, 15, 25))- AaTuple[1:2][1]
- BaTuple[1:2](1)
- CaTuple[1:2][0]
- DaTuple[1][1]
8What is the output of the following code ?
aTuple = (100, 200, 300, 400, 500)
aTuple[1] = 800
print(aTuple)- ATypeError
- B(100, 800, 200, 300, 400, 500)
- C(800, 100, 200, 300, 400, 500)
9What is the output of the following ?
aTuple = (10, 20, 30, 40, 50, 60, 70, 80)
print(aTuple[2:5], aTuple[:4], aTuple[3:])- A(30, 40, 50) (10, 20, 30, 40) (40, 50, 60, 70, 80)
- B(20, 30, 40, 50) (10, 20, 30, 40) (30, 40, 50, 60, 70, 80)
- C(30, 40, 50) (10, 20, 30, 40) (40, 50, 60, 70)
- D(30, 40, 50) (10, 20, 30) (40, 50, 60, 70, 80)
10What is the type of the following variable ?
aTuple = ("Orange")
print(type(aTuple))- Alist
- Btuple
- Carray
- Dstr
11What is the output of the following code ?
aTuple = (100, 200, 300, 400, 500)
print(aTuple[-2])
print(aTuple[-4:-1])- A400
(200, 300, 400) - BIndexError: tuple index out of range
- C400
(200, 300)
- A400
12What is the output of the following ?
aTuple = "Yellow", 20, "Red"
a, b, c = aTuple
print(a)- A(‘Yellow’, 20, ‘Red’)
- BTyepeError
- CYellow
Información
- Descripción
- Coding Python Test sobre Tuples in Python, creado por PathaPadha Support el 27/10/2020.
- Autor
- PathaPadha Support
- Idioma
- English
- Visitas
- 405
- Etiquetas
- Valoración
- Aún sin valoraciones Valora este test