कम्प्युटर र सूचना प्रविधि (प्राविधिक)
कम्प्युटर र सूचना प्रविधि (प्राविधिक)
Computer & IT (Technical) · ५,०७६ प्रश्न
५,०७६ प्रश्न उपलब्ध। मोड छान्नुहोस्:
कम्प्युटर र IT: प्रश्न र उत्तर
सही लागेको विकल्पमा थिच्नुहोस्। सही भए हरियो, गलत भए रातो देखिन्छ; ३ सेकेन्डपछि सही उत्तर र व्याख्या देखिन्छ।
सही: ० / ०
-
In Python, a class P defines def __str__(self): return 'P!'. What does print(P()) display?
सही उत्तर: क) P!
print() converts an object to text by calling its __str__ method.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
In Python, class A defines hi() returning 'A', and class B(A) overrides hi() to return 'B' + super().hi(). What does print(B().hi()) display?
सही उत्तर: क) BA
super().hi() calls the parent's version, which returns 'A', and it is joined after 'B'.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
In Python: class A: n = 0 (a class attribute). After a = A(); b = A(); a.n = 5, what does print(A.n, b.n) display?
सही उत्तर: ख) 0 0
a.n = 5 creates a new instance attribute on a only; the class attribute A.n, which b also sees, stays 0.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
What is the output of the Python code: fs = [lambda: i for i in range(3)]; print([f() for f in fs]) ?
सही उत्तर: ग) [2, 2, 2]
Each lambda looks up i when it is called, not when it is created (late binding), and by then i is 2.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
A Python function f has a try block containing return 1 and a finally block containing return 2. What does f() return?
सही उत्तर: घ) 2
The finally block always runs before the function exits, and a return inside it overrides the return value of the try block.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
What is the output of the Python code: print('abc' < 'abd', 'Z' < 'a') ?
सही उत्तर: घ) True True
Strings are compared character by character by code point: 'c' < 'd', and 'Z' (90) < 'a' (97).
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
What is the output of the Python code: print(1 < 3 > 2) ?
सही उत्तर: क) True
Python chains comparisons: 1 < 3 > 2 means (1 < 3) and (3 > 2), which is True.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
What is the output of the Python code: print(max(['kiwi', 'apple', 'fig'], key=len)) ?
सही उत्तर: ख) apple
With key=len, max() returns the element whose length is greatest; 'apple' has 5 characters.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
What is the output of the Python code: d = {'a': 1, 'b': 2}; d.update({'b': 5, 'c': 3}); print(d) ?
सही उत्तर: ग) {'a': 1, 'b': 5, 'c': 3}
update() overwrites the value of an existing key and adds new keys.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
What is the output of the Python code: print(sorted({1, 2, 3} & {2, 3, 4}), sorted({1, 2} ^ {2, 3})) ?
सही उत्तर: ग) [2, 3] [1, 3]
& gives the intersection {2, 3}; ^ gives the symmetric difference, the elements in exactly one set, {1, 3}.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
यी अभ्यास प्रश्न हुन्, आधिकारिक प्रश्न होइनन्। पाठ्यक्रम, विज्ञापन र नतिजाका लागि सम्बन्धित निकायको आधिकारिक वेबसाइट हेर्नुहोस्। उत्तरमा गल्ती भेटे प्रश्नमुनिको "टिप्पणी / गल्ती रिपोर्ट" मा लेख्नुहोस्।
नमस्ते! पाठ्यक्रम, सामान्य ज्ञान, भाषा परीक्षा वा कुनै प्रश्नको उत्तर बुझ्न सोध्नुहोस्।
AI ले गल्ती गर्न सक्छ। महत्वपूर्ण कुरा आधिकारिक स्रोतमा जाँच्नुहोस्।