प्रोग्रामिङ – Programming MCQ
प्रोग्रामिङ – कम्प्युटर र IT
Programming · Computer & IT (Technical) · १,५६५ प्रश्न
१,५६५ प्रश्न उपलब्ध। मोड छान्नुहोस्:
प्रोग्रामिङ: प्रश्न र उत्तर
सही लागेको विकल्पमा थिच्नुहोस्। सही भए हरियो, गलत भए रातो देखिन्छ; ३ सेकेन्डपछि सही उत्तर र व्याख्या देखिन्छ।
सही: ० / ०
-
In C, given void f(int a[]) { a[0] = 99; } and int b[2] = {1, 2}; what does f(b); printf("%d", b[0]); print?
सही उत्तर: ख) 99
An array argument is passed as a pointer to its first element, so the function modifies the caller's array.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
A C file has a global int x = 10; and void g(void) { x++; }. In main, int x = 1; g(); printf("%d", x); is executed. What is printed?
सही उत्तर: क) 1
g() increments the global x, but inside main the local x (value 1) hides the global one, so 1 is printed.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
What is printed by the C code: int i, count = 0; for (i = 1; i <= 10; i++) { if (i % 2) continue; if (i > 8) break; count += i; } printf("%d", count); ?
सही उत्तर: ग) 20
Odd i are skipped by continue; the even values 2, 4, 6 and 8 are added (20), and at i = 10 the loop breaks.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
In C, printf("%.1f", 5 / 2 * 2.0); displays:
सही उत्तर: क) 4.0
5 / 2 is integer division giving 2; then 2 * 2.0 = 4.0.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
What is printed by the C code: unsigned int u = 0xF0; printf("%u", u >> 4); ?
सही उत्तर: घ) 15
0xF0 is 240 (binary 1111 0000); shifting right by 4 bits gives 1111, which is 15.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
What is printed by the C code: int a[3][3] = {{1,2,3},{4,5,6},{7,8,9}}, i, s = 0; for (i = 0; i < 3; i++) s += a[i][2]; printf("%d", s); ?
सही उत्तर: ग) 18
a[i][2] is the last element of each row: 3 + 6 + 9 = 18.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
On an ASCII system, what does printf("%d", strcmp("Zebra", "apple") < 0); print in C?
सही उत्तर: ग) 1
strcmp compares character codes; 'Z' (90) is less than 'a' (97), so the result is negative and the comparison is true (1).
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
What is printed by the C code: char str[20]; strcpy(str, "Hello"); strcat(str, " World"); printf("%d", (int)strlen(str)); ?
सही उत्तर: ख) 11
After strcat the string is "Hello World", which has 11 characters (strlen does not count the '\0').
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
Which output does printf("%.2f", 10 / 4.0); produce in C?
सही उत्तर: ग) 2.50
Because 4.0 is a double, floating-point division gives 2.5, printed with two decimal places as 2.50.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
The C statement printf("%d", (int)(2.9 + 3.9)); outputs:
सही उत्तर: घ) 6
2.9 + 3.9 = 6.8, and the cast to int truncates towards zero, giving 6.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
यी अभ्यास प्रश्न हुन्, आधिकारिक प्रश्न होइनन्। पाठ्यक्रम, विज्ञापन र नतिजाका लागि सम्बन्धित निकायको आधिकारिक वेबसाइट हेर्नुहोस्। उत्तरमा गल्ती भेटे प्रश्नमुनिको "टिप्पणी / गल्ती रिपोर्ट" मा लेख्नुहोस्।
नमस्ते! पाठ्यक्रम, सामान्य ज्ञान, भाषा परीक्षा वा कुनै प्रश्नको उत्तर बुझ्न सोध्नुहोस्।
AI ले गल्ती गर्न सक्छ। महत्वपूर्ण कुरा आधिकारिक स्रोतमा जाँच्नुहोस्।