IPA IP 2022 Question 90

Topic: Software

A question IPA Japan published in 令和4年度 ITパスポート試験 公開問題 問90, translated into English. ITPEC is based on the same exams.

There is a file system that can be represented by a tree structure in which directories or files correspond to nodes. When it is represented as shown in the figure with the root directory as the root, which of the following is the most appropriate combination of what corresponds to a node, which is an intermediate node, and to a leaf, which is an end node? Here, empty directories are allowed.

RootLeafNodeLeafLeaf
OptionNodeLeaf

Explanation

Node: directory; leaf: directory or file — only a directory can contain anything, but a directory may also be empty.

In a hierarchical file system, a node with children holds other directories or files, and only a directory can do that, so every node in the middle of the tree is a directory. A leaf (end node) is anything with no children: every file is a leaf, and since empty directories are allowed, an empty directory is a leaf too.

Answer (a)

Why not others:

  • •(b) — leaves out empty directories, which the question allows and which have no children
  • •(c) and (d) — a file cannot contain other files or directories, so it can never be a node in the middle of the tree

Key rule: In a file-system tree, nodes with children are always directories; leaves are files or empty directories.

Software · AI-written, may contain errors

This question comes from the past questions IPA Japan publishes, translated into English by ITPEC Practice. ITPEC Practice is an independent study tool and is not affiliated with IPA or ITPEC. See the original paper (PDF) or Report an issue.