21
What will be the output of the following Python code?
>>> s={5,6}
>>> s*3
Answer & Solution
Answer: Option
A
22
In Python, how can you check if two sets have no elements in common?
Answer & Solution
Answer: Option
A
23
What will be the output of the following Python code?
s={4>3, 0, 3-3}
all(s)
any(s)
Answer & Solution
Answer: Option
B
24
What will be the output of the following Python code snippet?
z=set('abc')
z.add('xyz')
z.update(set(['p', 'q']))
z
Answer & Solution
Answer: Option
D
25
What will be the output of the following Python code?
>>> a={5,6,7}
>>> sum(a,5)
Answer & Solution
Answer: Option
B
26
What will be the output of the following Python code?
x=set('abcde')
y=set('xyzbd')
x.difference_update(y)
x
y
Answer & Solution
Answer: Option
B
27
What will be the output of the following Python code?
>>> a={1,2,3}
>>> b=frozenset([3,4,5])
>>> a-b
Answer & Solution
Answer: Option
A
28
What will be the output of the following Python code?
>>> a={1,2,3}
>>> a.intersection_update({2,3,4,5})
>>> a
Answer & Solution
Answer: Option
A
29
In Python, how can you check if two sets have no elements in common?
Answer & Solution
Answer: Option
A
30
What will be the output of the following Python code snippet?
l=[1, 2, 4, 5, 2, 'xy', 4]
set(l)
l
Answer & Solution
Answer: Option
B