प्रोग्रामिङ – Programming MCQ
प्रोग्रामिङ – कम्प्युटर र IT
Programming · Computer & IT (Technical) · १,५६५ प्रश्न
१,५६५ प्रश्न उपलब्ध। मोड छान्नुहोस्:
प्रोग्रामिङ: प्रश्न र उत्तर
सही लागेको विकल्पमा थिच्नुहोस्। सही भए हरियो, गलत भए रातो देखिन्छ; ३ सेकेन्डपछि सही उत्तर र व्याख्या देखिन्छ।
सही: ० / ०
-
What is printed by the C code: int a[2][3] = {{1, 2, 3}, {4, 5, 6}}; printf("%d", *(*(a + 1) + 2)); ?
सही उत्तर: घ) 6
*(a + 1) is row a[1], and adding 2 then dereferencing gives a[1][2], which is 6.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
What is printed by the C code: int x = 5; { x = 6; int x = 7; } printf("%d", x); ?
सही उत्तर: क) 6
Inside the block, x = 6 changes the outer x before the inner x is declared; the inner x = 7 disappears at the end of the block.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
In C, with #define DOUBLE(x) x + x, what is printed by printf("%d", 3 * DOUBLE(2)); ?
सही उत्तर: ख) 8
The macro expands textually to 3 * 2 + 2, and multiplication is done first, giving 8 (not 12).
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
What is printed by the C code: printf("%s", "Lok" "Sewa"); ?
सही उत्तर: ख) LokSewa
Adjacent string literals are joined by the compiler into one literal, "LokSewa", with no space added.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
What is printed by the C code: struct P { int x, y; } p = {3, 4}, *q = &p; q->y += p.x; printf("%d", p.y); ?
सही उत्तर: ग) 7
q points to p, so q->y += p.x changes p.y from 4 to 4 + 3 = 7.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
What is printed by the C code: char *s = "Kathmandu"; printf("%d", (int)(strchr(s, 'm') - s)); ?
सही उत्तर: घ) 4
strchr() returns a pointer to the first 'm', which is at index 4 (K=0, a=1, t=2, h=3, m=4); subtracting s gives that index.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
What is printed by the C code: int i; for (i = 0; i < 10; i++) { if (i % 4 == 3) break; } printf("%d", i); ?
सही उत्तर: क) 3
The first i with i % 4 == 3 is 3, where break leaves the loop before i is incremented again.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
What is printed by the C code: int i = 0; do { i += 2; } while (i < 7); printf("%d", i); ?
सही उत्तर: क) 8
i becomes 2, 4, 6 and then 8; the condition 8 < 7 is false, so the loop stops with i = 8.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
What is printed by the C code: unsigned int u = 0; u--; printf("%d", u > 0); ?
सही उत्तर: ख) 1
Unsigned arithmetic wraps around, so 0 - 1 becomes the largest unsigned value (UINT_MAX), which is greater than 0.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
What is printed by the C code: int a = 1; a <<= 3; a |= 1; printf("%d", a); ?
सही उत्तर: ग) 9
1 << 3 is 8 (binary 1000); OR-ing with 1 sets the lowest bit, giving 1001 = 9.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
यी अभ्यास प्रश्न हुन्, आधिकारिक प्रश्न होइनन्। पाठ्यक्रम, विज्ञापन र नतिजाका लागि सम्बन्धित निकायको आधिकारिक वेबसाइट हेर्नुहोस्। उत्तरमा गल्ती भेटे प्रश्नमुनिको "टिप्पणी / गल्ती रिपोर्ट" मा लेख्नुहोस्।
नमस्ते! पाठ्यक्रम, सामान्य ज्ञान, भाषा परीक्षा वा कुनै प्रश्नको उत्तर बुझ्न सोध्नुहोस्।
AI ले गल्ती गर्न सक्छ। महत्वपूर्ण कुरा आधिकारिक स्रोतमा जाँच्नुहोस्।