प्रोग्रामिङ – Programming MCQ
प्रोग्रामिङ – कम्प्युटर र IT
Programming · Computer & IT (Technical) · १,५६५ प्रश्न
१,५६५ प्रश्न उपलब्ध। मोड छान्नुहोस्:
प्रोग्रामिङ: प्रश्न र उत्तर
सही लागेको विकल्पमा थिच्नुहोस्। सही भए हरियो, गलत भए रातो देखिन्छ; ३ सेकेन्डपछि सही उत्तर र व्याख्या देखिन्छ।
सही: ० / ०
-
What is the output of the Python code: print('Nepal'.startswith('Ne'), 'Nepal'.endswith('L')) ?
सही उत्तर: क) True False
Both methods are case-sensitive: 'Nepal' starts with 'Ne' but ends with a lower-case 'l', not 'L'.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
What is the output of the Python code: print('banana'.count('an')) ?
सही उत्तर: क) 2
count() returns the number of non-overlapping occurrences; 'an' appears twice in 'banana'.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
What is printed by the C code: char a[] = "ab", b[] = "ab"; printf("%d", a == b); ?
सही उत्तर: ख) 0
a == b compares the addresses of two different arrays, not their contents, so it is false (0); strcmp() is needed to compare contents.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
What is printed by the C code: int x = 0x0F & 0xF5; printf("%d", x); ?
सही उत्तर: ग) 5
0x0F keeps only the low four bits of 0xF5 (binary 11110101), which are 0101 = 5.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
What is printed by the C code: int a[] = {4, 7, 1, 9, 2}, i, s = 0; for (i = 0; i < 5; i++) if (a[i] % 2) s += a[i]; printf("%d", s); ?
सही उत्तर: घ) 17
a[i] % 2 is non-zero for the odd values 7, 1 and 9, whose sum is 17.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
What is printed by the C code: int x = 10, y = 20; x = x + y; y = x - y; x = x - y; printf("%d %d", x, y); ?
सही उत्तर: घ) 20 10
x becomes 30, then y = 30 - 20 = 10, then x = 30 - 10 = 20, so the values are swapped without a temporary variable.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
What is printed by the C code: double d = 7 / 2; printf("%.1f", d); ?
सही उत्तर: क) 3.0
7 / 2 is integer division giving 3 before the value is stored in d, so d is 3.0.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
What is printed by the C code: int i; long x = 1; for (i = 0; i < 10; i++) x *= 2; printf("%ld", x); ?
सही उत्तर: ख) 1024
Doubling 1 ten times gives 2 to the power 10, which is 1024.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
What is printed by the C code: int i = 3; printf("%d", i ? i-- ? i : 7 : 9); ?
सही उत्तर: ग) 2
i is 3 (true), then i-- yields 3 (true) and sets i to 2; there is a sequence point after the condition, so the result is i = 2.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
What is printed by the C code: int k = 0; while (k++ < 3); printf("%d", k); ?
सही उत्तर: ग) 4
The semicolon makes the loop body empty; the test k++ < 3 is made with k = 0, 1, 2, 3, and the last (false) test still increments k to 4.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
यी अभ्यास प्रश्न हुन्, आधिकारिक प्रश्न होइनन्। पाठ्यक्रम, विज्ञापन र नतिजाका लागि सम्बन्धित निकायको आधिकारिक वेबसाइट हेर्नुहोस्। उत्तरमा गल्ती भेटे प्रश्नमुनिको "टिप्पणी / गल्ती रिपोर्ट" मा लेख्नुहोस्।
नमस्ते! पाठ्यक्रम, सामान्य ज्ञान, भाषा परीक्षा वा कुनै प्रश्नको उत्तर बुझ्न सोध्नुहोस्।
AI ले गल्ती गर्न सक्छ। महत्वपूर्ण कुरा आधिकारिक स्रोतमा जाँच्नुहोस्।