11. The ____________ function removes the first element of a set and the last element of a list.
Correct Answer is : pop
12. The difference between the functions discard and remove is that:
Correct Answer is : Remove throws an error if the specified element is not present in the set whereas discard does not throw an error in case of absence of the specified element
13. What is the output of the code shown below?
s1={1, 2, 3}
s2={3, 4, 5, 6}
s1.difference(s2)
s2.difference(s1)
Correct Answer is : {1, 2}
14. What is the output of the following code?
s1={1, 2, 3}
s2={4, 5, 6}
s1.isdisjoint(s2)
s2.isdisjoint(s1)
Correct Answer is : TRUE
15. If we have two sets, s1 and s2, and we want to check if all the elements of s1 are present in s2 or not, we can use the function:
Correct Answer is : s2.issuperset(s1)
16. What is the output of this code?
s1={1, 2, 3, 8}
s2={3, 4, 5, 6}
s1|s2
s1.union(s2)
Correct Answer is : {1, 2, 3, 4, 5, 6, 8}
17. What is the output of the code shown below?
a=set('abc')
b=set('def')
b.intersection_update(a)
a
b
Correct Answer is : {‘b’, ‘c’, ‘a’}
18. What is the output of the line of code shown below, if s1= {1, 2, 3}?
s1.issubset(s1)
Correct Answer is : TRUE
19. What is the output of the snippet of code shown below?
x=set('abcde')
y=set('xyzbd')
x.difference_update(y)
x
y
Correct Answer is : {‘a’, ‘c’, ‘e’}
20. Which type of copy is shown in this code?
l1=[[10, 20], [30, 40], [50, 60]]
ls=list(l1)
ls
[[10, 20], [30, 40], [50, 60]]