प्रोग्रामिङ – Programming MCQ
प्रोग्रामिङ – कम्प्युटर र IT
Programming · Computer & IT (Technical) · १,५६५ प्रश्न
१,५६५ प्रश्न उपलब्ध। मोड छान्नुहोस्:
प्रोग्रामिङ: प्रश्न र उत्तर
सही लागेको विकल्पमा थिच्नुहोस्। सही भए हरियो, गलत भए रातो देखिन्छ; ३ सेकेन्डपछि सही उत्तर र व्याख्या देखिन्छ।
सही: ० / ०
-
What is printed by the C code: int m[2][2] = {{1, 2}, {3, 4}}; printf("%d", m[0][1] * m[1][0] - m[0][0] * m[1][1]); ?
सही उत्तर: क) 2
m[0][1] * m[1][0] = 2 x 3 = 6 and m[0][0] * m[1][1] = 1 x 4 = 4; 6 - 4 = 2.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
A C function rev(int *a, int n) swaps a[i] with a[n-1-i] for i = 0 to n/2 - 1. After int a[] = {1, 2, 3, 4, 5}; rev(a, 5); what is a[1]?
सही उत्तर: घ) 4
The function reverses the array to {5, 4, 3, 2, 1}, so a[1] = 4.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
Given int f(int n) { return n > 100 ? n - 10 : f(f(n + 11)); } (McCarthy's 91 function), what does f(50) return?
सही उत्तर: ग) 91
For every n <= 100 this function returns 91; the nested calls climb above 100 and settle at 91.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
Given int f(int n) { return n <= 1 ? 1 : n * f(n - 1); }, what is printed by printf("%d", f(5) / f(3)); ?
सही उत्तर: ख) 20
f computes the factorial: 5! / 3! = 120 / 6 = 20.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
What is printed by the C code: int n = 37, b = 0, p = 1; while (n) { b += (n % 2) * p; p *= 10; n /= 2; } printf("%d", b); ?
सही उत्तर: क) 100101
The loop builds the binary digits of 37 as a decimal-looking number: 37 = 100101 in binary.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
Combining bitwise operators in C, which value does printf("%d", (5 & 3) | (5 ^ 3)); display?
सही उत्तर: घ) 7
5 & 3 = 1 and 5 ^ 3 = 6; 1 | 6 = 7.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
What is printed by the C code: int x = 2, y = 3; x = x ^ y; printf("%d", x & y); ?
सही उत्तर: ग) 1
2 ^ 3 = 10 ^ 11 = 01 = 1; then 1 & 3 = 1.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
What is printed by the C code: int x = 4, y; y = x > 3 ? x-- : ++x; printf("%d %d", x, y); ?
सही उत्तर: ख) 3 4
x > 3 is true, so y gets the old value 4 (post-decrement) and x becomes 3.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
What is printed by the C code: int n = 0; char *s = "a,b,,c"; while (*s) if (*s++ == ',') n++; printf("%d", n); ?
सही उत्तर: क) 3
The string contains three comma characters (one after a, two after b), so n = 3.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
What is printed by the C code: int a[] = {5, 10, 15, 20}, *p = a; p += 2; printf("%d", *p + (int)(p - a)); ?
सही उत्तर: घ) 17
p points to a[2] = 15 and p - a = 2, so 15 + 2 = 17.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
यी अभ्यास प्रश्न हुन्, आधिकारिक प्रश्न होइनन्। पाठ्यक्रम, विज्ञापन र नतिजाका लागि सम्बन्धित निकायको आधिकारिक वेबसाइट हेर्नुहोस्। उत्तरमा गल्ती भेटे प्रश्नमुनिको "टिप्पणी / गल्ती रिपोर्ट" मा लेख्नुहोस्।
नमस्ते! पाठ्यक्रम, सामान्य ज्ञान, भाषा परीक्षा वा कुनै प्रश्नको उत्तर बुझ्न सोध्नुहोस्।
AI ले गल्ती गर्न सक्छ। महत्वपूर्ण कुरा आधिकारिक स्रोतमा जाँच्नुहोस्।