MCQs
{ } creates a dictionary not a set. Only set() creates an empty set.
The first function in the code shown above returns the set {1, 2, 3, 4, 5}. This is because the method of the function union allows any iterable. However the second function results in an error because f unsupported data type, that is list and set.
The line: s={san} will result in an error because 'san' is not defined. The line s={abs} does not result in an error because abs is a built-in function. The other sets shown do not result in an error because all the items are hashable.
Every set is a subset of itself and hence the output of this line of code is true.
The method intersection_update returns a set which is an intersection of both the sets.
Values cannot be modified in the case of tuple, that is, tuple is immutable.
Execute in the shell to verify.
A tuple needn't be enclosed in parenthesis.
The above piece of code illustrates the unpacking of variables.
Here ("Check) is a string not a tuple because there is no comma after the element.