NIELIT M3-R5 Python MCQs for Beginners

NIELIT M3-R5 Python MCQs for Beginners

481.Which of the following lines of code will result in an error?
कोड की निम्नलिखित पंक्तियों में से कौन सी त्रुटि होगी?
A) s={abs}
B) s={4, ‘abc’, (1,2)}
C) s={2, 2.2, 3, ‘xyz’}
D) s={san}
Answer: d

482.What will be the output of the following Python code?
निम्नलिखित पायथन कोड का आउटपुट क्या होगा?
s={2, 5, 6, 6, 7}
print(s)
A) {2, 5, 7}
B) {2, 5, 6, 7} ✔️
C) {2, 5, 6, 6, 7}
D) Error

483.Input order is preserved in sets.
इनपुट ऑर्डर सेट में संरक्षित है।
A) True
B) False ✔️

484.Write a list comprehension for number and its cube for:
संख्या और उसके घन के लिए एक सूची लिखें:
l=[1, 2, 3, 4, 5, 6, 7, 8, 9]
A) [x**3 for x in l] ✔️
B) [x^3 for x in l]
C) [x**3 in l]
D) [x^3 in l]

485.What will be the output of the following Python code?
निम्नलिखित पायथन कोड का आउटपुट क्या होगा?
s={1, 2, 3}
s.update(4)
print(s)
A) {1, 2, 3, 4}
B) {1, 2, 4, 3}
C) {4, 1, 2, 3}
D) Error ✔️

486.Which of the following functions cannot be used on heterogeneous sets?
निम्न में से किस कार्य का उपयोग विषम सेटों पर नहीं किया जा सकता है?
A) pop
B) remove
C) update
D) sum ✔️

487.What will be the output of the following Python code snippet?
निम्नलिखित पायथन कोड स्निपेट का आउटपुट क्या होगा?
print([[i+j for i in “abc”] for j in “def”])
A) [‘da’, ‘ea’, ‘fa’, ‘db’, ‘eb’, ‘fb’, ‘dc’, ‘ec’, ‘fc’]
B) [[‘ad’, ‘bd’, ‘cd’], [‘ae’, ‘be’, ‘ce’], [‘af’, ‘bf’, ‘cf’]] ✔️
C) [[‘da’, ‘db’, ‘dc’], [‘ea’, ‘eb’, ‘ec’], [‘fa’, ‘fb’, ‘fc’]]
D) [‘ad’, ‘ae’, ‘af’, ‘bd’, ‘be’, ‘bf’, ‘cd’, ‘ce’, ‘cf’]


488.What will be the output of the following Python code?
निम्नलिखित पायथन कोड का आउटपुट क्या होगा?
>>> a={5,6,7,8}
>>> b={7,8,9,10}
>>> len(a+b)
A) 8
B) Error, unsupported operand ‘+’ for sets ✔️
C) 6
D) Nothing is displayed

489.What will be the output of the following Python code?
निम्नलिखित पायथन कोड का आउटपुट क्या होगा?
a={1,2,3}
b={1,2,3}
c=a.issubset(B)
print(C)

A) True ✔️
B) Error, no method called issubset() exists
C) Syntax error for issubset() method
D) False

490.Is the following Python code valid?
निम्नलिखित पायथन कोड मान्य है?
a={1,2,3}
b={1,2,3,4}
c=a.issuperset(B)
print(C)

A) False ✔️
B) True
C) Syntax error for issuperset() method
D) Error, no method called issuperset() exists

491.What will be the output of the following Python code?
निम्नलिखित पायथन कोड का आउटपुट क्या होगा?
s=set()
type(s)
A) <‘set’>
B) <class ‘set’> ✔️
C) set
D) class set

492.The following Python code results in an error.
निम्न पायथन कोड के परिणामस्वरूप त्रुटि होती है।
s={2, 3, 4, [5, 6]}
A) True ✔️
B) False

Relate Link