On line Test- Tuples and Dictionary

Descripción

Test sobre On line Test- Tuples and Dictionary, creado por Aparna Dhirde el 18/03/2020.
Aparna Dhirde
Test por Aparna Dhirde, actualizado hace más de 1 año
Aparna Dhirde
Creado por Aparna Dhirde hace más de 4 años
110
0

Resumen del Recurso

Pregunta 1

Pregunta
Slicing is used to extract a part of the tuple
Respuesta
  • True
  • False

Pregunta 2

Pregunta
Each key is separated from its value by a colon
Respuesta
  • True
  • False

Pregunta 3

Pregunta
Keys are unique and act as the index
Respuesta
  • True
  • False

Pregunta 4

Pregunta
Keys are of mutable type but values can be immutable
Respuesta
  • True
  • False

Pregunta 5

Pregunta
Elements of tuple is enclosed in square brackets
Respuesta
  • True
  • False

Pregunta 6

Pregunta
What will be the output of the following Python code? >>>t=(1,2,4,3) >>>t[1:-1]
Respuesta
  • (1, 2)
  • (1, 2, 4)
  • (2,4)
  • (2, 4, 3)

Pregunta 7

Pregunta
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)]
Respuesta
  • [2, 3, 9]
  • [1, 2, 4, 3, 8, 9]
  • [1,4,8]
  • (1, 4, 8)

Pregunta 8

Pregunta
What will be the output of the following Python code? >>>t = (1, 2) >>>2 * t
Respuesta
  • [1, 2, 1, 2]
  • (1, 1, 2, 2)
  • [1, 1, 2, 2]
  • (1,2,1,2)

Pregunta 9

Pregunta
What will be the output of the following Python code? >>>t1 = (1, 2, 4, 3) >>>t2 = (1, 2, 3, 4) >>>t1 < t2
Respuesta
  • True
  • False
  • error
  • none

Pregunta 10

Pregunta
Which of the following statements create a dictionary?
Respuesta
  • d = {}
  • d = {“john”:40, “peter”:45}
  • d = {40:”john”, 45:”peter”}
  • All of the above

Pregunta 11

Pregunta
What will be the output of the following Python code snippet? d = {"john":40, "peter":45} "john" in d
Respuesta
  • True
  • False
  • error
  • none

Pregunta 12

Pregunta
Which of these about a dictionary is false?
Respuesta
  • The values of a dictionary can be accessed using keys
  • The keys of a dictionary can be accessed using values
  • Dictionaries aren’t ordered
  • Dictionaries are mutable

Pregunta 13

Pregunta
If a is a dictionary with some key-value pairs, what does a.popitem() do?
Respuesta
  • Removes an arbitrary element
  • Removes all the key-value pairs
  • Removes the key-value pair for the key given as an argument
  • Invalid method for dictionary

Pregunta 14

Pregunta
What will be the output of the following Python code snippet? >>> a={1:"A",2:"B",3:"C"} >>> del a
Respuesta
  • method del doesn’t exist for the dictionary
  • del deletes the values in the dictionary
  • del deletes the entire dictionary
  • del deletes the keys in the dictionary

Pregunta 15

Pregunta
Which of the statements about dictionary values if false?
Respuesta
  • More than one key can have the same value
  • The values of the dictionary can be accessed as dict[key]
  • Values of a dictionary must be unique
  • Values of a dictionary can be a mixture of letters and numbers
Mostrar resumen completo Ocultar resumen completo

Similar

Factorización
Nancy Guzman
CIUDADES I...
JL Cadenas
¿A qué tiempo y modo corresponde?
Remei Gomez Gracia
Gramática Inglés
Diego Santos
PERSONAJES...
JL Cadenas
¿Qué sabes de Roma antígua? - EDUpunto.com
EDUpunto Por: Ernesto De Frías
CONCEPTOS BÁSICOS DE EXCEL
paussh_best11
Inglés
maya velasquez
Diseño experimental
Ahtziri Sequeira
EL CAMINO DE STEVE JOBS
Evelyn Salazar
RECURSOS para PRIMARIA...
Ulises Yo