Question 1 of 25
Hints left: 3
Q1
Which method is used to find the symmetric difference between two sets?
Q2
What will be the output of the following Python code? >>> a={3,4,5} >>> b={5,6,7} >>> a|b
Q3
Set makes use of . . . . . . . . Dictionary makes use of . . . . . . . .
Q4
What will be the output of the following Python code? s1={1, 2, 3} s2={3, 4, 5, 6} s1.difference(s2) s2.difference(s1)
-
A
-
B
-
C
-
D
Q5
Which of the following data types in Python is used to store key-value pairs?
Q6
What will be the output of the following Python code? >>> a={4,5,6} >>> b={2,8,6} >>> a-b
Q7
What will be the output of the following Python code? nums = set([1,1,2,3,3,3,4,4]) print(len(nums))
Q8
What does the len() function do when applied to a dictionary?
Q9
What will be the output of the following Python code snippet? for x in set('pqr'): print(x*2)
Q10
What will be the output of the following Python code? s={1, 2, 3} s.update(4) s
Q11
Which of the following functions will return the symmetric difference between two sets, x and y?
Q12
Is the following Python code valid? a={1,2,3} b={1,2,3,4} c=a.issuperset(b) print(c)
Q13
What will be the output of the following Python code? a = [5,5,6,7,7,7] b = set(a) def test(lst): if lst in b: return 1 else: return 0 for i in filter(test, a): print(i,end=" ")
Q14
Set members must not be hashable.
Q15
What will be the output of the following Python code? >>> a={1,2,3} >>> b=a.add(4) >>> b
Q16
The output of the following code is: class<'set'>. type({})
Q17
What is the output of the following code: set1 = {1, 2, 3} set2 = {3, 4, 5} print(set1.union(set2))
-
A
-
B
-
C
-
D
Q18
What will be the output of the following Python code? s={2, 5, 6, 6, 7} s
Q19
Which of the following statements is used to create an empty set?
Q20
If a={5,6,7}, what happens when a.add(5) is executed?
Q21
What will be the output of the following code: set1 = {1, 2, 3} set2 = {3, 4, 5} print(set1.intersection(set2))
Q22
What will be the output of the following Python code? a={1,2,3} b={1,2,3} c=a.issubset(b) print(c)
Q23
What method is used to check if a key exists in a dictionary, and if not, add it with a default value?
Q24
What will be the output of the following Python code? >>> a={5,6,7,8} >>> b={7,8,10,11} >>> a^b
Q25
In Python, how can you create an empty set?