Bird
Raised Fist0
Operating Systemsknowledge~10 mins

Directory structure (single-level, two-level, tree, acyclic graph) in Operating Systems - Interactive Code Practice

Choose your learning style10 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to name the directory structure with only one directory containing all files.

Operating Systems
The directory structure with only one directory containing all files is called a [1] directory structure.
Drag options to blanks, or click blank then click option'
Atree
Btwo-level
Csingle-level
Dacyclic graph
Attempts:
3 left
💡 Hint
Common Mistakes
Confusing single-level with two-level directory structure.
2fill in blank
medium

Complete the code to identify the directory structure where each user has a separate directory under the root.

Operating Systems
The directory structure where each user has a separate directory under the root is called a [1] directory structure.
Drag options to blanks, or click blank then click option'
Asingle-level
Btwo-level
Ctree
Dacyclic graph
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing up two-level with tree directory structures.
3fill in blank
hard

Fix the error in the statement about directory structures: "A {{BLANK_1}} directory structure allows directories to have multiple parents."

Operating Systems
A [1] directory structure allows directories to have multiple parents.
Drag options to blanks, or click blank then click option'
Asingle-level
Btwo-level
Ctree
Dacyclic graph
Attempts:
3 left
💡 Hint
Common Mistakes
Confusing tree structure with acyclic graph structure.
4fill in blank
hard

Fill both blanks to describe the directory structure where directories form a hierarchy with a single root and no cycles.

Operating Systems
A [1] directory structure forms a hierarchy with a single root and no cycles, unlike an [2] graph which allows multiple parents.
Drag options to blanks, or click blank then click option'
Atree
Bsingle-level
Cacyclic graph
Dtwo-level
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing up tree and acyclic graph terms.
5fill in blank
hard

Fill all three blanks to complete the description of directory structures: "In a {{BLANK_1}} directory, all files are in one directory; in a {{BLANK_2}} directory, users have separate directories; and in a {{BLANK_3}} directory, directories can share subdirectories without cycles."

Operating Systems
In a [1] directory, all files are in one directory; in a [2] directory, users have separate directories; and in a [3] directory, directories can share subdirectories without cycles.
Drag options to blanks, or click blank then click option'
Asingle-level
Btwo-level
Cacyclic graph
Dtree
Attempts:
3 left
💡 Hint
Common Mistakes
Confusing tree with acyclic graph in sharing subdirectories.

Practice

(1/5)
1. Which directory structure allows all files to be stored in a single folder without any subfolders?
easy
A. Acyclic graph directory
B. Two-level directory structure
C. Tree-structured directory
D. Single-level directory structure

Solution

  1. Step 1: Understand single-level directory

    In a single-level directory, all files are stored in one folder without any subfolders or hierarchy.
  2. Step 2: Compare with other structures

    Two-level and tree structures have multiple folders or subfolders, and acyclic graph allows shared folders, so they are not single-level.
  3. Final Answer:

    Single-level directory structure -> Option D
  4. Quick Check:

    Single-level = all files in one folder [OK]
Hint: Single-level means one folder only, no subfolders [OK]
Common Mistakes:
  • Confusing single-level with two-level structure
  • Thinking tree structure is single-level
  • Assuming acyclic graph is single-level
2. Which of the following correctly describes a two-level directory structure?
easy
A. All files are stored in one directory without subdirectories
B. Directories form a hierarchy with multiple levels
C. Each user has a separate directory under the root directory
D. Directories can share subdirectories forming cycles

Solution

  1. Step 1: Recall two-level directory structure

    In two-level structure, each user has their own directory under a common root directory.
  2. Step 2: Eliminate incorrect options

    All files are stored in one directory without subdirectories describes single-level, B describes tree structure, and D describes cyclic graphs which are not allowed.
  3. Final Answer:

    Each user has a separate directory under the root directory -> Option C
  4. Quick Check:

    Two-level = user directories under root [OK]
Hint: Two-level means root plus user folders only [OK]
Common Mistakes:
  • Mixing two-level with single-level structure
  • Thinking two-level allows deep folder trees
  • Confusing acyclic graph with two-level
3. Consider a tree-structured directory where the root has two subdirectories: Docs and Images. Docs contains files a.txt and b.txt. Images contains pic1.jpg. How many total files are in the directory tree?
medium
A. 3
B. 2
C. 4
D. 1

Solution

  1. Step 1: Count files in Docs directory

    Docs contains two files: a.txt and b.txt, so count is 2.
  2. Step 2: Count files in Images directory

    Images contains one file: pic1.jpg, so count is 1.
  3. Step 3: Add all files

    Total files = 2 (Docs) + 1 (Images) = 3 files.
  4. Final Answer:

    3 -> Option A
  5. Quick Check:

    2 + 1 = 3 files [OK]
Hint: Add files in all subdirectories for total count [OK]
Common Mistakes:
  • Counting directories as files
  • Forgetting to add files from all subdirectories
  • Miscounting number of files in Docs
4. A directory structure is supposed to be a tree, but a user accidentally creates a cycle by linking a subdirectory back to its ancestor. What problem does this cause?
medium
A. The directory structure is no longer acyclic, causing infinite loops
B. Files become inaccessible due to missing links
C. The directory becomes single-level
D. The directory structure automatically corrects itself

Solution

  1. Step 1: Understand tree and cycle concepts

    A tree directory must not have cycles; linking back creates a cycle.
  2. Step 2: Identify consequences of cycle

    Cycle causes infinite loops when traversing directories, breaking acyclic property.
  3. Final Answer:

    The directory structure is no longer acyclic, causing infinite loops -> Option A
  4. Quick Check:

    Cycle breaks acyclic tree causing infinite loops [OK]
Hint: Cycles cause infinite loops in directory traversal [OK]
Common Mistakes:
  • Thinking files become inaccessible immediately
  • Assuming directory fixes cycle automatically
  • Confusing cycle with single-level structure
5. In an acyclic graph directory structure, a file can appear in multiple directories by sharing links. Which advantage does this provide compared to a tree structure?
hard
A. It prevents any file from being deleted accidentally
B. It reduces disk space by storing one copy with multiple references
C. It forces all files to be stored in a single directory
D. It creates cycles to speed up file access

Solution

  1. Step 1: Understand acyclic graph directory

    Acyclic graph allows multiple directories to share the same file via links, avoiding duplicates.
  2. Step 2: Identify advantage over tree structure

    This sharing reduces disk space since only one copy of the file is stored with multiple references.
  3. Step 3: Eliminate incorrect options

    Files can still be deleted, it does not force single directory storage, and cycles are not allowed.
  4. Final Answer:

    It reduces disk space by storing one copy with multiple references -> Option B
  5. Quick Check:

    Shared links save space in acyclic graph [OK]
Hint: Shared links save space by avoiding duplicate files [OK]
Common Mistakes:
  • Thinking acyclic graph creates cycles
  • Assuming files cannot be deleted
  • Confusing with single-level directory
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard