कम्प्युटर र सूचना प्रविधि (प्राविधिक)
कम्प्युटर र सूचना प्रविधि (प्राविधिक)
Computer & IT (Technical) · ५,०७६ प्रश्न
५,०७६ प्रश्न उपलब्ध। मोड छान्नुहोस्:
कम्प्युटर र IT: प्रश्न र उत्तर
सही लागेको विकल्पमा थिच्नुहोस्। सही भए हरियो, गलत भए रातो देखिन्छ; ३ सेकेन्डपछि सही उत्तर र व्याख्या देखिन्छ।
सही: ० / ०
-
What is the output of the Python code: print(dict.fromkeys('ab', 0)) ?
सही उत्तर: ख) {'a': 0, 'b': 0}
fromkeys() creates a dict with each element of the iterable (here each character) as a key, all set to the given value.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
In Python, any([0, '', None, 3]) returns:
सही उत्तर: क) True
any() returns True if at least one element is truthy; 3 is truthy.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
What is the output of the Python code: print(list(zip(*[(1, 'a'), (2, 'b')]))) ?
सही उत्तर: ग) [(1, 2), ('a', 'b')]
The * unpacks the two tuples as separate arguments; zip then groups first elements together and second elements together.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
What is the output of the Python code: print([i for i in range(10) if i % 2][-1]) ?
सही उत्तर: घ) 9
The comprehension keeps odd numbers [1, 3, 5, 7, 9]; index -1 gives the last one, 9.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
What is the output of the Python code: print(isinstance(True, int)) ?
सही उत्तर: घ) True
In Python, bool is a subclass of int, so True is an instance of int.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
In Python, class A's __init__ sets self.x = 1. Class B(A) defines its own __init__ that sets only self.y = 2 and does not call super().__init__(). What does hasattr(B(), 'x') return?
सही उत्तर: ख) False
B's __init__ overrides A's, and since A.__init__ is never called, the attribute x is never created.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
In Python, class Counter has a class attribute count = 0, and its __init__ does Counter.count += 1. After a = Counter(); b = Counter(), what is Counter.count?
सही उत्तर: ग) 2
Each object creation increments the shared class attribute, so after two objects it is 2.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
In Python: try: n = int('5') / except ValueError: print('bad') / else: print(n * 2). What is printed?
सही उत्तर: घ) 10
No exception occurs, so the else block runs and prints 5 * 2 = 10.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
In Python: try: print(1/0) / except ZeroDivisionError: print('Z') / else: print('E') / finally: print('F'). What is printed?
सही उत्तर: ग) Z then F
The exception runs the except block (Z); the else block runs only if no exception occurs; finally always runs (F).
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
In Python, X = 5 is defined at module level, and def g(): print(X); X = 3. What happens when g() is called?
सही उत्तर: ग) UnboundLocalError is raised
Because X is assigned inside g, it is local throughout g, so printing it before assignment raises UnboundLocalError.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
यी अभ्यास प्रश्न हुन्, आधिकारिक प्रश्न होइनन्। पाठ्यक्रम, विज्ञापन र नतिजाका लागि सम्बन्धित निकायको आधिकारिक वेबसाइट हेर्नुहोस्। उत्तरमा गल्ती भेटे प्रश्नमुनिको "टिप्पणी / गल्ती रिपोर्ट" मा लेख्नुहोस्।
नमस्ते! पाठ्यक्रम, सामान्य ज्ञान, भाषा परीक्षा वा कुनै प्रश्नको उत्तर बुझ्न सोध्नुहोस्।
AI ले गल्ती गर्न सक्छ। महत्वपूर्ण कुरा आधिकारिक स्रोतमा जाँच्नुहोस्।