Online Test List & Dictionary

Beschreibung

Quiz am Online Test List & Dictionary, erstellt von Aparna Dhirde am 17/03/2020.
Aparna Dhirde
Quiz von Aparna Dhirde, aktualisiert more than 1 year ago
Aparna Dhirde
Erstellt von Aparna Dhirde vor mehr als 4 Jahre
34
0

Zusammenfassung der Ressource

Frage 1

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

Frage 2

Frage
List is enclosed in square brackets
Antworten
  • True
  • False

Frage 3

Frage
Slicing is used to extract a part of the list
Antworten
  • True
  • False

Frage 4

Frage
Each key is separated from its value by a colon.
Antworten
  • True
  • False

Frage 5

Frage
Keys are unique and act as the index.
Antworten
  • True
  • False

Frage 6

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

Frage 7

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

Frage 8

Frage
Which of the statements about dictionary values if false?
Antworten
  • 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

Frage 9

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

Frage 10

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

Frage 11

Frage
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=" ")
Antworten
  • 1 A 2 B 3 C
  • 1 2 3
  • A B C
  • 1:”A” 2:”B” 3:”C”

Frage 12

Frage
Which of these about a dictionary is false?
Antworten
  • 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

Frage 13

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

Frage 14

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

Frage 15

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

Frage 16

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

Frage 17

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

Frage 18

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

Frage 19

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

Frage 20

Frage
What will be the output of the following Python code? >>>"Welcome to Python".split()
Antworten
  • [“Welcome”, “to”, “Python”]
  • (“Welcome”, “to”, “Python”)
  • {“Welcome”, “to”, “Python”}
  • “Welcome”, “to”, “Python”
Zusammenfassung anzeigen Zusammenfassung ausblenden

ähnlicher Inhalt

Die Verwandlung von Franz Kafka
AntonS
BWL-Theorie: Bücher der Buchhaltung
Julian 1108
Phyikum (Biologie/ Biochemie)
anna.grillborzer0656
Faust: Die Gretchen-Tragödie
barbara91
2 C Entwicklungspsychologie März 2012
petra.drewitz
Globalization – global challenges
ExamTime Bewerter
Differenzialrechnung (Analysis) Zusammenfassung
Antonia C
Fend - 4 Funktionen von Schule
Josephine .
WIRK - 2.0
stelly Welly
Vetie - Milch 2017
Kim Langner