प्रोग्रामिङ – Programming MCQ
प्रोग्रामिङ – कम्प्युटर र IT
Programming · Computer & IT (Technical) · १,५६५ प्रश्न
१,५६५ प्रश्न उपलब्ध। मोड छान्नुहोस्:
प्रोग्रामिङ: प्रश्न र उत्तर
सही लागेको विकल्पमा थिच्नुहोस्। सही भए हरियो, गलत भए रातो देखिन्छ; ३ सेकेन्डपछि सही उत्तर र व्याख्या देखिन्छ।
सही: ० / ०
-
Determine the output of this Python 3 code: print(2 ** 0.5 * 2 ** 0.5 == 2)
सही उत्तर: क) False
The square root of 2 cannot be stored exactly in floating point; the product is 2.0000000000000004, so the comparison is False.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
Determine the output of this Python 3 code: a = [3, 1, 2]; a.sort(reverse=True); print(a.index(1))
सही उत्तर: घ) 2
After sorting in descending order the list is [3, 2, 1], so 1 is at index 2.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
Determine the output of this Python 3 code: print(list({i: i % 2 for i in range(4)}.values()))
सही उत्तर: ग) [0, 1, 0, 1]
The dictionary maps 0, 1, 2, 3 to their remainders mod 2, which are 0, 1, 0, 1 in insertion order.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
Determine the output of this Python 3 code: print(sum(1 for c in 'Mississippi' if c in 'sp'))
सही उत्तर: ख) 6
'Mississippi' has four s's and two p's, so the generator yields six 1s.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
Determine the output of this Python 3 code: def g(): yield 1 yield 2 print(list(g()) + list(g()))
सही उत्तर: क) [1, 2, 1, 2]
Each call g() creates a new generator yielding 1 and 2; adding the two lists concatenates them.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
Determine the output of this Python 3 code: def f(x, l=None): l = l or [] l.append(x) return l print(f(1), f(2))
सही उत्तर: घ) [1] [2]
Using None as the default creates a fresh list on every call, so the two calls do not share a list.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
Determine the output of this Python 3 code: print(list(map(lambda p: p[0] * p[1], [(1, 2), (3, 4)])))
सही उत्तर: ग) [2, 12]
The lambda multiplies the two items of each tuple: 1 * 2 = 2 and 3 * 4 = 12.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
Determine the output of this Python 3 code: x = 5; print(x > 3 and x < 10 or x == 0)
सही उत्तर: ख) True
and binds tighter than or: (True and True) or False gives True.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
Determine the output of this Python 3 code: print(10 if 0 else 20 if '' else 30)
सही उत्तर: क) 30
0 and '' are both falsy, so the chained conditional expression falls through to 30.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
Determine the output of this Python 3 code: print('a' * 0 + 'b' * -1 + 'c')
सही उत्तर: घ) c
Multiplying a string by zero or a negative number gives an empty string, so only 'c' remains.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
यी अभ्यास प्रश्न हुन्, आधिकारिक प्रश्न होइनन्। पाठ्यक्रम, विज्ञापन र नतिजाका लागि सम्बन्धित निकायको आधिकारिक वेबसाइट हेर्नुहोस्। उत्तरमा गल्ती भेटे प्रश्नमुनिको "टिप्पणी / गल्ती रिपोर्ट" मा लेख्नुहोस्।
नमस्ते! पाठ्यक्रम, सामान्य ज्ञान, भाषा परीक्षा वा कुनै प्रश्नको उत्तर बुझ्न सोध्नुहोस्।
AI ले गल्ती गर्न सक्छ। महत्वपूर्ण कुरा आधिकारिक स्रोतमा जाँच्नुहोस्।