Vidyalelo
Python · Q32

Python Sets MCQs: Exam

Programming · Python · question 32

Q32

Is the following Python code valid? >>> a=frozenset([5,6,7]) >>> a >>> a.add(5)

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

Answer: Option B

Solution

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