प्रोग्रामिङ – Programming MCQ
प्रोग्रामिङ – कम्प्युटर र IT
Programming · Computer & IT (Technical) · १,५६५ प्रश्न
१,५६५ प्रश्न उपलब्ध। मोड छान्नुहोस्:
प्रोग्रामिङ: प्रश्न र उत्तर
सही लागेको विकल्पमा थिच्नुहोस्। सही भए हरियो, गलत भए रातो देखिन्छ; ३ सेकेन्डपछि सही उत्तर र व्याख्या देखिन्छ।
सही: ० / ०
-
Which C library function searches a string for the first occurrence of another string (substring)?
सही उत्तर: ख) strstr()
strstr(haystack, needle) returns a pointer to the first occurrence of needle, or NULL.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
Which C library function returns a pointer to the first occurrence of a given character in a string?
सही उत्तर: घ) strchr()
strchr(s, c) searches s for the character c and returns a pointer to it, or NULL if it is not found.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
In C, accessing a[10] for an array declared as int a[10]; results in:
सही उत्तर: ख) undefined behaviour, because C does not check array bounds
Valid indices are 0 to 9; C performs no bounds checking, so reading or writing a[10] is undefined behaviour.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
When a two-dimensional array int a[3][4] is passed to a C function, the parameter must be declared with at least:
सही उत्तर: ग) the number of columns, for example int a[][4]
The compiler needs the column size to calculate the address of a[i][j]; only the first dimension may be omitted.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
What is printed by the call b(6), where void b(int n) { if (n > 1) b(n / 2); printf("%d", n % 2); } ?
सही उत्तर: क) 110
b(6) calls b(3), which calls b(1); b(1) prints 1, then b(3) prints 1 and b(6) prints 0, giving the binary form 110.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
What is printed by the call f(3), where void f(int n) { if (n > 0) { f(n - 1); printf("%d", n); } } ?
सही उत्तर: क) 123
Each call first recurses down to n = 0 and prints only while returning, so the output is 1, 2, 3 in that order.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
Given int g(int a, int b) { return b == 0 ? a : g(b, a % b); } what does g(48, 18) return?
सही उत्तर: ख) 6
g(48,18) -> g(18,12) -> g(12,6) -> g(6,0) = 6; this is Euclid's GCD algorithm.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
Given int p(int b, int e) { return e == 0 ? 1 : b * p(b, e - 1); } what does p(3, 4) return?
सही उत्तर: ख) 81
p computes b raised to e recursively: 3 x 3 x 3 x 3 x 1 = 81.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
Which C99 header defines the macros bool, true and false?
सही उत्तर: घ) stdbool.h
Including <stdbool.h> lets programs write bool, true and false instead of _Bool, 1 and 0.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
Which C header file defines constants such as INT_MAX and CHAR_BIT?
सही उत्तर: ग) limits.h
<limits.h> defines the ranges of integer types, e.g. INT_MAX, INT_MIN and CHAR_BIT.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
यी अभ्यास प्रश्न हुन्, आधिकारिक प्रश्न होइनन्। पाठ्यक्रम, विज्ञापन र नतिजाका लागि सम्बन्धित निकायको आधिकारिक वेबसाइट हेर्नुहोस्। उत्तरमा गल्ती भेटे प्रश्नमुनिको "टिप्पणी / गल्ती रिपोर्ट" मा लेख्नुहोस्।
नमस्ते! पाठ्यक्रम, सामान्य ज्ञान, भाषा परीक्षा वा कुनै प्रश्नको उत्तर बुझ्न सोध्नुहोस्।
AI ले गल्ती गर्न सक्छ। महत्वपूर्ण कुरा आधिकारिक स्रोतमा जाँच्नुहोस्।