11. What is the output of the following code:
my_set = {1, 2, 3, 4, 5}
my_set.pop()
print(my_set)
my_set = {1, 2, 3, 4, 5}
my_set.pop()
print(my_set)
12. What is the output of the following code:
my_set = {1, 2, 3}
my_set.remove(2)
print(my_set)
my_set = {1, 2, 3}
my_set.remove(2)
print(my_set)
13. Which method is used to find the intersection of two sets?
14. What is the output of the following code:
set1 = {1, 2, 3}
set2 = {1, 2}
print(set1.issuperset(set2))
set1 = {1, 2, 3}
set2 = {1, 2}
print(set1.issuperset(set2))
15. What will be the output of the following Python code snippet?
a=[1, 4, 3, 5, 2]
b=[3, 1, 5, 2, 4]
a==b
set(a)==set(b)
a=[1, 4, 3, 5, 2]
b=[3, 1, 5, 2, 4]
a==b
set(a)==set(b)
16. What will be the output of the following Python code snippet?
s=set([1, 2, 3])
s.union([4, 5])
s|([4, 5])
s=set([1, 2, 3])
s.union([4, 5])
s|([4, 5])
17. What will be the output of the following Python code?
>>> a={3,4,5}
>>> a.update([1,2,3])
>>> a
>>> a={3,4,5}
>>> a.update([1,2,3])
>>> a
18. What is the purpose of the clear() method for sets?
19. What will be the output of the following Python code?
>>> a={5,6,7,8}
>>> b={7,8,9,10}
>>> len(a+b)
>>> a={5,6,7,8}
>>> b={7,8,9,10}
>>> len(a+b)