Online Test List & Dictionary

Descrição

Quiz sobre Online Test List & Dictionary, criado por Aparna Dhirde em 17-03-2020.
Aparna Dhirde
Quiz por Aparna Dhirde, atualizado more than 1 year ago
Aparna Dhirde
Criado por Aparna Dhirde mais de 4 anos atrás
34
0

Resumo de Recurso

Questão 1

Questão
Keys in dictionary are of mutable type but values can be immutable.
Responda
  • True
  • False

Questão 2

Questão
List is enclosed in square brackets
Responda
  • True
  • False

Questão 3

Questão
Slicing is used to extract a part of the list
Responda
  • True
  • False

Questão 4

Questão
Each key is separated from its value by a colon.
Responda
  • True
  • False

Questão 5

Questão
Keys are unique and act as the index.
Responda
  • True
  • False

Questão 6

Questão
If a is a dictionary with some key-value pairs, what does a.popitem() do?
Responda
  • 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

Questão 7

Questão
What will be the output of the following Python code snippet? >>> a={1:"A",2:"B",3:"C"} >>> del a
Responda
  • 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

Questão 8

Questão
Which of the statements about dictionary values if false?
Responda
  • 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

Questão 9

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

Questão 10

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

Questão 11

Questão
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=" ")
Responda
  • 1 A 2 B 3 C
  • 1 2 3
  • A B C
  • 1:”A” 2:”B” 3:”C”

Questão 12

Questão
Which of these about a dictionary is false?
Responda
  • 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

Questão 13

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

Questão 14

Questão
To add a new element to a list we use which command?
Responda
  • list1.add(5)
  • list1.append(5)
  • list1.addLast(5)
  • list1.addEnd(5)

Questão 15

Questão
Suppose list1 is [2, 33, 222, 14, 25], What is list1[-1]?
Responda
  • error
  • none
  • 25
  • 2

Questão 16

Questão
Suppose list1 is [1, 6, 9], what is sum(list1)?
Responda
  • 1
  • 9
  • 16
  • error

Questão 17

Questão
Suppose list1 is [2445,133,12454,123], what is min(list1)?
Responda
  • 2445
  • 123
  • 133
  • 12454

Questão 18

Questão
Which of the following commands will create a list?
Responda
  • list1 = list()
  • list1 = []
  • list1 = list([1, 2, 3])
  • all of the mentioned

Questão 19

Questão
Suppose list1 is [2, 33, 222, 14, 25], What is list1[:-1]?
Responda
  • [2, 33, 222, 14]
  • Error
  • 25
  • [25, 14, 222, 33, 2]

Questão 20

Questão
What will be the output of the following Python code? >>>"Welcome to Python".split()
Responda
  • [“Welcome”, “to”, “Python”]
  • (“Welcome”, “to”, “Python”)
  • {“Welcome”, “to”, “Python”}
  • “Welcome”, “to”, “Python”

Semelhante

Resumo global da matéria de Biologia do 11.º ano - parte 1
Larissa Guimarães
ATRIBUTOS DE UM LÍDER
willian reis
Temas mais cobrados em Química
Marina Faria
Principais temas para estudar em Biologia
GoConqr suporte .
Regime Jurídico Único - 8.112/90 (QUADRO RESUMO)
Clara Fonseca
Orações Subordinadas
vini_camargo0
Arte do Renascimento Séc.XV - XVI
paulaqueiroz
1000 Frases em inglês
ELVIS GOMES CORREIA
Mapa Mental - Como Criar um Mapa Mental
Adelaide Silva A
Mapas Mentais em Sala de Aula
Alice Sousa
Vestibular - Guia de Estudos
Alessandra S.