Vidyalelo
Python · Q69

MCQs for Python Dictionaries: Exam

Programming · Python · question 69

Q69

What will be the output of the following Python code snippet? a=1:"A",2:"B",3:"C" print(a.setdefault(3))

A.
{1: 'A', 2: 'B', 3: 'C'}
B.
C
Answer
C.
{1: 3, 2: 3, 3: 3}
D.
No method called setdefault() exists for dictionary

Answer: Option B

Solution

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