कम्प्युटर र सूचना प्रविधि (प्राविधिक)
कम्प्युटर र सूचना प्रविधि (प्राविधिक)
Computer & IT (Technical) · ५,०७६ प्रश्न
५,०७६ प्रश्न उपलब्ध। मोड छान्नुहोस्:
कम्प्युटर र IT: प्रश्न र उत्तर
सही लागेको विकल्पमा थिच्नुहोस्। सही भए हरियो, गलत भए रातो देखिन्छ; ३ सेकेन्डपछि सही उत्तर र व्याख्या देखिन्छ।
सही: ० / ०
-
Trace this Java fragment and give its output: System.out.println(5 / 2 + 5 % 2);
सही उत्तर: घ) 3
5 / 2 is integer division giving 2, and 5 % 2 is 1, so the result is 3.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
Trace this C++ fragment and give its output: queue<int> q; q.push(1); q.push(2); q.push(3); q.pop(); cout << q.front() << q.back();
सही उत्तर: ग) 23
A queue is FIFO: pop() removes 1, leaving 2 at the front and 3 at the back.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
Trace this C++ fragment and give its output: int y = 1; auto g = [y]() { return y * 10; }; y = 5; cout << g();
सही उत्तर: ख) 10
y is captured by value when the lambda is created (y = 1), so later changes to y do not affect it; g() returns 10.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
Trace this C++ fragment and give its output: int x = 10; auto f = [&x]() { x += 5; }; f(); cout << x;
सही उत्तर: क) 15
The lambda captures x by reference, so calling it changes the original x to 15.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
In C++, given struct P { int x; P operator+(P o) { return P{x + o.x}; } };, what is printed by: P a{2}, b{3}; cout << (a + b).x; ?
सही उत्तर: घ) 5
The overloaded + returns a new P whose x is 2 + 3 = 5.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
Trace this C++ fragment and give its output: int a[] = {1, 2, 3}; for (int x : a) x *= 2; cout << a[0];
सही उत्तर: ग) 1
The loop variable x is a copy of each element, so doubling x does not change the array; a[0] is still 1.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
Trace this C++ fragment and give its output: set<int> s = {3, 1, 3, 2}; cout << s.size();
सही उत्तर: ख) 3
std::set stores only unique values, so the duplicate 3 is ignored and the size is 3.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
Trace this C++ fragment and give its output: map<string, int> m; m["b"] = 2; m["a"] = 1; cout << m.begin()->first;
सही उत्तर: क) a
std::map keeps its keys in sorted order, so the first element has key "a".
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
Trace this C++ fragment and give its output: vector<int> v(3, 5); cout << v.size() << v[2];
सही उत्तर: घ) 35
vector<int> v(3, 5) creates 3 elements, each equal to 5, so it prints 3 then 5.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
In C++, given template <class T> T mx(T a, T b) { return a > b ? a : b; }, what is printed by cout << mx(3, 7) << mx('a', 'z'); ?
सही उत्तर: ग) 7z
The template is instantiated for int and for char; the larger values are 7 and 'z', printed as 7z.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
यी अभ्यास प्रश्न हुन्, आधिकारिक प्रश्न होइनन्। पाठ्यक्रम, विज्ञापन र नतिजाका लागि सम्बन्धित निकायको आधिकारिक वेबसाइट हेर्नुहोस्। उत्तरमा गल्ती भेटे प्रश्नमुनिको "टिप्पणी / गल्ती रिपोर्ट" मा लेख्नुहोस्।
नमस्ते! पाठ्यक्रम, सामान्य ज्ञान, भाषा परीक्षा वा कुनै प्रश्नको उत्तर बुझ्न सोध्नुहोस्।
AI ले गल्ती गर्न सक्छ। महत्वपूर्ण कुरा आधिकारिक स्रोतमा जाँच्नुहोस्।