MCQ Answer

<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])
Topic : Sequence data types in python

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 2021 CCC Practice Test Hindi Python Programming Tutorials Best Computer Training Institute in Prayagraj (Allahabad) Best Java Training Institute in Prayagraj (Allahabad) Best Python Training Institute in Prayagraj (Allahabad) O Level Online Test in Hindi Bank SSC Railway TET UPTET Question Bank career counselling in allahabad Sarkari Naukari Notification Best Website and Software Company in Allahabad Sarkari Exam Quiz