कम्प्युटर / सूचना प्रविधि कम्प्युटर अपरेटर (पाँचौँ तह) र सहायक – प्राविधिक पत्र
कम्प्युटर / सूचना प्रविधि – कम्प्युटर अपरेटर (पाँचौँ तह) र सहायक
Computer Operator & Assistant · Computer & IT Posts
२,५७७ प्रश्न उपलब्ध। मोड छान्नुहोस्:
प्राविधिक पत्र: प्रश्न र उत्तर
सही लागेको विकल्पमा थिच्नुहोस्। सही भए हरियो, गलत भए रातो देखिन्छ; ५ सेकेन्डपछि सही उत्तर र व्याख्या देखिन्छ।
सही: ० / ०
-
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.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
What does the following C++ code print? try { throw string("err"); } catch (const char *e) { cout << "C"; } catch (string &s) { cout << s.size(); }
सही उत्तर: ग) 3
A std::string object is thrown, so the const char* handler does not match; the string handler prints its size, 3.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
What does the following C++ code print? string s = "hello world"; cout << count(s.begin(), s.end(), 'o');
सही उत्तर: घ) 2
The letter 'o' occurs twice: in "hello" and in "world".
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
What does the following C++ code print? priority_queue<int> pq; pq.push(3); pq.push(1); pq.push(4); cout << pq.top(); pq.pop(); cout << pq.top();
सही उत्तर: ख) 43
std::priority_queue is a max-heap by default: the top is 4, and after popping it the top is 3.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
What does the following C++ code print? vector<int> v{1, 2, 3, 4}; v.erase(v.begin() + 1); v.insert(v.begin(), 9); for (int x : v) cout << x;
सही उत्तर: ग) 9134
Erasing index 1 removes 2, giving 1 3 4; inserting 9 at the front gives 9 1 3 4.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
What does the following C++ code print? string s = "abc"; s[1] = 'X'; cout << s + s.substr(2);
सही उत्तर: क) aXcc
After s[1] = 'X', s is "aXc"; s.substr(2) is "c", so the output is aXcc.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
What does the following C code print? int a = 5, b = 2; printf("%d %d", a / b * b, a % b + a / b);
सही उत्तर: ग) 4 3
a / b = 2, so 2 * 2 = 4; a % b = 1 and 1 + 2 = 3.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
What does the following C code print? int x = 5, y = 0; if (y != 0 && x / y > 1) printf("A"); else printf("B");
सही उत्तर: क) B
y != 0 is false, so && short-circuits and x / y is never evaluated; the else branch prints B.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
What does the following C code print? int a[] = {5, 9, 3, 9, 7}, i, f = a[0], s = -1; for (i = 1; i < 5; i++) { if (a[i] > f) { s = f; f = a[i]; } else if (a[i] < f && a[i] > s) s = a[i]; } printf("%d", s);
सही उत्तर: घ) 7
f tracks the largest value (9) and s the largest value strictly smaller than it, which is 7.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
यी अभ्यास प्रश्न हुन्, आधिकारिक प्रश्न होइनन्। पाठ्यक्रम, विज्ञापन र नतिजाका लागि सम्बन्धित निकायको आधिकारिक वेबसाइट हेर्नुहोस्। उत्तरमा गल्ती भेटे प्रश्नमुनिको "टिप्पणी / गल्ती रिपोर्ट" मा लेख्नुहोस्।
नमस्ते! पाठ्यक्रम, सामान्य ज्ञान, भाषा परीक्षा वा कुनै प्रश्नको उत्तर बुझ्न सोध्नुहोस्।
AI ले गल्ती गर्न सक्छ। महत्वपूर्ण कुरा आधिकारिक स्रोतमा जाँच्नुहोस्।