प्रोग्रामिङ – Programming MCQ
प्रोग्रामिङ – कम्प्युटर र IT
Programming · Computer & IT (Technical) · १,५६५ प्रश्न
१,५६५ प्रश्न उपलब्ध। मोड छान्नुहोस्:
प्रोग्रामिङ: प्रश्न र उत्तर
सही लागेको विकल्पमा थिच्नुहोस्। सही भए हरियो, गलत भए रातो देखिन्छ; ३ सेकेन्डपछि सही उत्तर र व्याख्या देखिन्छ।
सही: ० / ०
-
A recursive function in which the recursive call is the very last operation performed is said to use:
सही उत्तर: क) Tail recursion
In tail recursion nothing remains to be done after the recursive call returns, so compilers can turn it into a loop.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
With int fib(int n) { return n < 2 ? n : fib(n-1) + fib(n-2); }, how many calls to fib() are made in total (including the first) when evaluating fib(5)?
सही उत्तर: ख) 15
Calls C(n) = C(n-1) + C(n-2) + 1 with C(0) = C(1) = 1: C(2) = 3, C(3) = 5, C(4) = 9, C(5) = 15.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
A C function defined with the static keyword at file level:
सही उत्तर: घ) Can be called only from within the same source file
static at file scope gives the function internal linkage, hiding its name from other translation units.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
Which C library function is guaranteed to copy memory correctly even when the source and destination areas overlap?
सही उत्तर: क) memmove()
memmove() behaves as if it copies through a temporary buffer; memcpy() with overlapping areas gives undefined behaviour.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
A well-known pitfall of strncpy(dest, src, n) in C is that:
सही उत्तर: ग) It does not add a terminating '\0' if src has n or more characters
strncpy copies at most n characters and pads with '\0' only if src is shorter, so dest may be left unterminated.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
Unlike C, which language stores multidimensional arrays in column-major order?
सही उत्तर: ग) Fortran
Fortran stores arrays column by column (the first subscript varies fastest), while C and C++ use row-major order.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
An array int a[3][4] is stored in row-major order from base address 2000, with sizeof(int) = 4. What is the address of a[2][1]?
सही उत्तर: क) 2036
Address = base + (i x columns + j) x size = 2000 + (2 x 4 + 1) x 4 = 2000 + 36 = 2036.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
What is printed by: int i = 5; int s = sizeof(i++); printf("%d", i); ?
सही उत्तर: ख) 5
The operand of sizeof (other than a variable-length array) is not evaluated, so i++ never executes and i stays 5.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
On success, the C function scanf() returns:
सही उत्तर: घ) The number of input items successfully assigned
scanf() returns the count of items it matched and assigned, or EOF if input fails before the first conversion.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
Subtracting the character constant '0' from a digit character such as '7' in C gives:
सही उत्तर: घ) The digit's numeric value, 7
Digit characters have consecutive codes ('0' = 48 ... '7' = 55), so '7' - '0' = 55 - 48 = 7.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
यी अभ्यास प्रश्न हुन्, आधिकारिक प्रश्न होइनन्। पाठ्यक्रम, विज्ञापन र नतिजाका लागि सम्बन्धित निकायको आधिकारिक वेबसाइट हेर्नुहोस्। उत्तरमा गल्ती भेटे प्रश्नमुनिको "टिप्पणी / गल्ती रिपोर्ट" मा लेख्नुहोस्।
नमस्ते! पाठ्यक्रम, सामान्य ज्ञान, भाषा परीक्षा वा कुनै प्रश्नको उत्तर बुझ्न सोध्नुहोस्।
AI ले गल्ती गर्न सक्छ। महत्वपूर्ण कुरा आधिकारिक स्रोतमा जाँच्नुहोस्।