प्रोग्रामिङ – Programming MCQ
प्रोग्रामिङ – कम्प्युटर र IT
Programming · Computer & IT (Technical) · १,५६५ प्रश्न
१,५६५ प्रश्न उपलब्ध। मोड छान्नुहोस्:
प्रोग्रामिङ: प्रश्न र उत्तर
सही लागेको विकल्पमा थिच्नुहोस्। सही भए हरियो, गलत भए रातो देखिन्छ; ३ सेकेन्डपछि सही उत्तर र व्याख्या देखिन्छ।
सही: ० / ०
-
Determine the output of this C fragment: char s[] = "HAL"; int i; for (i = 0; s[i]; i++) s[i]++; printf("%s", s);
सही उत्तर: ग) IBM
Each character is increased by one: H becomes I, A becomes B and L becomes M, giving IBM.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
Determine the output of this C fragment: int m = 72; printf("%c", m >= 80 ? 'A' : m >= 60 ? 'B' : 'C');
सही उत्तर: ख) B
72 is not >= 80, so the second conditional is evaluated; 72 >= 60 is true, giving 'B'.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
Determine the output of this C fragment: int i = 0, c = 0; while (++i < 5) c += i; printf("%d %d", i, c);
सही उत्तर: क) 5 10
++i makes i 1, 2, 3, 4 inside the loop, so c = 1 + 2 + 3 + 4 = 10; the test ++i < 5 fails when i becomes 5.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
PEP 8, the official Python style guide, recommends using how many spaces per indentation level?
सही उत्तर: ख) 4
PEP 8 recommends 4 spaces per indentation level.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
Which design pattern attaches extra behaviour to an object dynamically by wrapping it in another object with the same interface?
सही उत्तर: ग) Decorator
A Decorator wraps an object and adds responsibilities without changing the original class.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
Which design pattern provides an interface for creating objects while letting the code decide at run time which concrete class to instantiate?
सही उत्तर: घ) Factory
The Factory pattern hides object creation behind a method that returns objects of a suitable concrete class.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
The Dependency Inversion Principle of object-oriented design states that:
सही उत्तर: क) high-level modules should not depend on low-level modules; both should depend on abstractions
DIP says both high-level and low-level modules should depend on abstractions such as interfaces.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
For large n, which of these functions grows faster?
सही उत्तर: ख) n^1.5
n^1.5 / (n log n) = sqrt(n) / log n, which grows without bound, so n^1.5 grows faster than n log n.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
In a doubly linked list, given a pointer to the node to be deleted, the deletion can be done in:
सही उत्तर: घ) O(1) time
The node's prev and next pointers give direct access to both neighbours, so only a constant number of links change.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
What is the time complexity of merging two already sorted arrays of sizes m and n into one sorted array?
सही उत्तर: ग) O(m + n)
Each step of the merge copies one element, so m + n steps are needed.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
यी अभ्यास प्रश्न हुन्, आधिकारिक प्रश्न होइनन्। पाठ्यक्रम, विज्ञापन र नतिजाका लागि सम्बन्धित निकायको आधिकारिक वेबसाइट हेर्नुहोस्। उत्तरमा गल्ती भेटे प्रश्नमुनिको "टिप्पणी / गल्ती रिपोर्ट" मा लेख्नुहोस्।
नमस्ते! पाठ्यक्रम, सामान्य ज्ञान, भाषा परीक्षा वा कुनै प्रश्नको उत्तर बुझ्न सोध्नुहोस्।
AI ले गल्ती गर्न सक्छ। महत्वपूर्ण कुरा आधिकारिक स्रोतमा जाँच्नुहोस्।