प्रोग्रामिङ – Programming MCQ
प्रोग्रामिङ – कम्प्युटर र IT
Programming · Computer & IT (Technical) · १,५६५ प्रश्न
१,५६५ प्रश्न उपलब्ध। मोड छान्नुहोस्:
प्रोग्रामिङ: प्रश्न र उत्तर
सही लागेको विकल्पमा थिच्नुहोस्। सही भए हरियो, गलत भए रातो देखिन्छ; ३ सेकेन्डपछि सही उत्तर र व्याख्या देखिन्छ।
सही: ० / ०
-
The inorder traversal of any binary search tree visits the keys in:
सही उत्तर: घ) ascending (sorted) order
In a BST, left subtree < root < right subtree, so left-root-right visiting gives the keys in sorted ascending order.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
Convert the parenthesised infix expression (A + B) * C into prefix notation, with each operator written before its operands.
सही उत्तर: ग) *+ABC
The operator comes before its operands: (A + B) becomes +AB, and multiplying by C gives *+ABC.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
How many swaps does bubble sort perform to sort [4, 1, 3, 2] into ascending order?
सही उत्तर: ख) 4
Bubble sort swaps exactly once per inversion; the inversions are (4,1), (4,3), (4,2) and (3,2), so 4 swaps.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
What is the output of the Python code: a, b = 0, 1; then for _ in range(6): a, b = b, a + b; finally print(a) ?
सही उत्तर: क) 8
This generates Fibonacci numbers; after 6 steps a takes the values 1, 1, 2, 3, 5, 8.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
A nested list comprehension builds a 2-row table in Python: [[i * j for j in range(3)] for i in range(2)]. What is the resulting list?
सही उत्तर: घ) [[0, 0, 0], [0, 1, 2]]
The outer comprehension makes one row for i = 0 and i = 1; each row is [i*0, i*1, i*2].
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
What is the output of the Python code: x = [1, 2, 3]; then for i in x: if i == 2: x.remove(i); finally print(x) ?
सही उत्तर: ग) [1, 3]
When 2 is removed, 3 shifts into its position and is skipped by the loop, but it is not removed; x becomes [1, 3].
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
In Python, def f(a, b=2, *c): return a + b + len(c). What does print(f(1), f(1, 5, 7, 9)) display?
सही उत्तर: ख) 3 8
f(1) = 1 + 2 + 0 = 3; in f(1, 5, 7, 9), b = 5 and c = (7, 9), so 1 + 5 + 2 = 8.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
A Python dictionary literal uses both 1 and True as keys. What does print({1: 'a', True: 'b'}) display?
सही उत्तर: क) {1: 'b'}
True == 1 and they have the same hash, so they are the same key; the first key object (1) is kept and its value is updated to 'b'.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
In Python, what is printed by: try: x = int('7') + 'a' / except ValueError: print('V') / except TypeError: print('T') ?
सही उत्तर: घ) T
int('7') succeeds; adding the int 7 to the string 'a' raises TypeError, so 'T' is printed.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
In Python, class C has a class attribute x = [] . What is printed by: a = C(); b = C(); a.x.append(1); print(b.x) ?
सही उत्तर: ग) [1]
append changes the single list shared by the class, so every instance sees [1]; no new instance attribute is created.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
यी अभ्यास प्रश्न हुन्, आधिकारिक प्रश्न होइनन्। पाठ्यक्रम, विज्ञापन र नतिजाका लागि सम्बन्धित निकायको आधिकारिक वेबसाइट हेर्नुहोस्। उत्तरमा गल्ती भेटे प्रश्नमुनिको "टिप्पणी / गल्ती रिपोर्ट" मा लेख्नुहोस्।
नमस्ते! पाठ्यक्रम, सामान्य ज्ञान, भाषा परीक्षा वा कुनै प्रश्नको उत्तर बुझ्न सोध्नुहोस्।
AI ले गल्ती गर्न सक्छ। महत्वपूर्ण कुरा आधिकारिक स्रोतमा जाँच्नुहोस्।