🎓 BookMCQ
← Back to 11. File System Interface

📝 File attributes concepts in Operating System (12 MCQs)

Metadata Describing File Identity and Properties

File attributes are metadata maintained by the file system to describe individual files independently of their actual contents. They provide information required for identification, storage management, access control, and file operations. Common attributes include file name, type, size, location, ownership, permissions, timestamps, and status flags. The operating system stores and retrieves these properties through directory entries or file-system metadata structures.

Why File Systems Maintain Separate Metadata

Applications and users need information about files without reading their entire contents. File attributes support file identification, allocation, protection, and maintenance. Separating metadata from file data allows the operating system to manage permissions and storage efficiently. Different file systems record different attributes, so the exact metadata fields and their representation are implementation-dependent.

Retrieving and Updating File Attributes

When an application requests file information, the operating system locates its directory entry or associated metadata structure. It retrieves attributes such as size, owner, permissions, and modification time. Operations including writing, renaming, and changing permissions may update selected attributes. The file system ensures that metadata changes are recorded according to its consistency and journaling mechanisms.

Examining Attributes of a Stored Document

Suppose a document occupies 2048 KB, belongs to user Ali, and has read and write permissions for its owner. Its metadata may also record a creation-related timestamp and a modification timestamp. When the document is updated, its size or modification time may change, while its ownership and file-system identity generally remain unchanged.

Metadata Overhead and Access-Control Benefits

File attributes support efficient searching, security enforcement, storage accounting, and file management. However, metadata requires storage space and must remain consistent with file contents and directory information. Timestamp updates can also generate additional metadata writes. File systems differ in whether they record creation time, access time, extended attributes, or other platform-specific properties.

Distinguishing File Attributes from File Contents

'File size is the actual file content' is incorrect because size describes the amount of stored information. 'Permissions determine how much disk space a file occupies' is incorrect because allocation and access control serve different purposes. 'Every file system stores identical attributes' is incorrect because metadata formats and supported properties vary between implementations.

Exam Focus: Metadata Fields and File-System Operations

Identify common attributes and explain their purposes in file management. Distinguish ownership, permissions, file size, storage location, and timestamps. Determine which attributes may change after reading, writing, renaming, or modifying permissions. Questions may also examine how directory entries and file metadata structures maintain information independently of file contents.

Key Terms of File Attributes

  • Name - Identifies a file.
  • Type - Indicates file format.
  • Size - Records file length.
  • Owner - Identifies responsible user.
  • Permissions - Define allowed operations.
  • Timestamp - Records an event time.
3
Easy
5
Medium
4
Hard

📝 All File attributes concepts in Operating System MCQs

Q1. What is a file attribute?

A.A property that describes a file's contents
B.A property that describes a file's name
C.A property that describes a file's metadata ✅
D.A property that describes a file's location
💡 Difficulty: easy | ✅ Correct: C

📖 Explanation: A file attribute is metadata that describes characteristics such as size, timestamps, permissions, and type. Option C captures this definition. Option A confuses attribute with content, option B with the filename itself, and option D with physical storage location. In real systems, attributes let the OS manage files without looking at the data itself.

Q2. When a user creates a file named \report.txt\, which attribute is being set first?

A.File size
B.File type
C.File name ✅
D.File permission
💡 Difficulty: easy | ✅ Correct: C

📖 Explanation: The first attribute established is the file name, which uniquely identifies the file in a directory. Option C is correct. File size (A) is unknown until data is written, file type (B) is inferred from extension but not a core attribute, and permission (D) defaults later. Knowing the name attribute is essential for locating the file in any OS.

Q3. How does setting the read‑only attribute affect subsequent file operations?

A.It prevents any user from opening the file
B.It allows reading but blocks writing ✅
C.It encrypts the file contents
D.It moves the file to a protected directory
💡 Difficulty: easy | ✅ Correct: B

📖 Explanation: Read‑only permits reading while blocking write attempts, making option B correct. Option A is too restrictive—users can still open for reading. Option C introduces encryption, which is unrelated to the read‑only flag. Option D describes a location change, not an attribute effect. In practice, read‑only protects data from accidental modification while still allowing access.

Q4. A developer needs to ensure a log file cannot be deleted by normal users but must still be writable by the application. Which attribute combination is most appropriate?

A.Read‑only and hidden
B.System and archive
C.Hidden and archive
D.System and read‑only ✅
💡 Difficulty: medium | ✅ Correct: D

📖 Explanation: The system attribute protects the file from deletion by regular users, while read‑only would block writing, so the developer must instead set the system attribute and grant write permission specifically to the application—option D reflects this nuanced approach. Options A, B, and C either restrict writing or do not affect deletion. Real‑world OS permissions often rely on system flags plus explicit ACLs.

Q5. Why do operating systems store timestamps (creation, modification, access) as file attributes?

