NIELIT M3-R5 Python MCQ for O Level Exam

NIELIT M3-R5 Python MCQ for O Level Exam

451.What will be the output of the following Python code?
निम्नलिखित पायथन कोड का आउटपुट क्या होगा?
>>> a={5,6,7,8}
>>> b={7,5,6,8}
>>> a==b
A) True ✔️
B) False

452.What will be the output of the following Python code?
निम्नलिखित पायथन कोड का आउटपुट क्या होगा?
>>> a={3,4,5}
>>> b={5,6,7}
>>> a|b
A) Invalid operation
B) {3, 4, 5, 6, 7} ✔️
C) {5}
D) {3,4,6,7}

453.Is the following Python code valid?
निम्नलिखित पायथन कोड मान्य है?
a={3,4,{7,5}}
print(a[2][0])
A) Yes, 7 is printed
B) Error, elements of a set can’t be printed
C) Error, subsets aren’t allowed ✔️
D) Yes, {7,5} is printed

454.Which of these about a frozenset is not true?
फ्रोजेनसेट के बारे में इनमें से कौन सा सच नहीं है?
A) Mutable data type ✔️
B) Allows duplicate values
C) Data type with unordered values
D) Immutable data type

455.What is the syntax of the following Python code?
निम्नलिखित पायथन कोड का सिंटैक्स क्या है?
>>> a=frozenset(set([5,6,7]))
>>> a
A) {5,6,7}
B) frozenset({5,6,7}) ✔️
C) Error, not possible to convert set into frozenset
D) Syntax error

456.Is the following Python code valid?
निम्नलिखित पायथन कोड मान्य है?
>>> a=frozenset([5,6,7])
>>> a
>>> a.add(5)
A) Yes, now a is {5,5,6,7}
B) No, frozen set is immutable ✔️
C) No, invalid syntax for add method
D) Yes, now a is {5,6,7}

457.Set members must not be hashable.
सेट सदस्यों को हैशेबल नहीं होना चाहिए।
A) True
B) False ✔️

458.What will be the output of the following Python code?
निम्नलिखित पायथन कोड का आउटपुट क्या होगा?
>>> a={3,4,5}
>>> a.update([1,2,3])
>>> a
A) Error, no method called update for set data type
B) {1, 2, 3, 4, 5} ✔️
C) Error, list can’t be added to set
D) Error, duplicate item present in list

459.What will be the output of the following Python code?
निम्नलिखित पायथन कोड का आउटपुट क्या होगा?
>>> a={1,2,3}
>>> a.intersection_update({2,3,4,5})
>>> a

A) {2,3} ✔️
B) Error, duplicate item present in list
C) Error, no method called intersection_update for set data type
D) {1,4,5}

460.What will be the output of the following Python code?
निम्नलिखित पायथन कोड का आउटपुट क्या होगा?
>>> a={1,2,3}
>>> b=a
>>> b.remove(3)
>>> a
A) {1,2,3}
B) Error, copying of sets isn’t allowed
C) {1,2} ✔️
D) Error, invalid syntax for remove

461.What will be the output of the following Python code?
निम्नलिखित पायथन कोड का आउटपुट क्या होगा?
>>> a={1,2,3}
>>> b=a.copy()
>>> b.add(4)
>>> a

A) {1,2,3} ✔️
B) Error, invalid syntax for add
C) {1,2,3,4}
D) Error, copying of sets isn’t allowed

462.What will be the output of the following Python code?
निम्नलिखित पायथन कोड का आउटपुट क्या होगा?
>>> a={1,2,3}
>>> b=a.add(4)
>>> b
A) 0
B) {1,2,3,4}
C) {1,2,3}
D) Nothing is printed ✔️

463.What will be the output of the following Python code?
निम्नलिखित पायथन कोड का आउटपुट क्या होगा?
>>> a={1,2,3}
>>> b=frozenset([3,4,5])
>>> a-b

A) {1,2} ✔️
B) Error as difference between a set and frozenset can’t be found out
C) Error as unsupported operand type for set data type
D) frozenset({1,2})

464.What will be the output of the following Python code?
निम्नलिखित पायथन कोड का आउटपुट क्या होगा?
>>> a={5,6,7}
>>> sum(a,5)
A) 5
B) 23 ✔️
C) 18
D) Invalid syntax for sum method, too many arguments

465.What will be the output of the following Python code?
निम्नलिखित पायथन कोड का आउटपुट क्या होगा?
>>> a={1,2,3}
>>> {x*2 for x in a|{4,5}}
A) {2,4,6}
B) Error, set comprehensions aren’t allowed
C) {8, 2, 10, 4, 6} ✔️
D) {8,10}

