प्रोग्रामिङ – Programming MCQ
प्रोग्रामिङ – कम्प्युटर र IT
Programming · Computer & IT (Technical) · १,५६५ प्रश्न
१,५६५ प्रश्न उपलब्ध। मोड छान्नुहोस्:
प्रोग्रामिङ: प्रश्न र उत्तर
सही लागेको विकल्पमा थिच्नुहोस्। सही भए हरियो, गलत भए रातो देखिन्छ; ३ सेकेन्डपछि सही उत्तर र व्याख्या देखिन्छ।
सही: ० / ०
-
Which Python keyword is used to check another condition after an if, without nesting?
सही उत्तर: ग) elif
Python uses elif (short for else if) for multi-way branching.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
In Python, list(range(10, 0, -3)) produces:
सही उत्तर: घ) [10, 7, 4, 1]
Starting at 10 and stepping by -3 while greater than 0 gives 10, 7, 4 and 1.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
In a Python function definition such as def f(*args):, args collects the extra positional arguments as a:
सही उत्तर: ग) tuple
*args packs positional arguments into a tuple; **kwargs packs keyword arguments into a dictionary.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
What is the output of print(2 in {1: 'a', 2: 'b'}) in Python?
सही उत्तर: ग) True
The in operator on a dictionary checks its keys, and 2 is a key.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
Accessing d['x'] on a Python dictionary d that has no key 'x' raises:
सही उत्तर: क) KeyError
A missing dictionary key raises KeyError; d.get('x') would return None instead.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
A Python function that contains the yield keyword is a:
सही उत्तर: ग) generator function
Calling it returns a generator that produces values one at a time, resuming after each yield.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
The main advantage of opening a file with Python's with statement (with open('f.txt') as fh:) is that:
सही उत्तर: ख) the file is closed automatically when the block ends
The with statement uses a context manager that closes the file even if an exception occurs.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
In a Python function, the global keyword is needed to:
सही उत्तर: क) assign a new value to a variable defined at module level
Without global, assigning to the name inside the function creates a new local variable.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
In Python, after def f(a, L=[]): L.append(a); return L and a first call f(1), what does print(f(2)) display?
सही उत्तर: क) [1, 2]
The default list is created once when the function is defined, so it keeps the 1 from the first call.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
What is printed by: a = [1, 2, 3]; b = a; b.append(4); print(a) in Python?
सही उत्तर: ख) [1, 2, 3, 4]
b = a makes both names refer to the same list object, so appending through b also changes a.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
यी अभ्यास प्रश्न हुन्, आधिकारिक प्रश्न होइनन्। पाठ्यक्रम, विज्ञापन र नतिजाका लागि सम्बन्धित निकायको आधिकारिक वेबसाइट हेर्नुहोस्। उत्तरमा गल्ती भेटे प्रश्नमुनिको "टिप्पणी / गल्ती रिपोर्ट" मा लेख्नुहोस्।
नमस्ते! पाठ्यक्रम, सामान्य ज्ञान, भाषा परीक्षा वा कुनै प्रश्नको उत्तर बुझ्न सोध्नुहोस्।
AI ले गल्ती गर्न सक्छ। महत्वपूर्ण कुरा आधिकारिक स्रोतमा जाँच्नुहोस्।