🎓 BookMCQ
← Back to 11. File System Interface

📝 Acyclic graph file directories in Operating System (26 MCQs)

Sharing Files Through Directed Acyclic Relationships

An acyclic graph directory structure extends tree-based organisation by allowing a file or subdirectory to be referenced from multiple locations without creating directed cycles. This approach supports shared files and common directory structures while maintaining a controlled navigation model. The operating system manages links, reference information, and deletion rules to ensure shared objects remain accessible without introducing infinite traversal paths.

Why Multiple Directory References Are Useful

Tree structures require each ordinary directory entry to belong to one parent, which can force duplicated files or directory trees when several users need the same information. Acyclic graph organisation permits shared references and reduces unnecessary duplication. However, multiple references complicate deletion because removing one pathname should not destroy an object still referenced elsewhere.

Link Management and Reference Counting

The file system creates another reference to an existing object through a suitable link mechanism. When a pathname is resolved, the operating system follows the reference to the shared file or directory. Reference counts or equivalent metadata can track how many links remain. When a link is removed, the underlying object is reclaimed only when no required references remain and other open references no longer depend on it.

Sharing One Document Between Two Directories

Suppose /home/ali/projects and /home/sara/projects both contain a reference to a shared specification file. Both users can access the same underlying object through different paths. Updating the shared file changes the common contents rather than creating two independent copies, provided the references represent genuine shared access to that object.

Reduced Duplication and Link-Management Complexity

Acyclic graph directories support file sharing, save storage space, and allow common subdirectories to appear in multiple locations. Their management requires careful handling of reference counts, permissions, and deletion. Shared writable objects may also introduce consistency and security concerns. The acyclic restriction simplifies traversal by preventing cycles that could otherwise produce infinite directory searches.

Common Errors About Acyclic Graphs

'An acyclic graph allows unlimited circular directory links' is incorrect because cycles are specifically excluded. 'Deleting one reference always deletes the shared file' is incorrect because other references may remain. 'Every pathname identifies an independent physical copy' is incorrect because multiple directory entries can reference the same underlying object.

Exam Focus: Link Counts and Safe Deletion

Identify how multiple directory entries can reference one file or subdirectory without forming a cycle. Trace link creation, traversal, and deletion. Explain why reference counting helps prevent premature object removal. Compare acyclic graphs with tree structures and general graphs, focusing on shared references, deletion complexity, and cycle prevention.

Key Terms of Acyclic Graph Directories

  • Acyclic graph - Directed structure without cycles.
  • Shared reference - Multiple paths to one object.
  • Link count - Number of directory references.
  • Hard link - Additional name for an inode.
  • Cycle - Path returning to an earlier node.
  • Reference management - Tracks shared-object usage.
6
Easy
14
Medium
6
Hard

📝 All Acyclic graph file directories in Operating System MCQs

Q1. Which file extension typically indicates a Microsoft Word document?

A..doc ✅
B..exe
C..jpg
D..mp3
💡 Difficulty: easy | ✅ Correct: A

📖 Explanation: The .doc extension is historically associated with Microsoft Word because the program registers that suffix as its native format. When a user double‑clicks a file ending in .doc, the operating system looks up the association and launches Word to display the contents. The other choices represent executable binaries (.exe), image files (.jpg), and audio files (.mp3), none of which Word uses for its native documents. Understanding this mapping helps users name files correctly and ensures the right application opens them.

Q2. What extension is commonly used for compiled Java bytecode files?

A..class ✅
B..java
C..jar
D..exe
💡 Difficulty: easy | ✅ Correct: A

📖 Explanation: Compiled Java source code is stored in .class files, each containing bytecode that the Java Virtual Machine can interpret. The .java suffix denotes source files, while .jar is a packaged archive of many .class files and resources. An .exe is a Windows executable and unrelated to Java. Recognizing the .class extension lets developers and tools locate the correct binary output after compilation.

Q3. Which extension denotes a Unix shell script that can be executed directly?

A..sh ✅
B..txt
C..docx
D..pdf
💡 Difficulty: easy | ✅ Correct: A

📖 Explanation: The .sh suffix signals a plain‑text script written for a Unix shell such as Bash or sh. When the file has execute permission, the kernel can invoke the interpreter to run the commands inside. The other extensions represent a generic text file (.txt), a Word document (.docx), and a Portable Document Format file (.pdf), none of which the shell can execute as scripts.

Q4. Why does the operating system rely on file extensions to determine how to open a file?

A.It stores the file's binary data
B.Extensions act as hints that map to file type handlers ✅
C.Extensions encrypt the file content
D.Extensions define the file size
💡 Difficulty: easy | ✅ Correct: B

