प्रोग्रामिङ – Programming MCQ
प्रोग्रामिङ – कम्प्युटर र IT
Programming · Computer & IT (Technical) · १,५६५ प्रश्न
१,५६५ प्रश्न उपलब्ध। मोड छान्नुहोस्:
प्रोग्रामिङ: प्रश्न र उत्तर
सही लागेको विकल्पमा थिच्नुहोस्। सही भए हरियो, गलत भए रातो देखिन्छ; ३ सेकेन्डपछि सही उत्तर र व्याख्या देखिन्छ।
सही: ० / ०
-
What does the following Python code print? print(list(range(-3, 3, 2)))
सही उत्तर: घ) [-3, -1, 1]
range starts at -3 and adds 2 each time while staying below 3: -3, -1, 1.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
What does the following Java code print? final int[] a = {1, 2}; a[0] = 5; System.out.println(a[0] + a[1]);
सही उत्तर: ग) 7
final stops the variable a from referring to another array, but the elements can still be changed: 5 + 2 = 7.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
In Java, class A { int x = 1; } and class B extends A { int x = 2; } are defined. What does A a = new B(); System.out.println(a.x); print?
सही उत्तर: क) 1
Fields are not overridden, only hidden; field access uses the reference's declared type A, so a.x is 1.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
What does the following Java code print? System.out.println(Math.abs(Integer.MIN_VALUE));
सही उत्तर: घ) -2147483648
+2147483648 cannot be stored in an int, so the negation overflows and Math.abs returns Integer.MIN_VALUE itself.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
What does the following Java code print? double x = 0.0 / 0; System.out.println(x == x);
सही उत्तर: ख) false
0.0 / 0 is NaN, and NaN is not equal to anything, not even itself.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
What does the following Java code print? System.out.println(1.0 / 0);
सही उत्तर: घ) Infinity
Floating-point division by zero does not throw an exception in Java; it gives Infinity.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
What does the following Java code print? outer: for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { if (j == 1) continue outer; System.out.print(i + "" + j); } }
सही उत्तर: क) 001020
For each i only j = 0 is printed; when j becomes 1, 'continue outer' jumps to the next i, giving 00 10 20.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
What does the following Java code print? StringBuilder sb = new StringBuilder("hello"); sb.setCharAt(0, 'j'); sb.append('!'); System.out.println(sb);
सही उत्तर: ग) jello!
setCharAt replaces 'h' with 'j', and append adds '!' at the end: jello!
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
What does the following Java code print? System.out.println(true ? 1 : 2.0);
सही उत्तर: ख) 1.0
The two operands of ?: are int and double, so the result type is double and the int 1 is printed as 1.0.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
What does the following Java code print? System.out.println(Math.ceil(4.1) + Math.floor(-4.1));
सही उत्तर: ख) 0.0
Math.ceil(4.1) = 5.0 and Math.floor(-4.1) = -5.0; their double sum is printed as 0.0.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
यी अभ्यास प्रश्न हुन्, आधिकारिक प्रश्न होइनन्। पाठ्यक्रम, विज्ञापन र नतिजाका लागि सम्बन्धित निकायको आधिकारिक वेबसाइट हेर्नुहोस्। उत्तरमा गल्ती भेटे प्रश्नमुनिको "टिप्पणी / गल्ती रिपोर्ट" मा लेख्नुहोस्।
नमस्ते! पाठ्यक्रम, सामान्य ज्ञान, भाषा परीक्षा वा कुनै प्रश्नको उत्तर बुझ्न सोध्नुहोस्।
AI ले गल्ती गर्न सक्छ। महत्वपूर्ण कुरा आधिकारिक स्रोतमा जाँच्नुहोस्।