Question:
Which of the following statements is true?
A: To create a file, space needs to be allocated in the file system.
B: To create a file, an entry for the new file must be made in the directory.
निम्न में से कौन-सा कथन सत्य है?
A: फ़ााइल बनाने के लिए फ़ााइल सिस्टम में स्पेसआवंटित करने के जरुरत होती है।
B: एक फाइल बनाने के लिए, डायरेक्टरी में नई फाइल के लिए एक एंट्री बनानी होती है।
Options:
- Only A
- Only B
- Both A and B
- Neither A nor B
- केवल A
- केवल B
- A और B दोनों
- न तो A और न ही B
Correct Answer: c)
Explanation:
Detailed Explanation:
The correct answer is c) Both A and B (A और B दोनों).
File Creation Mechanics in Operating Systems:
When an application creates a new file via a system call (e.g., open(..., O_CREAT) or creat()), the file system must perform two mandatory steps:
- Space Allocation (Statement A): Storage space must be allocated in the file system structures. This includes allocating an index node (inode in UNIX/Linux) or Master File Table (MFT) record in NTFS, along with reserving data blocks on disk to store the file’s content.
- Directory Entry Creation (Statement B): An entry linking the human-readable file name to its assigned unique file identifier (inode number or block pointer) must be written into the directory structure where the file resides.
Without space allocation, data cannot be held; without a directory entry, the file cannot be indexed or located. Hence, both statements are true.
विस्तृत व्याख्या:
सही उत्तर c) A और B दोनों है।
फ़ाइल निर्माण के आवश्यक चरण: ऑपरेटिंग सिस्टम में जब कोई नई फ़ाइल बनाई जाती है, तो फ़ाइल सिस्टम को निम्नलिखित दो बुनियादी कार्य करने होते हैं:
- स्पेस आवंटन (कथन A): फ़ाइल के मेटाडेटा (जैसे इनोड या डिस्क ब्लॉक) और उसके डेटा को रखने के लिए स्टोरेज मीडिया पर स्पेस आरक्षित और आवंटित किया जाना आवश्यक है।
- डायरेक्टरी में प्रविष्टि (कथन B): फ़ाइल को खोजने और पहचानने के लिए संबंधित डायरेक्टरी (फ़ोल्डर) में फ़ाइल के नाम और उसके इनोड/पते की एक नई एंट्री बनाई जानी चाहिए।
अतः कथन A और कथन B दोनों पूर्णतः सत्य हैं।