प्रोग्रामिङ – Programming MCQ
प्रोग्रामिङ – कम्प्युटर र IT
Programming · Computer & IT (Technical) · १,५६५ प्रश्न
१,५६५ प्रश्न उपलब्ध। मोड छान्नुहोस्:
प्रोग्रामिङ: प्रश्न र उत्तर
सही लागेको विकल्पमा थिच्नुहोस्। सही भए हरियो, गलत भए रातो देखिन्छ; ३ सेकेन्डपछि सही उत्तर र व्याख्या देखिन्छ।
सही: ० / ०
-
Using a stack, evaluate the postfix expression 2 3 4 * + 5 - . The result is:
सही उत्तर: क) 9
Push 2, 3, 4; * gives 3 * 4 = 12; + gives 2 + 12 = 14; then 14 - 5 = 9.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
In Python: i = 0; while i < 3: i += 1 / else: i *= 10. What does print(i) display afterwards?
सही उत्तर: ग) 30
The else block of a while loop runs when the loop ends normally (no break), so 3 * 10 = 30.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
Slicing and repetition are combined in one Python expression. What does print(3 * 'ab'[1:]) display?
सही उत्तर: ख) bbb
Slicing binds tighter than *, so 'ab'[1:] is 'b', repeated three times.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
What is the output of the Python code: it = iter([1, 2, 3]); next(it); print(list(it)) ?
सही उत्तर: घ) [2, 3]
next() consumes the first element, so list() collects only the remaining items.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
What is the output of the Python code: s = 'level'; print(s == s[::-1], s.count('l')) ?
सही उत्तर: ग) True 2
"level" reads the same backwards (a palindrome) and contains the letter l twice.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
What is the output of the Python code: m = [[1, 2], [3, 4]]; print([list(r) for r in zip(*m)]) ?
सही उत्तर: घ) [[1, 3], [2, 4]]
zip(*m) pairs up the first elements and the second elements of the rows, which transposes the matrix.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
What is the output of the Python code: print(round(2.675, 2)) ?
सही उत्तर: क) 2.67
2.675 cannot be stored exactly; the stored value is slightly less than 2.675, so it rounds down to 2.67.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
What is the output of the Python code: a = [1, 2, 3]; print([a[i] * a[-i - 1] for i in range(3)]) ?
सही उत्तर: घ) [3, 4, 3]
a[-i - 1] counts from the end: the products are 1 * 3, 2 * 2 and 3 * 1.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
In Python, x = 10 is defined at module level, and def f(): global x; x += 5. What does print(x) display after calling f() twice?
सही उत्तर: घ) 20
The global statement makes f change the module-level x, so it becomes 15 and then 20.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
What is the output of the Python code: from collections import Counter; print(Counter('banana').most_common(1)) ?
सही उत्तर: ग) [('a', 3)]
Counter counts each character (a: 3, n: 2, b: 1) and most_common(1) returns a list with the most frequent pair.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
यी अभ्यास प्रश्न हुन्, आधिकारिक प्रश्न होइनन्। पाठ्यक्रम, विज्ञापन र नतिजाका लागि सम्बन्धित निकायको आधिकारिक वेबसाइट हेर्नुहोस्। उत्तरमा गल्ती भेटे प्रश्नमुनिको "टिप्पणी / गल्ती रिपोर्ट" मा लेख्नुहोस्।
नमस्ते! पाठ्यक्रम, सामान्य ज्ञान, भाषा परीक्षा वा कुनै प्रश्नको उत्तर बुझ्न सोध्नुहोस्।
AI ले गल्ती गर्न सक्छ। महत्वपूर्ण कुरा आधिकारिक स्रोतमा जाँच्नुहोस्।