466.What will be the output of the following Python code?
निम्नलिखित पायथन कोड का आउटपुट क्या होगा?
>>> a=(2,3,1,5)
>>> a.sort()
>>> a
A) (1,2,3,5)
B) (2,3,1,5)
C) None
D) Error, tuple has no attribute sort ✔️

467.Is the following Python code valid?
निम्नलिखित पायथन कोड मान्य है?
>>> a=(1,2,3)
>>> b=a.update(4,)
A) Yes, a=(1,2,3,4) and b=(1,2,3,4)
B) Yes, a=(1,2,3) and b=(1,2,3,4)
C) No because tuples are immutable ✔️
D) No because wrong syntax for update() method

468.What will be the output of the following Python code?
निम्नलिखित पायथन कोड का आउटपुट क्या होगा?
>>> a=[(2,4),(1,2),(3,9)]
>>> a.sort()
>>> a
A) [(1, 2), (2, 4), (3, 9)] ✔️
B) [(2,4),(1,2),(3,9)]
C) Error because tuples are immutable
D) Error, tuple has no sort attribute

469.Which of these about a set is not true?
इनमें से कौन सा एक सेट के बारे में सच नहीं है?
A) Mutable data type
B) Allows duplicate values
C) Data type with unordered values
D) Immutable data type ✔️

470.Which of the following is not the correct syntax for creating a set?
सेट बनाने के लिए निम्नलिखित में से कौन सा वाक्यविन्यास सही नहीं है?
A) set([[1,2],[3,4]]) ✔️
B) set([1,2,2,3,4])
C) set((1,2,3,4))
D) {1,2,3,4}

471.What will be the output of the following Python code?
निम्नलिखित पायथन कोड का आउटपुट क्या होगा?
nums = set([1,1,2,3,3,3,4,4])
print(len(nums))
A) 7
B) Error, invalid syntax for formation of set
C) 4 ✔️
D) 8

472.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=” “)
A) 5 5 6
B) 5 6 7
C) 5 5 6 7 7 7 ✔️
D) 5 6 7 7 7

473.Which of the following statements is used to create an empty set?
निम्नलिखित में से कौन सा कथन एक खाली सेट बनाने के लिए उपयोग किया जाता है?
A) { }
B) set()✔️
C) [ ]
D) ( )

474.What will be the output of the following Python code?
निम्नलिखित पायथन कोड का आउटपुट क्या होगा?
>>> a={5,4}
>>> b={1,2,4,5}
>>> a<b
A) {1,2}
B) True ✔️
C) False
D) Invalid operation

475.If a={5,6,7,8}, which of the following statements is false?
यदि a = {5,6,7,8}, निम्नलिखित में से कौन सा कथन गलत है?
A) print(len(A))
B) print(min(A))
C) a.remove(5)
D) a[2]=45 ✔️

476.If a={5,6,7}, what happens when a.add(5) is executed?
यदि a = {5,6,7}, तो क्या होता है जब a.add (5) निष्पादित होता है?
A) a={5,5,6,7}
B) a={5,6,7} ✔️
C) Error as there is no add function for set data type
D) Error as 5 already exists in the set

477.What will be the output of the following Python code?
निम्नलिखित पायथन कोड का आउटपुट क्या होगा?
>>> a={4,5,6}
>>> b={2,8,6}
>>> a+b
A) {4,5,6,2,8}
B) {4,5,6,2,8,6}
C) unsupported operand type(s) for +: ‘set’ and ‘set’ ✔️
D) Error as the duplicate item 6 is present in both

478.What will be the output of the following Python code?
निम्नलिखित पायथन कोड का आउटपुट क्या होगा?
>>> a={4,5,6}
>>> b={2,8,6}
>>> a-b
A) {4,5} ✔️
B) {6}
C) Error as unsupported operand type for set data type
D) Error as the duplicate item 6 is present in both sets

479.What will be the output of the following Python code?
निम्नलिखित पायथन कोड का आउटपुट क्या होगा?
>>> a={5,6,7,8}
>>> b={7,8,10,11}
>>> a^b
A) {5,6,7,8,10,11}
B) {7,8}
C) Error as unsupported operand type of set data type
D) {5,6,10,11}

480.What will be the output of the following Python code?
निम्नलिखित पायथन कोड का आउटपुट क्या होगा?
>>> s={5,6}
>>> s*3
A) Error as unsupported operand type for set data type ✔️
B) {5,6,5,6,5,6}
C) {5,6}
D) Error as multiplication creates duplicate elements which isn’t allowed

Relate Link