प्रोग्रामिङ – Programming MCQ
प्रोग्रामिङ – कम्प्युटर र IT
Programming · Computer & IT (Technical) · १,५६५ प्रश्न
१,५६५ प्रश्न उपलब्ध। मोड छान्नुहोस्:
प्रोग्रामिङ: प्रश्न र उत्तर
सही लागेको विकल्पमा थिच्नुहोस्। सही भए हरियो, गलत भए रातो देखिन्छ; ३ सेकेन्डपछि सही उत्तर र व्याख्या देखिन्छ।
सही: ० / ०
-
What is printed by the C code: int i, j; for (i = 0, j = 10; i < j; i += 3, j -= 2); printf("%d", i + j); ?
सही उत्तर: क) 12
(i, j) goes (0, 10), (3, 8), (6, 6); the condition 6 < 6 fails, so i + j = 12.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
What is printed by the C code: int i = 0, s = 0; do { s += i; i += 3; } while (i < 10); printf("%d", s); ?
सही उत्तर: घ) 18
The body adds i = 0, 3, 6 and 9 (after which i becomes 12 and the loop stops), giving 18.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
What is printed by the C statement printf("%d", 017 + 0x11 + 11); ?
सही उत्तर: घ) 43
017 is octal (15), 0x11 is hexadecimal (17) and 11 is decimal, so 15 + 17 + 11 = 43.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
What is printed by the C code: unsigned x = 0x5A; printf("%X", x >> 4 | x << 4 & 0xFF); ?
सही उत्तर: ख) A5
x >> 4 = 0x5 and (x << 4) & 0xFF = 0xA0 (& binds tighter than |), so the result 0xA5 swaps the two hexadecimal digits.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
Given enum day {SUN = 1, MON, TUE = 5, WED}; in C, what is printed by printf("%d", MON + WED); ?
सही उत्तर: क) 8
An enumerator without a value is one more than the previous one: MON = 2 and WED = 6, so the sum is 8.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
What is printed by the C code: struct item { char name[10]; int qty; float price; } it = {"Pen", 3, 12.5}; printf("%.1f", it.qty * it.price); ?
सही उत्तर: ग) 37.5
The members are initialised in order, so qty = 3 and price = 12.5, and 3 * 12.5 = 37.5.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
Given int g(void) { static int n = 1; n *= 2; return n; }, what is printed by printf("%d", g() + g() + g()); ?
सही उत्तर: ग) 14
The static variable keeps its value between calls, so the calls return 2, 4 and 8, whose sum is 14 in any evaluation order.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
A C function makes two recursive calls around a print: void p(int n) { if (n > 0) { p(n - 1); printf("%d", n); p(n - 1); } }. Which digit string does the call p(3) produce?
सही उत्तर: ग) 1213121
p(1) prints 1; p(2) prints p(1), 2, p(1) = 121; p(3) prints p(2), 3, p(2) = 1213121.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
Given int f(int n) { if (n <= 1) return n; return f(n / 2) + n; }, what does f(10) return?
सही उत्तर: ग) 18
f(1) = 1, f(2) = f(1) + 2 = 3, f(5) = f(2) + 5 = 8, f(10) = f(5) + 10 = 18.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
Given int f(int n) { return n == 0 ? 1 : 2 * f(n - 1); }, what does printf("%d", f(5)); print?
सही उत्तर: क) 32
f(n) doubles the result n times starting from 1, so f(5) = 2^5 = 32.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
यी अभ्यास प्रश्न हुन्, आधिकारिक प्रश्न होइनन्। पाठ्यक्रम, विज्ञापन र नतिजाका लागि सम्बन्धित निकायको आधिकारिक वेबसाइट हेर्नुहोस्। उत्तरमा गल्ती भेटे प्रश्नमुनिको "टिप्पणी / गल्ती रिपोर्ट" मा लेख्नुहोस्।
नमस्ते! पाठ्यक्रम, सामान्य ज्ञान, भाषा परीक्षा वा कुनै प्रश्नको उत्तर बुझ्न सोध्नुहोस्।
AI ले गल्ती गर्न सक्छ। महत्वपूर्ण कुरा आधिकारिक स्रोतमा जाँच्नुहोस्।