Report Bug

Qus

Is the following Python code valid?

>>> a=frozenset([5,6,7])

>>>

>>> a.add(5)

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


A. Yes, now is a {5,5,6,7}
B. No, frozen set is immutable
C. No, invalid syntax for add method
D. Yes, now a is {5,6,7}


Solution
B. No, frozen set is immutable



Explanation
Since a frozen set is immutable, add method doesn’t exist for frozen method.
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