📖 Explanation: Extensions serve as concise identifiers that the OS uses to look up which program or system component is registered to handle that type. By matching .pdf to a PDF viewer or .exe to the executable loader, the system can launch the appropriate handler automatically. The other statements describe unrelated properties: binary data is stored regardless of name, encryption is a separate process, and size is unrelated to naming.

Q5. How do executable extensions like .exe and .com differ from script extensions like .sh in terms of content?

A.Executables contain machine code while scripts contain plain‑text commands
B.Executables are always larger than scripts ✅
C.Executables are encrypted
D.Scripts are compiled binaries
💡 Difficulty: easy | ✅ Correct: B

📖 Explanation: An executable file such as .exe or .com holds machine‑language instructions that the CPU can run directly after loading. In contrast, a .sh script is a readable text file containing commands that a shell interpreter parses and executes line by line. The size of a file does not guarantee its type, encryption is optional, and scripts are not compiled into binary form before execution.

Q6. What is the primary purpose of archive extensions such as .zip or .tar?

A.To compress a single file
B.To encrypt files
C.To combine multiple files into a single compressed package ✅
D.To convert files to binary format
💡 Difficulty: easy | ✅ Correct: C

📖 Explanation: Archive formats like .zip and .tar allow users to bundle several files and directories into one container, often applying compression to reduce total size. This simplifies distribution, backup, and storage. Encryption may be an optional feature, but the core function is grouping and optionally compressing data. Converting to binary is unrelated; many archive formats retain the original file types inside the container.

Q7. If a file named report has no extension, how might an application determine its type?

A.By checking the file size
B.By reading the first few bytes for a magic number
C.By guessing based on the filename
D.By ignoring the file ✅
💡 Difficulty: medium | ✅ Correct: D

📖 Explanation: Many programs inspect the file header—often called a magic number—to identify the format regardless of the name. For example, a PDF begins with %PDF, and a PNG starts with \x89PNG. Size alone gives no reliable clue, and guessing based on the name is error‑prone. Ignoring the file would prevent any processing, so header analysis is the most robust method.

Q8. Why can the same file extension be associated with different file types on different operating systems?

A.Because each OS maintains its own file‑association registry
B.Because extensions change meaning over time ✅
C.Because the file content changes automatically
D.Because extensions are encrypted differently
💡 Difficulty: medium | ✅ Correct: B

📖 Explanation: Operating systems keep separate tables that map extensions to applications or handlers. Windows might open .txt with Notepad, while a Linux desktop could open the same .txt with Gedit. The extension itself does not enforce a single meaning; the association is defined by the OS configuration. Extensions do not mutate, and encryption does not affect the suffix.

Q9. Why might a developer choose to omit extensions from source files in a project that uses a build system?

A.Because extensions are unnecessary when the build system explicitly knows file roles
B.Because extensions cause compilation errors
C.Because extensions increase file size ✅
D.Because extensions are insecure
💡 Difficulty: medium | ✅ Correct: C

📖 Explanation: Modern build tools can be configured with patterns or explicit lists that identify source files, object files, and headers without relying on suffixes. By omitting extensions, developers avoid accidental misclassification and can rename files without breaking the build. Extensions do not cause compilation errors, they add negligible size, and they are not a security risk in themselves.

Q10. In the context of file type handling, what is the role of MIME types compared to filename extensions?

A.MIME types provide a standardized way to describe content independent of extensions ✅
B.Extensions are a subset of MIME types
C.Extensions override MIME types
D.There is no relationship between them
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: MIME (Multipurpose Internet Mail Extensions) describe the nature of a file's data—such as text/plain or image/jpeg—allowing applications and web browsers to process content correctly regardless of its name. While extensions are a convenient shortcut for local systems, MIME types are the protocol‑level description used in HTTP and email. Neither supersedes the other; they complement each other for robust identification.

Q11. Analyze how the use of ambiguous extensions (e.g., .bin) can lead to security vulnerabilities when files are executed.

A.Ambiguous extensions prevent users from seeing file size
B.Ambiguous extensions may cause the OS to treat unknown files as safe
C.Ambiguous extensions can be misinterpreted as trusted binaries allowing malicious code execution
D.Ambiguous extensions automatically encrypt files ✅
💡 Difficulty: hard | ✅ Correct: D

📖 Explanation: An extension like .bin offers no clear indication of purpose; a user might assume it is a harmless data file, while the OS may load it as an executable if the execute bit is set. Attackers exploit this ambiguity by disguising malware, leading users to run harmful code unintentionally. The other options describe unrelated effects; size visibility and automatic encryption are not inherent to the extension.

