NIELIT O Level Exam

<p>Is the following Python code valid?</p><pre><span style="font-size: 14px;">a={3,4,{7,5}}<br></span><span style="font-size: 14px;">print(a[2][0])</span></pre>

Is the following Python code valid?

a={3,4,{7,5}}
print(a[2][0])


निम्नलिखित Python कोड वैलिड है?

a={3,4,{7,5}}
print(a[2][0])

A. Yes, 7 is printed हां, 7 प्रिंट है

B. Error, elements of a set can’t be printed एरर,एक सेट के एलिमेंट्स को प्रिंट नहीं किया जा सकता है

C. Error, subsets aren’t allowed एरर,सबसेट की अनुमति नहीं है

D. Yes, {7,5} is printed हां, {7,5} प्रिंटेड है




Correct Answer is :

C. Error, subsets aren’t allowed



Explanation
In python, elements of a set must not be mutable and sets are mutable. Thus, subsets can’t exist.
CCC Online Test Python Programming Tutorials Best Computer Training Institute in Prayagraj (Allahabad) Online Exam Quiz O Level NIELIT Study material and Quiz Bank SSC Railway TET UPTET Question Bank career counselling in allahabad Best Website and Software Company in Allahabad Website development Company in Allahabad