प्रोग्रामिङ – Programming MCQ
प्रोग्रामिङ – कम्प्युटर र IT
Programming · Computer & IT (Technical) · १,५६५ प्रश्न
१,५६५ प्रश्न उपलब्ध। मोड छान्नुहोस्:
प्रोग्रामिङ: प्रश्न र उत्तर
सही लागेको विकल्पमा थिच्नुहोस्। सही भए हरियो, गलत भए रातो देखिन्छ; ३ सेकेन्डपछि सही उत्तर र व्याख्या देखिन्छ।
सही: ० / ०
-
In Java, what is printed by: char c = 'A'; c += 2; System.out.println(c); ?
सही उत्तर: ख) C
Compound assignment includes an implicit cast back to char, so c becomes 'C' (unlike c = c + 2, which does not compile).
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
In Java, what is printed by: System.out.println(Math.max(3, 7) + Math.abs(-4) + Math.sqrt(16)); ?
सही उत्तर: ख) 15.0
7 + 4 = 11 (int), and adding Math.sqrt(16), which returns the double 4.0, gives 15.0.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
In Java, what is printed by: System.out.println("abc".compareTo("abd")); ?
सही उत्तर: घ) -1
compareTo returns the difference of the first differing characters: 'c' - 'd' = -1.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
In Java, what is printed by: StringBuilder sb = new StringBuilder("12345"); sb.deleteCharAt(2); System.out.println(sb); ?
सही उत्तर: ख) 1245
deleteCharAt(2) removes the character at index 2, which is '3'.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
In Java, what is printed by: String s = "Nepal"; System.out.println(s.replace('a', 'o') + s.length()); ?
सही उत्तर: ग) Nepol5
replace returns a new string "Nepol" and the length 5 is appended as text.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
A Java expression mixes int and double operands: System.out.println(7 / 2 * 2.0 + 7 % 3);. Which value is displayed?
सही उत्तर: ख) 7.0
7 / 2 is 3 (integer), 3 * 2.0 = 6.0 and 7 % 3 = 1, so the double result 7.0 is printed.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
What is printed by the C++ code: set<int> s{5, 2, 8, 2}; cout << *s.begin() << *s.rbegin() << s.size(); ?
सही उत्तर: ख) 283
A set keeps unique sorted elements {2, 5, 8}: the first is 2, the last is 8 and the size is 3.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
What is printed by the C++ statement cout << (5 / 2) * 2.0 << " " << 5 / 2.0 * 2; ?
सही उत्तर: घ) 4 5
5 / 2 is integer division (2), times 2.0 gives 4; 5 / 2.0 = 2.5, times 2 gives 5.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
In C++, class A has a default constructor and a copy constructor that prints "C". Given void f(A a) {}, what is printed by A a; f(a); f(a); ?
सही उत्तर: ग) CC
Passing an object by value copies it, so the copy constructor runs once for each call.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
What is printed by the C++ code: try { throw 5; } catch (double d) { cout << "D"; } catch (int i) { cout << "I" << i; } ?
सही उत्तर: क) I5
An int exception is not converted to double when matching handlers, so it is caught by catch (int i).
💬 टिप्पणी / गल्ती रिपोर्ट (०)
यी अभ्यास प्रश्न हुन्, आधिकारिक प्रश्न होइनन्। पाठ्यक्रम, विज्ञापन र नतिजाका लागि सम्बन्धित निकायको आधिकारिक वेबसाइट हेर्नुहोस्। उत्तरमा गल्ती भेटे प्रश्नमुनिको "टिप्पणी / गल्ती रिपोर्ट" मा लेख्नुहोस्।
नमस्ते! पाठ्यक्रम, सामान्य ज्ञान, भाषा परीक्षा वा कुनै प्रश्नको उत्तर बुझ्न सोध्नुहोस्।
AI ले गल्ती गर्न सक्छ। महत्वपूर्ण कुरा आधिकारिक स्रोतमा जाँच्नुहोस्।