प्रोग्रामिङ – Programming MCQ
प्रोग्रामिङ – कम्प्युटर र IT
Programming · Computer & IT (Technical) · १,५६५ प्रश्न
१,५६५ प्रश्न उपलब्ध। मोड छान्नुहोस्:
प्रोग्रामिङ: प्रश्न र उत्तर
सही लागेको विकल्पमा थिच्नुहोस्। सही भए हरियो, गलत भए रातो देखिन्छ; ३ सेकेन्डपछि सही उत्तर र व्याख्या देखिन्छ।
सही: ० / ०
-
In C, the function rewind(fp):
सही उत्तर: घ) moves the file position indicator back to the beginning of the file
rewind(fp) is equivalent to fseek(fp, 0L, SEEK_SET) and also clears the error indicator.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
Which C function returns the current position of the file position indicator of an open file?
सही उत्तर: ख) ftell()
ftell(fp) returns the current offset in bytes from the beginning of the file.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
A structure variable e has a member d, which is itself a structure with a member day. The member day is accessed as:
सही उत्तर: ग) e.d.day
For nested structure variables the dot operator is applied twice: first to reach d, then day.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
In C, two structure variables of the same type s1 and s2:
सही उत्तर: ख) can be assigned with s1 = s2 but cannot be compared with s1 == s2
Structure assignment copies all members, but C provides no == operator for structures; members must be compared individually.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
On a typical system where int is 4 bytes and must be aligned on a 4-byte boundary, sizeof(struct s { char c; int i; }) is usually:
सही उत्तर: ग) 8
The compiler inserts 3 padding bytes after c so that i is 4-byte aligned, giving 1 + 3 + 4 = 8 bytes.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
Dereferencing a NULL pointer in a C program results in:
सही उत्तर: क) undefined behaviour, often a crash such as a segmentation fault
NULL does not point to any valid object, so accessing *p when p is NULL is undefined and usually crashes the program.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
On a typical 64-bit system, sizeof(char *) in C is:
सही उत्तर: ग) 8 bytes
A pointer holds an address; on 64-bit systems addresses are 64 bits (8 bytes) whatever type the pointer points to.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
Which C function writes formatted output into a character array instead of to the screen?
सही उत्तर: ख) sprintf()
sprintf(buf, format, ...) works like printf but stores the result in the string buf.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
The call fgets(buf, n, stdin) in C:
सही उत्तर: ख) reads at most n - 1 characters and keeps the newline in buf if one is read
fgets stops after n - 1 characters, at a newline (which it stores) or at end of file, and always adds the terminating '\0'.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
-
How does puts(s) differ from printf("%s", s) in C?
सही उत्तर: क) puts() automatically adds a newline after the string
puts() writes the string followed by a newline character, whereas printf with %s does not add one.
💬 टिप्पणी / गल्ती रिपोर्ट (०)
यी अभ्यास प्रश्न हुन्, आधिकारिक प्रश्न होइनन्। पाठ्यक्रम, विज्ञापन र नतिजाका लागि सम्बन्धित निकायको आधिकारिक वेबसाइट हेर्नुहोस्। उत्तरमा गल्ती भेटे प्रश्नमुनिको "टिप्पणी / गल्ती रिपोर्ट" मा लेख्नुहोस्।
नमस्ते! पाठ्यक्रम, सामान्य ज्ञान, भाषा परीक्षा वा कुनै प्रश्नको उत्तर बुझ्न सोध्नुहोस्।
AI ले गल्ती गर्न सक्छ। महत्वपूर्ण कुरा आधिकारिक स्रोतमा जाँच्नुहोस्।