प्रोग्रामिङ – Programming MCQ
प्रोग्रामिङ – कम्प्युटर र IT
Programming · Computer & IT (Technical) · १,५६५ प्रश्न
१,५६५ प्रश्न उपलब्ध। मोड छान्नुहोस्:
प्रोग्रामिङ: प्रश्न र उत्तर
सही लागेको विकल्पमा थिच्नुहोस्। सही भए हरियो, गलत भए रातो देखिन्छ; ३ सेकेन्डपछि सही उत्तर र व्याख्या देखिन्छ।
सही: ० / ०
-
What does the following Java code print? System.out.println((int) 3.99 + (int) -3.99);
सही उत्तर: ग) 0
Casting a double to int truncates towards zero: 3 + (-3) = 0.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
What does the following Java code print? System.out.println(-8 >>> 28);
सही उत्तर: क) 15
>>> is an unsigned shift: -8 is 0xFFFFFFF8, and shifting it right 28 places with zeros gives 0xF = 15.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
What does the following Java code print? System.out.println(Integer.toBinaryString(10));
सही उत्तर: घ) 1010
Integer.toBinaryString(10) returns the binary digits without any prefix: 1010.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
What does the following Java code print? System.out.println(Integer.parseInt("12") + Integer.parseInt("3"));
सही उत्तर: ग) 15
parseInt() converts both strings to int values, so they are added arithmetically: 12 + 3 = 15.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
What does the following Java code print? System.out.println("Nepal".contains("pa") + " " + "Nepal".equalsIgnoreCase("NEPAL"));
सही उत्तर: ख) true true
"pa" occurs in "Nepal", and equalsIgnoreCase() ignores letter case, so both are true.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
What does the following C++ code print? pair<int, string> p = {3, "abc"}; cout << p.first + p.second.size();
सही उत्तर: घ) 6
p.first is 3 and p.second.size() is 3; their sum is 6.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
What does the following C++ code print? int a = 10; int &r = a; int *p = &r; *p = 20; cout << a + r;
सही उत्तर: क) 40
r is another name for a and p points to a, so *p = 20 sets a to 20; a + r = 40.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
What does the following C++ code print? namespace A { int x = 1; } namespace B { int x = 2; } cout << A::x * 10 + B::x;
सही उत्तर: ख) 12
A::x is 1 and B::x is 2, so 1 * 10 + 2 = 12; the scope resolution operator selects each namespace's x.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
In C++, struct B { virtual void f(int x = 1) { cout << "B" << x; } }; struct D : B { void f(int x = 2) override { cout << "D" << x; } }; What is printed by B *p = new D; p->f(); ?
सही उत्तर: क) D1
The function body is chosen at run time (D::f), but default arguments are bound at compile time from the static type B, so x = 1.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
In C++, struct B1 { B1() { cout << "1"; } }; struct B2 { B2() { cout << "2"; } }; struct D : public B2, public B1 { D() { cout << "D"; } }; What is printed by creating an object D d; ?
सही उत्तर: घ) 21D
Base classes are constructed in the order in which they are listed in the class declaration (B2, then B1), then the derived class.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
यी अभ्यास प्रश्न हुन्, आधिकारिक प्रश्न होइनन्। पाठ्यक्रम, विज्ञापन र नतिजाका लागि सम्बन्धित निकायको आधिकारिक वेबसाइट हेर्नुहोस्। उत्तरमा गल्ती भेटे प्रश्नमुनिको "टिप्पणी / गल्ती रिपोर्ट" मा लेख्नुहोस्।
नमस्ते! पाठ्यक्रम, सामान्य ज्ञान, भाषा परीक्षा वा कुनै प्रश्नको उत्तर बुझ्न सोध्नुहोस्।
AI ले गल्ती गर्न सक्छ। महत्वपूर्ण कुरा आधिकारिक स्रोतमा जाँच्नुहोस्।