प्रोग्रामिङ – Programming MCQ
प्रोग्रामिङ – कम्प्युटर र IT
Programming · Computer & IT (Technical) · १,५६५ प्रश्न
१,५६५ प्रश्न उपलब्ध। मोड छान्नुहोस्:
प्रोग्रामिङ: प्रश्न र उत्तर
सही लागेको विकल्पमा थिच्नुहोस्। सही भए हरियो, गलत भए रातो देखिन्छ; ३ सेकेन्डपछि सही उत्तर र व्याख्या देखिन्छ।
सही: ० / ०
-
What is printed by the C code: printf("%d", (int)strlen("Nep\0al")); ?
सही उत्तर: ग) 3
strlen() counts characters only up to the first null character, and "Nep\0al" has a \0 after three characters.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
What is printed by the C code: char s[] = "Pokhara"; printf("%c%c", s[0], s[strlen(s) - 1]); ?
सही उत्तर: घ) Pa
strlen(s) is 7, so s[6] is the last character a; s[0] is P, giving Pa.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
What is printed by the C code: printf("%d", 'a' - 'A'); ?
सही उत्तर: क) 32
In ASCII 'a' is 97 and 'A' is 65, so the difference is 32; this is why adding 32 converts upper case to lower case.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
What range of integers can be stored in an 8-bit signed two's complement number?
सही उत्तर: घ) -128 to 127
With n bits, two's complement covers -2^(n-1) to 2^(n-1) - 1, which for 8 bits is -128 to 127.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
An array int a[3][4] is stored in column-major order starting at address 1000, with 4 bytes per element. What is the address of a[1][2]?
सही उत्तर: ग) 1028
In column-major order, a[i][j] is at base + (j x rows + i) x size = 1000 + (2 x 3 + 1) x 4 = 1028.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
How many binary strings of length 4 contain no two consecutive 1s?
सही उत्तर: ख) 8
The count follows the Fibonacci pattern 2, 3, 5, 8 for lengths 1 to 4, so there are 8 such strings.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
In the 0/1 knapsack problem with capacity 5 and items (weight, value) = (2, 3), (3, 4), (4, 5), (5, 6), what is the maximum total value?
सही उत्तर: क) 7
The best choice is the items of weight 2 and 3 (total weight 5), giving value 3 + 4 = 7; no other feasible set does better.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
Activities with (start, finish) times (1,4), (3,5), (0,6), (5,7), (3,9), (5,9), (6,10), (8,11) are given. The greedy method that always picks the compatible activity finishing earliest selects how many activities?
सही उत्तर: घ) 3
It picks (1,4), then (5,7) as the next to finish after 4, then (8,11); nothing else fits, so 3 activities.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
Huffman coding is applied to four symbols with frequencies a = 1, b = 1, c = 2 and d = 4. What is the total number of bits needed to encode all 8 symbols?
सही उत्तर: ग) 14
Merging gives code lengths d = 1, c = 2, a = 3, b = 3; total = 4 x 1 + 2 x 2 + 1 x 3 + 1 x 3 = 14 bits.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
An algorithm does n units of work and then recurses once on half of the input, so T(n) = T(n/2) + n with T(1) = 1. Its total running time is:
सही उत्तर: ख) O(n)
Unrolling gives n + n/2 + n/4 + ... which is less than 2n, so T(n) = O(n).
💬 टिप्पणी / गल्ती रिपोर्ट (०)
यी अभ्यास प्रश्न हुन्, आधिकारिक प्रश्न होइनन्। पाठ्यक्रम, विज्ञापन र नतिजाका लागि सम्बन्धित निकायको आधिकारिक वेबसाइट हेर्नुहोस्। उत्तरमा गल्ती भेटे प्रश्नमुनिको "टिप्पणी / गल्ती रिपोर्ट" मा लेख्नुहोस्।
नमस्ते! पाठ्यक्रम, सामान्य ज्ञान, भाषा परीक्षा वा कुनै प्रश्नको उत्तर बुझ्न सोध्नुहोस्।
AI ले गल्ती गर्न सक्छ। महत्वपूर्ण कुरा आधिकारिक स्रोतमा जाँच्नुहोस्।