प्रोग्रामिङ – Programming MCQ
प्रोग्रामिङ – कम्प्युटर र IT
Programming · Computer & IT (Technical) · १,५६५ प्रश्न
१,५६५ प्रश्न उपलब्ध। मोड छान्नुहोस्:
प्रोग्रामिङ: प्रश्न र उत्तर
सही लागेको विकल्पमा थिच्नुहोस्। सही भए हरियो, गलत भए रातो देखिन्छ; ३ सेकेन्डपछि सही उत्तर र व्याख्या देखिन्छ।
सही: ० / ०
-
A pointer variable that has been declared but never initialised, so it holds an arbitrary address, is called a:
सही उत्तर: ख) wild pointer
A wild pointer contains a garbage address; using it causes unpredictable behaviour.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
What is printed by: int a[] = {1, 2, 3, 4}; int *p = a; p++; printf("%d", *p + 1); ?
सही उत्तर: क) 3
After p++, p points to a[1] = 2; *p + 1 = 3 (the dereference happens before the addition).
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
In C, executing char *p = "Hello"; p[0] = 'J'; results in:
सही उत्तर: ग) undefined behaviour, because string literals must not be modified
String literals may be stored in read-only memory; modifying one is undefined behaviour and often crashes.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
Which header file declares character-handling functions such as toupper() and isdigit() in C?
सही उत्तर: क) ctype.h
ctype.h contains character classification and conversion functions.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
The C library function atoi() is used to:
सही उत्तर: घ) convert a string of digits to an int
atoi("123") returns the integer 123; it is declared in stdlib.h.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
In C, given char s[20] = "Hi"; what is the value of sizeof(s)?
सही उत्तर: ग) 20
sizeof gives the size of the whole array (20 bytes), while strlen(s) would give 2.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
In C, what does strcmp("apple", "banana") return?
सही उत्तर: ग) a negative value
'a' comes before 'b', so the first string is lexically smaller and strcmp returns a negative value.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
Which C standard library function reads a single character from standard input?
सही उत्तर: ख) getchar()
getchar() reads one character from stdin; putchar() writes one character.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
A function prototype in C informs the compiler about a function's:
सही उत्तर: ग) name, return type and parameter types
A prototype such as int add(int, int); declares the interface so calls can be checked before the definition is seen.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
What is printed by: int x = 0; if (x = 5) printf("yes"); else printf("no"); ?
सही उत्तर: घ) yes
x = 5 is an assignment whose value is 5 (non-zero, true), so 'yes' is printed; == was probably intended.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
यी अभ्यास प्रश्न हुन्, आधिकारिक प्रश्न होइनन्। पाठ्यक्रम, विज्ञापन र नतिजाका लागि सम्बन्धित निकायको आधिकारिक वेबसाइट हेर्नुहोस्। उत्तरमा गल्ती भेटे प्रश्नमुनिको "टिप्पणी / गल्ती रिपोर्ट" मा लेख्नुहोस्।
नमस्ते! पाठ्यक्रम, सामान्य ज्ञान, भाषा परीक्षा वा कुनै प्रश्नको उत्तर बुझ्न सोध्नुहोस्।
AI ले गल्ती गर्न सक्छ। महत्वपूर्ण कुरा आधिकारिक स्रोतमा जाँच्नुहोस्।