प्रोग्रामिङ – Programming MCQ
प्रोग्रामिङ – कम्प्युटर र IT
Programming · Computer & IT (Technical) · १,५६५ प्रश्न
१,५६५ प्रश्न उपलब्ध। मोड छान्नुहोस्:
प्रोग्रामिङ: प्रश्न र उत्तर
सही लागेको विकल्पमा थिच्नुहोस्। सही भए हरियो, गलत भए रातो देखिन्छ; ३ सेकेन्डपछि सही उत्तर र व्याख्या देखिन्छ।
सही: ० / ०
-
What is printed by the C code: int m[2][3] = {{1, 2, 3}, {4, 5, 6}}; printf("%d", m[1][0] + *(m[0] + 2)); ?
सही उत्तर: क) 7
m[1][0] = 4 and *(m[0] + 2) = m[0][2] = 3, so the sum is 7.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
What is printed by the C code: int i = 0, a[3]; for (; i < 3; i++) a[i] = i * i; printf("%d", a[a[2] - 3]); ?
सही उत्तर: घ) 1
a = {0, 1, 4}; a[2] - 3 = 1, and a[1] = 1.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
Given void r(const char *s) { if (*s) { r(s + 1); putchar(*s); } }, what does r("abc") print?
सही उत्तर: ग) cba
Each character is printed after the recursive call returns, so the string comes out reversed.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
Given int fun(int n) { if (n < 3) return n; return fun(n - 1) + fun(n - 3); }, what does fun(6) return?
सही उत्तर: ख) 7
fun(0..2) = 0, 1, 2; fun(3) = 2 + 0 = 2, fun(4) = 2 + 1 = 3, fun(5) = 3 + 2 = 5, fun(6) = 5 + 2 = 7.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
Given void f(int n) { if (n > 0) { printf("%d", n); f(n - 2); } }, what does the call f(7) print?
सही उत्तर: क) 7531
It prints n and recurses with n - 2: 7, 5, 3, 1; at -1 the recursion stops.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
Given int add(int a, int b) { return a + b; } and int mul(int a, int b) { return a * b; }, what is printed by: int (*op[])(int, int) = {add, mul}; printf("%d", op[1](3, op[0](1, 2))); ?
सही उत्तर: घ) 9
op[0](1, 2) = add(1, 2) = 3, then op[1](3, 3) = mul(3, 3) = 9.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
What is printed by the C code: char s[] = "Pokhara", *p = s; while (*p) p++; printf("%d", (int)(p - s)); ?
सही उत्तर: ग) 7
p stops at the terminating '\0'; the distance from the start is the string length, 7.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
What is printed by the C code: char *names[] = {"Ram", "Sita", "Hari"}; printf("%s", *(names + 1) + 2); ?
सही उत्तर: ख) ta
*(names + 1) is "Sita"; adding 2 skips two characters, leaving "ta".
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
What is printed by the C code: int a = 10, b = 4; printf("%d", a & b ? a | b : a ^ b); ?
सही उत्तर: क) 14
10 & 4 = 1010 & 0100 = 0 (false), so a ^ b = 1010 ^ 0100 = 1110 = 14 is printed.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
What is printed by the C code: int i = 0; loop: i++; if (i < 5) goto loop; printf("%d", i); ?
सही उत्तर: घ) 5
The goto repeats the increment until i < 5 becomes false, that is, when i = 5.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
यी अभ्यास प्रश्न हुन्, आधिकारिक प्रश्न होइनन्। पाठ्यक्रम, विज्ञापन र नतिजाका लागि सम्बन्धित निकायको आधिकारिक वेबसाइट हेर्नुहोस्। उत्तरमा गल्ती भेटे प्रश्नमुनिको "टिप्पणी / गल्ती रिपोर्ट" मा लेख्नुहोस्।
नमस्ते! पाठ्यक्रम, सामान्य ज्ञान, भाषा परीक्षा वा कुनै प्रश्नको उत्तर बुझ्न सोध्नुहोस्।
AI ले गल्ती गर्न सक्छ। महत्वपूर्ण कुरा आधिकारिक स्रोतमा जाँच्नुहोस्।