प्रोग्रामिङ – Programming MCQ
प्रोग्रामिङ – कम्प्युटर र IT
Programming · Computer & IT (Technical) · १,५६५ प्रश्न
१,५६५ प्रश्न उपलब्ध। मोड छान्नुहोस्:
प्रोग्रामिङ: प्रश्न र उत्तर
सही लागेको विकल्पमा थिच्नुहोस्। सही भए हरियो, गलत भए रातो देखिन्छ; ३ सेकेन्डपछि सही उत्तर र व्याख्या देखिन्छ।
सही: ० / ०
-
In Java, what is printed by: System.out.println('a' + 1); ?
सही उत्तर: ग) 98
A char in arithmetic is promoted to int, so 'a' (97) + 1 = 98 is printed as a number.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
In Java, what is printed by: System.out.println(1 + 2 + "3" + 4 + 5); ?
सही उत्तर: ग) 3345
Evaluation is left to right: 1 + 2 = 3 (numbers), then string concatenation takes over: "3" + "3" + "4" + "5".
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
In C++, given void f(int &x) { x *= 2; } and int a = 4;, what is printed by f(a); f(a); cout << a; ?
सही उत्तर: घ) 16
x is a reference to a, so each call doubles a itself: 4 becomes 8 and then 16.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
In C++, given int add(int a, int b = 4, int c = 1) { return a + b + c; }, what is printed by cout << add(2) << add(2, 3); ?
सही उत्तर: क) 76
add(2) uses both defaults: 2 + 4 + 1 = 7; add(2, 3) uses only the default c: 2 + 3 + 1 = 6.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
In C++, two overloads void f(int) and void f(double) exist. Which one is called by f(3.0f)?
सही उत्तर: ख) f(double)
float to double is a floating-point promotion, which ranks better than the float to int conversion.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
In C++, class C has static int n = 0 and its constructor does n++. After the declaration C a, b[3]; what is the value of C::n?
सही उत्तर: ख) 4
One object a and three array elements are constructed, and all share the single static counter, so n = 4.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
In C++, class A prints "A" in its constructor and "a" in its destructor; class B : public A prints "B" and "b". What is printed when a B object is created and then goes out of scope?
सही उत्तर: ग) ABba
Constructors run base first (A then B), and destructors run in the reverse order (B then A).
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
What is the output of the Python code: print([1, 2, 3] * 2 == [1, 2, 3, 1, 2, 3]) ?
सही उत्तर: घ) True
Multiplying a list by an integer repeats its elements; it does not multiply each element.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
What is the output of the Python code: print(10 // 3 * 3 + 10 % 3) ?
सही उत्तर: क) 10
10 // 3 is 3, so 3 * 3 + 1 = 10; for integers (a // b) * b + a % b always equals a.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
What is the output of the Python code: print('Kathmandu'.find('a', 2)) ?
सही उत्तर: क) 5
The second argument tells find() where to start searching; the first 'a' at or after index 2 is at index 5.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
यी अभ्यास प्रश्न हुन्, आधिकारिक प्रश्न होइनन्। पाठ्यक्रम, विज्ञापन र नतिजाका लागि सम्बन्धित निकायको आधिकारिक वेबसाइट हेर्नुहोस्। उत्तरमा गल्ती भेटे प्रश्नमुनिको "टिप्पणी / गल्ती रिपोर्ट" मा लेख्नुहोस्।
नमस्ते! पाठ्यक्रम, सामान्य ज्ञान, भाषा परीक्षा वा कुनै प्रश्नको उत्तर बुझ्न सोध्नुहोस्।
AI ले गल्ती गर्न सक्छ। महत्वपूर्ण कुरा आधिकारिक स्रोतमा जाँच्नुहोस्।