M15) Navigating a directory tree
A program must read orders.csv from the data directory (folder) in Listing 1. You run the program from /course/exercises. This folder is its current working directory, the starting point for relative paths.
Paths use / to separate names. A leading / means the root directory, the top-level folder containing everything in this tree. All entries shown are ordinary files or directories in a fictional file system. No files need to exist on your computer.
Which pair gives an absolute path and a relative path that both identify the required file? Each choice gives the absolute path first and the relative path second.
/course/data/orders.csvanddata/orders.csv./course/data/orders.csvand../data/orders.csv./course/exercises/data/orders.csvand../data/orders.csv./data/orders.csvand../../data/orders.csv.
TipHint
- A path starting with
/is interpreted from the root. A path without a leading/is interpreted from the current working directory. ..moves to the parent directory; a directory name moves into that child directory. For example, from/lab/tasks,../inputidentifies/lab/input.- A filename at the end selects a file inside the preceding directory.