ExamVeda
Login
Home
51
Is the following Python code valid?
a={3,4,{7,5}}
print(a[2][0])
Discuss
Answer & Solution
Answer: Option C
No explanation is given for this question. Let's Discuss on Board
52
Input order is preserved in sets.
Discuss
Answer & Solution
Answer: Option B
No explanation is given for this question. Let's Discuss on Board
53
What is the purpose of the copy() method for sets?
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board
54
Write a list comprehension for number and its cube for:
l=[1, 2, 3, 4, 5, 6, 7, 8, 9]
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board
55
What is the output of the following code:
set1 = {1, 2}
set2 = {1, 2, 3, 4}
print(set1.issubset(set2))
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board
56
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:
Discuss
Answer & Solution
Answer: Option B
No explanation is given for this question. Let's Discuss on Board
57
What will be the output of the following Python function?
{x for x in 'abc'}
{x*3 for x in 'abc'}
Discuss
Answer & Solution
Answer: Option C
No explanation is given for this question. Let's Discuss on Board
58
What is the syntax of the following Python code?
>>> a=frozenset(set([5,6,7]))
>>> a
Discuss
Answer & Solution
Answer: Option B
No explanation is given for this question. Let's Discuss on Board
59
What method is used to find the elements that are present in either of the sets, but not in both sets?
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board
60
What will be the output of the following Python code?
>>> a={5,4}
>>> b={1,2,4,5}
>>> a<b
Discuss
Answer & Solution
Answer: Option B
No explanation is given for this question. Let's Discuss on Board