Online Test List & Dictionary

Descripción

Test sobre Online Test List & Dictionary, creado por Aparna Dhirde el 17/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
34
0

Resumen del Recurso

Pregunta 1

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

Pregunta 2

Pregunta
List is enclosed in square brackets
Respuesta
  • True
  • False

Pregunta 3

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

Pregunta 4

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

Pregunta 5

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

Pregunta 6

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 7

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 8

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

Pregunta 9

Pregunta
What will be the output of the following Python code snippet? a={1:"A",2:"B",3:"C"} print(a.get(5,4))
Respuesta
  • Error, invalid syntax
  • A
  • 5
  • 4

Pregunta 10

Pregunta
What will be the output of the following Python code snippet? a={1:"A",2:"B",3:"C"} print(a.get(1,4))
Respuesta
  • 1
  • A
  • 4
  • Invalid syntax for get method

Pregunta 11

Pregunta
What will be the output of the following Python code snippet? a={1:"A",2:"B",3:"C"} for i,j in a.items(): print(i,j,end=" ")
Respuesta
  • 1 A 2 B 3 C
  • 1 2 3
  • A B C
  • 1:”A” 2:”B” 3:”C”

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
Suppose list Example is [3, 4, 5, 20, 5, 25, 1, 3], what is list1 after listExample.pop()?
Respuesta
  • [3, 4, 5, 20, 5, 25, 1]
  • [1, 3, 3, 4, 5, 5, 20, 25]
  • [3, 5, 20, 5, 25, 1, 3]
  • [1, 3, 4, 5, 20, 5, 25]

Pregunta 14

Pregunta
To add a new element to a list we use which command?
Respuesta
  • list1.add(5)
  • list1.append(5)
  • list1.addLast(5)
  • list1.addEnd(5)

Pregunta 15

Pregunta
Suppose list1 is [2, 33, 222, 14, 25], What is list1[-1]?
Respuesta
  • error
  • none
  • 25
  • 2

Pregunta 16

Pregunta
Suppose list1 is [1, 6, 9], what is sum(list1)?
Respuesta
  • 1
  • 9
  • 16
  • error

Pregunta 17

Pregunta
Suppose list1 is [2445,133,12454,123], what is min(list1)?
Respuesta
  • 2445
  • 123
  • 133
  • 12454

Pregunta 18

Pregunta
Which of the following commands will create a list?
Respuesta
  • list1 = list()
  • list1 = []
  • list1 = list([1, 2, 3])
  • all of the mentioned

Pregunta 19

Pregunta
Suppose list1 is [2, 33, 222, 14, 25], What is list1[:-1]?
Respuesta
  • [2, 33, 222, 14]
  • Error
  • 25
  • [25, 14, 222, 33, 2]

Pregunta 20

Pregunta
What will be the output of the following Python code? >>>"Welcome to Python".split()
Respuesta
  • [“Welcome”, “to”, “Python”]
  • (“Welcome”, “to”, “Python”)
  • {“Welcome”, “to”, “Python”}
  • “Welcome”, “to”, “Python”
Mostrar resumen completo Ocultar resumen completo

Similar

Filosofía Selectividad - Grandes Filósofos
maya velasquez
Conceptos Básicos de la Física
Diego Santos
PROCESADORES DE TEXTO
rm-asociados
Lecturas para Preparar el First Certificate (I)
maya velasquez
Brainstorming con Mapas Mentales
Diego Santos
LA INGENIERIA Y LOS PROCESOS DE MANUFACTURA
Jorgenoboa
Mi Entorno Personal de Aprendizaje (PLE)
Martín López Barrientos
La Nutrición
Angela Ortiz
Mapa Conceptual - Ajedrez
Adrià Matoses
TEMA 1.2. LA ESPECIALIDAD FUNDAMENTAL TRANSMISIONES, PRESENTE Y FUTURO
antonio del valle
FÓRMULAS Geométricas...
Ulises Yo