Question
1.
2.
3.
4.
Answer (Detailed Solution Below)
Option 3 : NULL — the open fails / NULL — open विफल होता है
Advertisement
Detailed Solution
सही उत्तर NULL — the open fails / NULL — open विफल होता है है।
Key Points
Helpful?
Question:
A file "data.txt" does NOT exist. What does `fopen("data.txt", "r+")` return in C? / "data.txt" नाम की फ़ाइल मौजूद नहीं है। C में `fopen("data.txt", "r+")` क्या लौटाएगा?
1.
A valid pointer to a newly created empty file / नई बनी खाली फ़ाइल का वैध पॉइंटर
2.
A valid pointer, and the file is truncated / वैध पॉइंटर, और फ़ाइल truncate हो जाती है
3.
NULL — the open fails / NULL — open विफल होता है
4.
A valid pointer positioned at end-of-file / end-of-file पर स्थित वैध पॉइंटर
Correct Answer: NULL — the open fails / NULL — open विफल होता है
Mode "r+" opens an existing file for update; unlike "w+" or "a+", it never creates a missing file, so `fopen` returns NULL. The trap is confusing "r+" with "w+", which does create the file. / मोड "r+" मौजूदा फ़ाइल को update के लिए खोलता है; "w+" या "a+" की तरह यह गायब फ़ाइल नहीं बनाता, अतः `fopen` NULL लौटाता है। जाल "r+" को "w+" समझना है, जो फ़ाइल बना देता है।
Downloaded from PrepSnap (prepsnap.in)