A.To track file size changes
B.To enforce security policies
C.To provide audit trails and support backup tools ✅
D.To determine file type
💡 Difficulty: medium | ✅ Correct: C

📖 Explanation: Timestamps enable audit trails, backup utilities, and synchronization, making option C correct. They do not directly track size (A), enforce security (B), or identify type (D). In real environments, knowing when a file was last modified helps administrators decide what to back up and detect unauthorized access.

Q6. If a file’s attribute indicates a size of 2048 bytes but the actual data stored is only 1500 bytes, what is the most likely explanation?

A.The file is corrupted
B.The file system reserves space for future growth ✅
C.The attribute includes metadata overhead
D.The file is compressed
💡 Difficulty: medium | ✅ Correct: B

📖 Explanation: File systems often allocate space in blocks larger than the data, so the recorded size reflects allocated space, not just used bytes—option B. Corruption (A) would cause mismatched data, not size. Metadata overhead (C) is separate from file size attribute. Compression (D) would reduce stored size, not increase the reported size.

Q7. A user copies a large video file from a USB drive to a network share. After copying, the file’s modification timestamp is updated to the copy time. Which attribute behavior caused this?

A.Preservation of original timestamps is disabled by default ✅
B.The copy operation resets all attributes
C.Network shares do not support timestamps
D.The USB drive overwrites timestamps during transfer
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: Many copy utilities reset timestamps to the time of the copy unless instructed otherwise, so option A is correct. Option B is too broad—permissions may be preserved. Option C is false; network shares support timestamps. Option D misattributes the behavior to the source device. Understanding default attribute handling helps users maintain accurate file histories.

Q8. A system admin notices that a critical configuration file has the hidden attribute set, preventing users from seeing it in directory listings. Which command option would reliably display this file on a Unix‑like system?

A.ls -a ✅
B.ls -l
C.dir /h
D.attrib +h
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: The \-a\ flag shows all files, including hidden ones, making option A correct. \-l\ lists details but still hides hidden files. \dir /h\ is a Windows command, not Unix. \attrib +h\ sets the hidden flag rather than displaying. Knowing how hidden attributes affect visibility is essential for troubleshooting.

Q9. A program writes to a file that has the archive attribute cleared. After the write, the attribute becomes set. What purpose does this behavior serve?

A.It signals that the file has been modified and needs backup ✅
B.It encrypts the newly written data
C.It changes the file type to executable
D.It hides the file from normal users
💡 Difficulty: hard | ✅ Correct: A

📖 Explanation: The archive flag indicates a file has changed since the last backup, so setting it after a write signals backup software to include the file—option A. Encryption (B) and type change (C) are unrelated, and hiding (D) would use the hidden attribute. Proper use of the archive flag helps maintain data integrity in backup strategies.

Q10. Consider a file system that tracks three timestamps: creation, last access, and last modification. A user opens a file, reads its content, then closes it without writing. Which timestamps change, and why?

A.Only creation changes because the file is accessed
B.Only last access changes because no data is altered ✅
C.Both last access and last modification change because the file is opened
D.All three timestamps change because the OS updates them on every operation
💡 Difficulty: hard | ✅ Correct: B

📖 Explanation: Reading a file updates the last access timestamp while leaving creation and modification unchanged, making option B correct. Creation (A) remains static after file creation. Modification (C) only changes on writes. Option D incorrectly assumes all timestamps are refreshed on any operation. This behavior aids forensic analysis of file usage.

Q11. A database stores file metadata in a table with columns for name, size, permissions, and timestamps. If the system needs to quickly locate all files larger than 10 MB that were modified in the last 24 hours, which attribute(s) should be indexed for optimal query performance?

A.Name only
B.Size and modification timestamp ✅
C.Permissions only
D.All columns
💡 Difficulty: hard | ✅ Correct: B

📖 Explanation: Indexing size and modification timestamp allows the database engine to efficiently filter by both criteria, making option B correct. Indexing name (A) or permissions (C) does not help the size‑time query. Indexing all columns (D) adds overhead without benefit. Proper indexing of relevant attributes speeds up real‑world file‑management queries.

Q12. A security policy requires that executable files must not have the write attribute for any non‑admin user. Which combination of attributes enforces this rule on a Unix‑like system?

A.rwx for owner, rw- for group, r-- for others
B.rwx for owner, r-x for group, r-x for others ✅
C.rw- for owner, r-- for group, r-- for others
D.r-x for owner, r-x for group, r-x for others
💡 Difficulty: hard | ✅ Correct: B

📖 Explanation: Option B gives execute permission while removing write permission for group and others, satisfying the policy. Option A allows group write. Option C removes execute for owner. Option D removes write for owner as well, which may be too restrictive. Correct attribute configuration ensures executables remain immutable for regular users.

🔗 Related Topics (MCQs)