ITPEC IP April 2026 Question 20

Topic: SoftwareAlso asked in Spring 2020, April 2022 and October 2024

When directories d1 and d2 are placed on a web server as shown in the figure, which of the following descriptions specifies the reference of the web page file f2.html on directory d2 from the web page file f1.html on directory d1 (current directory)? Here, the reference method of files is shown as below.

[Reference method](1)A file is referenced as “directory name /.../ directory name / file name”, where the directory names on the path are listed and separated with “ / ” in sequence, followed by a “ / ” and the file name.(2)The current directory is represented by “.”.(3)The directory one (1) level above is represented by “..”.(4)When a reference begins with a “ / ”, it is assumed that the root directory is omitted from the beginning of the reference.
rootd1d2f1.htmlf2.html

Explanation

../d2/f2.html — go up from d1 to the root with “..”, then down into d2.

The current directory is d1, and d1 and d2 are siblings under the root. By rule (3), .. moves one level up, from d1 to the root. By rule (1), the path then names the directory d2 and the file f2.html, separated with a slash. The reference is ../d2/f2.html. The form starting from the root by rule (4), /d2/f2.html, is not offered.

Answer (c)

Why not others:

  • •(a) — ./d2/f2.html starts from the current directory d1 and looks for a d2 inside d1, which does not exist
  • •(b) — ./f2.html looks for f2.html in d1 itself, which holds only f1.html
  • •(d) — d2/../f2.html goes down into a d2 below d1 and straight back up to d1, so it still means f2.html in d1

Key rule: In a relative path . is the current directory and .. its parent; to reach a sibling directory, go up with .. and then down by name.

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.