प्रोग्रामिङ – Programming MCQ
प्रोग्रामिङ – कम्प्युटर र IT
Programming · Computer & IT (Technical) · १,५६५ प्रश्न
१,५६५ प्रश्न उपलब्ध। मोड छान्नुहोस्:
प्रोग्रामिङ: प्रश्न र उत्तर
सही लागेको विकल्पमा थिच्नुहोस्। सही भए हरियो, गलत भए रातो देखिन्छ; ३ सेकेन्डपछि सही उत्तर र व्याख्या देखिन्छ।
सही: ० / ०
-
What is the output of the Python code: x = [1, 2, 3]; y = x[:]; y.append(4); print(len(x)) ?
सही उत्तर: क) 3
x[:] creates a new (shallow) copy, so appending to y does not change x.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
What is the output of the Python code: a = [3, 1, 2]; print(a.sort()) ?
सही उत्तर: क) None
list.sort() sorts in place and returns None, so print shows None.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
What is the output of the Python code: print(sum(range(1, 11, 2))) ?
सही उत्तर: ग) 25
range(1, 11, 2) gives 1, 3, 5, 7, 9, whose sum is 25.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
What is the output of the Python code: s = 'python'; print(s[1:-1]) ?
सही उत्तर: ख) ytho
s[1:-1] runs from index 1 up to but not including the last character.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
In Python, len('a\tb') evaluates to:
सही उत्तर: घ) 3
'\t' is a single tab character, so the string has 3 characters.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
Python's 'a-b-c'.replace('-', '', 1) returns:
सही उत्तर: ख) ab-c
The third argument limits replacement to the first occurrence only.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
In Python, what does 'banana'.rfind('a') return?
सही उत्तर: ख) 5
rfind() returns the highest index at which the substring occurs; the last 'a' in 'banana' is at index 5.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
What is the output of the Python code: print(list(range(5))[::-2]) ?
सही उत्तर: ग) [4, 2, 0]
A step of -2 starts from the last element and moves backwards two at a time: 4, 2, 0.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
In Java, what is printed by: int i = 0; i = i++; System.out.println(i); ?
सही उत्तर: क) 0
i++ yields the old value 0 and then increments i, but the assignment then stores the old value 0 back into i.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
In Java, what is printed by: System.out.println("Lok Sewa".substring(4)); ?
सही उत्तर: ख) Sewa
substring(4) returns the characters from index 4 to the end; index 4 is 'S'.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
यी अभ्यास प्रश्न हुन्, आधिकारिक प्रश्न होइनन्। पाठ्यक्रम, विज्ञापन र नतिजाका लागि सम्बन्धित निकायको आधिकारिक वेबसाइट हेर्नुहोस्। उत्तरमा गल्ती भेटे प्रश्नमुनिको "टिप्पणी / गल्ती रिपोर्ट" मा लेख्नुहोस्।
नमस्ते! पाठ्यक्रम, सामान्य ज्ञान, भाषा परीक्षा वा कुनै प्रश्नको उत्तर बुझ्न सोध्नुहोस्।
AI ले गल्ती गर्न सक्छ। महत्वपूर्ण कुरा आधिकारिक स्रोतमा जाँच्नुहोस्।