Q12. Discuss the impact of case sensitivity on file extensions in cross‑platform development.

A.Case sensitivity has no effect because all systems treat extensions the same
B.Case sensitivity can cause mismatches when a file named MyFile.TXT is accessed as myfile.txt on a case‑insensitive system ✅
C.Case sensitivity only affects directory names
D.Not relevant to extensions
💡 Difficulty: hard | ✅ Correct: B

📖 Explanation: Unix‑like systems treat file names, including extensions, as case‑sensitive, so MyFile.TXT and myfile.txt are distinct files. Windows, however, ignores case, allowing both names to refer to the same file. When code or scripts assume a particular case, they may fail on a case‑sensitive platform, leading to file‑not‑found errors. Directory name sensitivity is a separate issue, and extensions themselves are still part of the name.

Q13. Evaluate the consequences of relying solely on extensions for file type detection in a system that supports plug‑ins.

A.Plug‑ins can override extensions
B.Plug‑ins ignore file content
C.Plug‑ins may misinterpret files if extensions are misleading ✅
D.Plug‑ins require extensions to function
💡 Difficulty: hard | ✅ Correct: C

📖 Explanation: Plug‑ins often inspect the actual data inside a file to determine compatibility. If a system only checks extensions, a malicious or corrupted file with a trusted suffix (e.g., .dll) could be loaded, bypassing content validation and exposing the host to exploits. While plug‑ins can be designed to respect extensions, they generally perform deeper analysis, making sole reliance on suffixes unsafe. The other statements misrepresent plug‑in behavior.

Q14. How does the concept of an acyclic‑graph directory structure relate to the avoidance of circular references in file systems?

A.It ensures that directories can reference each other without limits
B.It guarantees that no path can return to a previously visited directory ✅
C.It allows symbolic links to create loops
D.It has no effect on directory traversal
💡 Difficulty: hard | ✅ Correct: B

📖 Explanation: An acyclic‑graph (DAG) model means that following directory links—whether real directories or symbolic links—never leads back to a node already visited, thereby preventing infinite loops during traversal. This property is essential for utilities like recursive copy or search, which would otherwise get stuck. Allowing cycles would break many algorithms, while the DAG constraint does not prohibit legitimate hierarchical relationships.

Q15. A user attempts to run a script named backup.sh but the OS does not recognize it as executable. Which step should they take to resolve the issue?

A.Rename the file to backup.exe
B.Add execute permission to the file ✅
C.Change the extension to .txt
D.Move the file to the system folder
💡 Difficulty: medium | ✅ Correct: B

📖 Explanation: On Unix‑like systems, a script must have the executable bit set (e.g., using chmod +x backup.sh) for the kernel to treat it as a runnable program. Changing the suffix to .exe or .txt does not affect execution rights, and moving the file to a system directory does not automatically grant permission. Setting the correct permission enables the OS to invoke the appropriate interpreter.

Q16. In a typical C development workflow, which extension indicates an object file produced after compilation?

A..c
B..h
C..o ✅
D..exe
💡 Difficulty: medium | ✅ Correct: C

📖 Explanation: After the compiler processes a source file (e.g., foo.c), it generates an intermediate object file with the .o extension containing machine code that is not yet linked. Header files use .h, source files use .c, and final executables use .exe on Windows. Recognizing .o files helps developers locate compiled units and manage linking steps efficiently.

Q17. A user wants to bundle several documents into a single file for easy transfer. Which extension should they choose?

A..zip ✅
B..exe
C..docx
D..mp4
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: The .zip extension represents a widely supported archive format that can contain multiple files and directories, optionally compressing them to reduce size. This makes it ideal for transferring a collection of documents. An .exe is an executable program, .docx is a single Word document, and .mp4 is a video file, none of which serve the bundling purpose.

Q18. A multimedia player cannot open a file named movie.mp4. Which of the following is the most likely cause?

A.The file is corrupted
B.The player lacks the required codec
C.The .mp4 extension is reserved for audio only
D.The operating system blocks .mp4 files ✅
💡 Difficulty: medium | ✅ Correct: D

📖 Explanation: Most playback failures stem from missing codecs—the software components that decode the video and audio streams inside the container. Even though the .mp4 extension signals a standard format, without the appropriate codec the player cannot interpret the data. File corruption is possible but less common, and the extension does not restrict content type. Operating system blocks are rare for media files.

Q19. A web server serves a file with a .pdf extension, but the file actually contains an image. What problem does this cause for clients?

A.Clients will display the image correctly
B.Clients will receive a MIME type mismatch error ✅
C.Clients will automatically download the file
D.Clients will ignore the file entirely
💡 Difficulty: medium | ✅ Correct: B

