ITPEC FE Morning October 2018 Question 19

Topic: Software

Multiple directories named A and B are managed in the structure shown in the figure below. Which of the following is the case in which the current directory is moved so that “\B\A\B” is the current directory? Here, the method for directory designation is as below, and → indicates the order of movement.

[Method for directory designation](1)A directory is referenced as “directory name\ ⋯ \directory name”, where the directories on the path are aligned and delimited with “\” in sequence, followed by “\” and the directory name.(2)The current directory is represented by “.” (a period).(3)The directory one (1) hierarchical level above is represented by “..” (two periods).(4)When a reference begins with a “\”, it is assumed that the root directory is omitted at the leftmost position of the reference.(5)When a reference does not start with “\”, “.”, or “..”, it is assumed that “.\” is omitted from the leftmost position of the reference.
RootABABABABABABAB

Explanation

\A → ..\B → .\A\B — the moves go to \A, up to the root and into \B, then down through A and B to reach \B\A\B.

A reference starting with \ starts at the root, .. goes up one level, . is the current directory, and a bare name is relative to the current directory.

  • •\A — from the root: current is \A
  • •..\B — up from \A to the root, then into B: current is \B
  • •.\A\B — from \B into A, then B: current is \B\A\B

Answer (a)

Why not others:

  • •(b) — \B, then .\B\A gives \B\B\A, and ..\B goes up to \B\B and ends at \B\B\B
  • •(c) — every step starts with \, so each is taken from the root and the last one leaves the current directory at \B
  • •(d) — \B\A, then ..\B goes up to \B and ends at \B\B, one level short

Key rule: Trace a path step by step from the current directory: a leading \ resets to the root, .. removes the last name, and each name adds one level.

Software · AI-written, may contain errors

This question comes from an official ITPEC past paper. ITPEC Practice is an independent study tool and is not affiliated with ITPEC. See the official FE past-paper collection or Report an issue.