Vidyalelo
Python · Q29

MCQs for Python Dictionaries: Exam

Programming · Python · question 29

Q29

What will be the output of the following code:keys = ['a', 'b', 'c']values = 0my_dict = dict.fromkeys(keys, values)print(my_dict)

A.
{'a': 0, 'b': 0, 'c': 0}
Answer
B.
{'a': [0], 'b': [0], 'c': [0]}
C.
{0: ['a', 'b', 'c']}
D.
{'a': 'b', 'b': 'c', 'c': 0}

Answer: Option A

Solution

Answer: Option A
No explanation is given for this question Let's Discuss on Board