📖 Explanation: Web browsers rely on the MIME type sent by the server (e.g., application/pdf) to decide how to handle a resource. If the content is actually an image (e.g., image/png) but the server advertises application/pdf, the browser may fail to render it, showing an error or prompting a download. The mismatch does not cause automatic correct display, nor does it make the client ignore the resource.

Q20. A developer wants their Java program to open only files with a .java extension. Which approach best ensures this restriction?

A.Check the file name string for the .java suffix ✅
B.Read the first few bytes to verify Java source syntax
C.Ignore extensions and rely on OS association
D.Prompt the user to select any file
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: The simplest and most reliable method is to examine the filename and confirm it ends with the exact .java suffix before opening it. This prevents accidental processing of other file types. While reading the file header could provide additional safety, Java source files have no unique magic number, making suffix checking the most straightforward solution.

Q21. A backup script must skip files larger than 100 MB. Which command correctly filters files by size on a Unix system?

A.find . -size +100k
B.find . -size +100M ✅
C.find . -size -100M
D.find . -size 100M
💡 Difficulty: medium | ✅ Correct: B

📖 Explanation: The find utility uses the -size test, where + indicates 'greater than' and the unit M stands for megabytes. Thus, find . -size +100M selects files larger than 100 MB, allowing the script to exclude them from the backup. The other options either use kilobytes (k) or represent sizes less than the threshold, which would not achieve the intended filter.

Q22. A user renames a file from report.docx to report.txt. What is the most likely outcome when opening the file in a word processor?

A.The file will be corrupted
B.The word processor will still open it correctly ✅
C.The file will be unreadable because its content does not match the extension
D.The operating system will delete the file
💡 Difficulty: medium | ✅ Correct: B

📖 Explanation: Most modern word processors examine the file's internal structure rather than relying solely on the extension. A .docx file contains a ZIP archive with XML parts, which the application can still recognize even if named .txt. Therefore, the document will usually open correctly, though the new name may cause confusion for users expecting plain text. The file is not corrupted merely by renaming.

Q23. A Linux installer includes a shared library with a .so extension. What must the system do before programs can use it?

A.Add the library path to the PATH variable
B.Load the library at runtime using the dynamic linker ✅
C.Mark the file as executable
D.Convert the file to a .dll extension
💡 Difficulty: medium | ✅ Correct: B

📖 Explanation: Shared object files (.so) are loaded by the dynamic linker (ld.so) when a program starts or when dlopen is called. The system does not treat them as executables, so they need not be marked executable, nor does the PATH variable apply (it is for executables). Converting to .dll would break compatibility on Linux.

Q24. An administrator wants to enforce that only files with recognized extensions can be executed. Which policy best achieves this goal?

A.Disable all execute permissions on the filesystem
B.Use an AppArmor profile that restricts execution by path
C.Configure a whitelist of allowed extensions in the kernel
D.Require users to rename files before execution ✅
💡 Difficulty: medium | ✅ Correct: D

📖 Explanation: A whitelist of allowed extensions (e.g., .exe, .sh, .bin) can be enforced via security modules that check the suffix before permitting execution. This approach directly addresses the requirement without broadly disabling execution or relying on path‑based restrictions. AppArmor focuses on program behavior, not file extensions, and disabling execute bits would prevent all legitimate binaries from running.

Q25. A file system uses an acyclic‑graph directory structure to avoid loops. A user attempts to create a symbolic link that would introduce a cycle. What should the system do?

A.Allow the link and ignore the cycle
B.Prevent the creation of the link ✅
C.Convert the link to a hard link
D.Create the link but issue a warning
💡 Difficulty: hard | ✅ Correct: B

📖 Explanation: To preserve the DAG property, the file system must reject any operation that would create a cycle, such as a symbolic link pointing to an ancestor directory. Allowing the link would break traversal algorithms, while converting to a hard link is impossible for directories on most systems. Issuing a warning without preventing the cycle would still permit the problematic structure.

Q26. A multimedia application decides to use MIME type detection instead of extension checking to support .mp3 and .wav files. Which advantage does this approach provide?

A.Faster file opening
B.Better compatibility across incorrectly named files ✅
C.Reduced file size
D.Automatic codec selection
💡 Difficulty: hard | ✅ Correct: B

📖 Explanation: MIME type detection examines the actual data inside a file, allowing the application to correctly identify audio streams even if the filename extension is wrong or missing. This improves compatibility and user experience. While it may aid in selecting codecs, the primary benefit is handling misnamed files. It does not inherently affect opening speed or file size.

🔗 Related Topics (MCQs)