NIELIT O Level Exam

<p>What will be the output of the following Python code snippet?</p> <pre><font color="#333333">a={}<br></font><font color="#333333">a['a']=1<br></font><font color="#333333">a['b']=[2,3,4]&nbsp;<br></font><font color="#333333">print(a)</font></pre><div><br></div>

What will be the output of the following Python code snippet?

a={}
a['a']=1
a['b']=[2,3,4] 
print(a)


निम्नलिखित Python कोड स्निपेट का आउटपुट क्या होगा?

a={}
a['a']=1
a['b']=[2,3,4] 
print(a)

A. Exception is thrown एक्सेप्शन फेंक दिया जाता है

B. {‘b’: [2], ‘a’: 1}

C. {‘b’: [2], ‘a’: [3]}

D. {'a': 1, 'b': [2, 3, 4]}




Correct Answer is :

D. {'a': 1, 'b': [2, 3, 4]}



Explanation
Mutable members can be used as the values of the dictionary but they cannot be used as the keys of the dictionary.
Latest Current Affairs 2025 Online Exam Quiz for One day Exam Online Typing Test CCC Online Test Python Programming Tutorials Best Computer Training Institute in Prayagraj (Allahabad) Online MBA 2 years Online MCA Online BCA Best Website and Software Company in Allahabad