1) What is a dictionary in Python? a) A collection of ordered pairs of keys and values b) A type of list c) A collection of functions d) A list of strings 2) How do you define a dictionary in Python? a) d = {} b) d = [] c) d = () d) d = dict() 3) What function is used to add a key-value pair to a dictionary in Python? a) A) append() b) B) insert() c) C) update() d) D) add() 4) Which of the following is a correct way to access the value of a specific key in a Python dictionary? a) A) dict[<key>] b) B) dict.get(<key>) c) C) dict.<key>() d) D) Both A and B 5) Which method is used to get a list of all the values in a Python dictionary? a) A) values() b) B) keys() c) C) items() d) D) lists() 6) What method would you use to retrieve a value for a specific key from a Python dictionary? a) A) get() b) B) find() c) C) extract() d) D) fetch() 7) What will the following code output? a) A) None b) B) 0 c) C) "Not Found" d) D) KeyError 8) Which method would you use to remove a key-value pair from a dictionary in Python? a) A) del b) B) remove() c) C) pop() d) D) Both A and C 9) How can you check if a key exists in a Python dictionary? a) A) key in dictionary b) B) dictionary.has_key(key) c) C) key.exists() d) D) dictionary.check_key(key) 10) What does the keys() method return when called on a dictionary? a) A) A list of values b) B) A list of keys c) C) A dictionary d) D) A tuple of key-value pairs
0%
DICTIONARY
Delen
Delen
Delen
door
Stuti023229
Class 11
python
Inhoud Bewerken
Afdrukken
Embedden
Meer
Toewijzingen
Scorebord
Meer weergeven
Minder weergeven
Dit scoreboard is momenteel privé. Klik op
Delen
om het publiek te maken.
Dit scoreboard is uitgeschakeld door de eigenaar.
Dit scoreboard is uitgeschakeld omdat uw opties anders zijn dan die van de eigenaar.
Opties Herstellen
Gameshow quiz
is een open template. Het genereert geen scores voor een scoreboard.
Inloggen vereist
Visuele stijl
Lettertypen
Abonnement vereist
Opties
Template wisselen
Alles weergeven
Er zullen meer templates verschijnen terwijl je de activiteit gebruikt.
Open resultaten
Kopieer link
QR-code
Verwijderen
Automatisch opgeslagen activiteit "
" herstellen?