ITPEC IP April 2018 Question 17
The diagram below shows the directory structure for a part of a certain file system. Which of the following is the reference from the current directory D3 (indicated with an asterisk “∗”) to the file “a” under the directory D4 (indicated with an arrow)? Here, files are specified as follows:
Explanation
..\D2\D4\a — go up from D3 to the common parent D1, then down through D2 to D4.
D3 and D2 are both directly under D1, so one .. takes the reference from D3 to D1. From D1, the path goes down to D2, then D4, and ends with the file name: ..\D2\D4\a.
Answer (b)
Why not others:
- •(a) — the second
..moves above D1, where there is no D2 as shown - •(c) — it does not start with
\,.or.., so by rule (5) it is read as.\D1\D2\D4\a, a D1 under D3, which does not exist - •(d) — by rule (5) it is read as
.\D2\D4\a, looking for D2 under D3, but D2 is under D1
Key rule: A relative path climbs with .. to the nearest common ancestor of the current directory and the target, then names each directory on the way down.
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 IP past-paper collection or Report an issue.