Test
Online Test List & Dictionary
Este test tiene tiempo límite, así que se abre en el reproductor de siempre.
Preguntas del test (20)
1Keys in dictionary are of mutable type but values can be immutable.
- AVerdadero
- BFalso
2List is enclosed in square brackets
- AVerdadero
- BFalso
3Slicing is used to extract a part of the list
- AVerdadero
- BFalso
4Each key is separated from its value by a colon.
- AVerdadero
- BFalso
5Keys are unique and act as the index.
- AVerdadero
- BFalso
6If a is a dictionary with some key-value pairs, what does a.popitem() do?
- ARemoves an arbitrary element
- BRemoves all the key-value pairs
- CRemoves the key-value pair for the key given as an argument
- DInvalid method for dictionary
7What will be the output of the following Python code snippet?
>>> a={1:"A",2:"B",3:"C"}
>>> del a- Amethod del doesn’t exist for the dictionary
- Bdel deletes the values in the dictionary
- Cdel deletes the entire dictionary
- Ddel deletes the keys in the dictionary
8Which of the statements about dictionary values if false?
- AMore than one key can have the same value
- BThe values of the dictionary can be accessed as dict[key]
- CValues of a dictionary must be unique
- DValues of a dictionary can be a mixture of letters and numbers
9What will be the output of the following Python code snippet?
a={1:"A",2:"B",3:"C"}
print(a.get(5,4))- AError, invalid syntax
- BA
- C5
- D4
10What will be the output of the following Python code snippet?
a={1:"A",2:"B",3:"C"}
print(a.get(1,4))- A1
- BA
- C4
- DInvalid syntax for get method
11What 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=" ")- A1 A 2 B 3 C
- B1 2 3
- CA B C
- D1:”A” 2:”B” 3:”C”
12Which of these about a dictionary is false?
- AThe values of a dictionary can be accessed using keys
- BThe keys of a dictionary can be accessed using values
- CDictionaries aren’t ordered
- DDictionaries are mutable
13Suppose list Example is [3, 4, 5, 20, 5, 25, 1, 3], what is list1 after listExample.pop()?
- A[3, 4, 5, 20, 5, 25, 1]
- B[1, 3, 3, 4, 5, 5, 20, 25]
- C[3, 5, 20, 5, 25, 1, 3]
- D[1, 3, 4, 5, 20, 5, 25]
14To add a new element to a list we use which command?
- Alist1.add(5)
- Blist1.append(5)
- Clist1.addLast(5)
- Dlist1.addEnd(5)
15Suppose list1 is [2, 33, 222, 14, 25], What is list1[-1]?
- Aerror
- Bnone
- C25
- D2
16Suppose list1 is [1, 6, 9], what is sum(list1)?
- A1
- B9
- C16
- Derror
17Suppose list1 is [2445,133,12454,123], what is min(list1)?
- A2445
- B123
- C133
- D12454
18Which of the following commands will create a list?
- Alist1 = list()
- Blist1 = []
- Clist1 = list([1, 2, 3])
- Dall of the mentioned
19Suppose list1 is [2, 33, 222, 14, 25], What is list1[:-1]?
- A[2, 33, 222, 14]
- BError
- C25
- D[25, 14, 222, 33, 2]
20What will be the output of the following Python code?
>>>"Welcome to Python".split()- A[“Welcome”, “to”, “Python”]
- B(“Welcome”, “to”, “Python”)
- C{“Welcome”, “to”, “Python”}
- D“Welcome”, “to”, “Python”
Información
- Descripción
- Test sobre Online Test List & Dictionary, creado por Aparna Dhirde el 17/03/2020.
- Autor
- Aparna Dhirde
- Idioma
- English
- Visitas
- 39
- Etiquetas
- Valoración
- Aún sin valoraciones Valora este test