On line Test- Tuples and Dictionary

Beschreibung

Quiz am On line Test- Tuples and Dictionary, erstellt von Aparna Dhirde am 18/03/2020.
Aparna Dhirde
Quiz von Aparna Dhirde, aktualisiert more than 1 year ago
Aparna Dhirde
Erstellt von Aparna Dhirde vor mehr als 5 Jahre
112
0
1 2 3 4 5 (0)

Zusammenfassung der Ressource

Frage 1

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

Frage 2

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

Frage 3

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

Frage 4

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

Frage 5

Frage
Elements of tuple is enclosed in square brackets
Antworten
  • True
  • False

Frage 6

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

Frage 7

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

Frage 8

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

Frage 9

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

Frage 10

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

Frage 11

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

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
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 14

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 15

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
Zusammenfassung anzeigen Zusammenfassung ausblenden

0 Kommentare

There are no comments, be the first and leave one below:

ähnlicher Inhalt

Kognitive Lerntheorien
Inés Fernandez
Wahrscheinlichkeit
barbara91
Collocation - Business English - EBC - WU
Geht euch nichts an
Modul 1C - Begriffe
Melanie Najm
Zellzyklus
Nele Ramrath
Deutsch Partizip Perfekt - unregelmäßige Verben
Claus Lenz
INNO Klausur 1
Inno 2015
Vetie - Pathologie Fragen aus dem A-Skript
Fioras Hu
PR-Öffentlichkeitsarbeit Teil1
Tanja Eder