1
Which of the following data types in Python is mutable and does not allow duplicate elements?
Answer & Solution
Answer: Option
A
2
How can you add an element to a set in Python?
Answer & Solution
Answer: Option
A
3
Which method is used to remove an element from a set?
Answer & Solution
Answer: Option
A
4
What does the len() function do when applied to a set or tuple?
Answer & Solution
Answer: Option
A
5
What is the purpose of the set() constructor in Python?
Answer & Solution
Answer: Option
A
6
What is the purpose of the union() method for sets?
Answer & Solution
Answer: Option
A
7
In Python, how can you check if an element exists in a set?
Answer & Solution
Answer: Option
A
8
What method is used to remove an element from a set without raising an error if the element is not present?
Answer & Solution
Answer: Option
A
9
What is the output of the following code:
my_set = {1, 2, 3}
print(my_set)
Answer & Solution
Answer: Option
A
10
What will be the output of the following code:
my_set = {1, 2, 3}
my_set.add(4)
print(my_set)
Answer & Solution
Answer: Option
B