प्रोग्रामिङ – Programming MCQ
प्रोग्रामिङ – कम्प्युटर र IT
Programming · Computer & IT (Technical) · १,५६५ प्रश्न
१,५६५ प्रश्न उपलब्ध। मोड छान्नुहोस्:
प्रोग्रामिङ: प्रश्न र उत्तर
सही लागेको विकल्पमा थिच्नुहोस्। सही भए हरियो, गलत भए रातो देखिन्छ; ३ सेकेन्डपछि सही उत्तर र व्याख्या देखिन्छ।
सही: ० / ०
-
Determine the output of this Python 3 code: print('Kathmandu'[2:5].upper())
सही उत्तर: ग) THM
The slice [2:5] takes the characters at indices 2, 3 and 4 ('thm'), and upper() converts them to capitals.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
Determine the output of this Python 3 code: print(sorted([(2, 'b'), (1, 'z'), (2, 'a')]))
सही उत्तर: ख) [(1, 'z'), (2, 'a'), (2, 'b')]
Tuples are compared element by element: first by the number, and ties are broken by the letter.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
Determine the output of this Python 3 code: a = [1, 2, 3]; print(a[-1:-4:-1])
सही उत्तर: क) [3, 2, 1]
The slice starts at the last element and steps backwards by 1 down to (but not including) index -4, covering all three elements.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
Determine the output of this Java fragment: System.out.println("Hello".chars().filter(ch -> ch == 'l').count());
सही उत्तर: घ) 2
chars() streams the characters of "Hello"; filtering for 'l' leaves two of them.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
Determine the output of this Java fragment: System.out.println((5 > 3) ^ (2 > 1));
सही उत्तर: ग) false
Both comparisons are true, and ^ on booleans is exclusive OR, so true ^ true is false.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
Determine the output of this Java fragment: byte b = (byte) 200; System.out.println(b);
सही उत्तर: ख) -56
byte holds -128 to 127; casting 200 keeps the low 8 bits, which in two's complement means 200 - 256 = -56.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
Determine the output of this Java fragment: System.out.println(07 + 0b11 + 0x1);
सही उत्तर: क) 11
07 is octal 7, 0b11 is binary 3 and 0x1 is hexadecimal 1; 7 + 3 + 1 = 11.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
Determine the output of this Java fragment: try { int[] a = new int[2]; a[2] = 1; System.out.print("T"); } catch (ArrayIndexOutOfBoundsException e) { System.out.print("C"); } finally { System.out.print("F"); }
सही उत्तर: घ) CF
Index 2 is out of bounds for an array of size 2, so control jumps to catch (C) before printing T, and finally always runs (F).
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
Determine the output of this Java fragment: System.out.println("abc".repeat(2).indexOf("ca"));
सही उत्तर: ग) 2
"abc".repeat(2) is "abcabc"; the substring "ca" first starts at index 2.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
Determine the output of this Java fragment: int[] a = new int[5]; java.util.Arrays.fill(a, 7); a[2] = 0; System.out.println(java.util.Arrays.stream(a).sum());
सही उत्तर: ख) 28
All five elements become 7, then one is set to 0, leaving 4 x 7 = 28.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
यी अभ्यास प्रश्न हुन्, आधिकारिक प्रश्न होइनन्। पाठ्यक्रम, विज्ञापन र नतिजाका लागि सम्बन्धित निकायको आधिकारिक वेबसाइट हेर्नुहोस्। उत्तरमा गल्ती भेटे प्रश्नमुनिको "टिप्पणी / गल्ती रिपोर्ट" मा लेख्नुहोस्।
नमस्ते! पाठ्यक्रम, सामान्य ज्ञान, भाषा परीक्षा वा कुनै प्रश्नको उत्तर बुझ्न सोध्नुहोस्।
AI ले गल्ती गर्न सक्छ। महत्वपूर्ण कुरा आधिकारिक स्रोतमा जाँच्नुहोस्।