スーパマーケット N 町店の広報スタッフである D さんは,本社の Web サイト担当の E さんと協力して N 町店紹介のページを作成している。このたび,N 町店紹介のページのアクセス数増加を目的として,Web サイトで懸賞付きアンケートを実施することになった。D さんは,図 1 のような懸賞ページ案を作成し,E さんに相談した。 D さんは,懸賞ページ案を確認した E さんから,次のようなアドバイスと指示を受けた。 〔デザインに関する主なアドバイス〕 (1) マウスでの入力など,操作性の良い入力方法を採用する。 (2) 回答などの操作がしやすい順序に,入力領域やボタンを配置する。 (3) 入力の誤りを防ぐため,データ形式に応じた入力フォームを利用する。 〔作成に関する主な指示〕 (1) 懸賞ページは HTML 形式の ank01.html というファイル名で作成し,Web サーバの指定されたディレクトリに転送する。 (2) ファイルを指定する場合は,相対パスで記述する。 (3) 使用する写真のファイルサイズは,1 枚当たり 200k バイト以下とする。 Dさんは,Eさんから,完成したank01.htmlをWebサーバのnsitenディレクトリに,懸賞ページで使用した写真などのデータをtgazouディレクトリに転送して公開するよう指示された。そこで,写真が懸賞ページに正しく表示されるように,ank01.htmlに写真を表示するタグを記述した。 Webサーバのディレクトリ構成とファイルの指定方法が次のとおりのとき,JPEG形式に変換した写真1(ファイル名s01.jpeg)を表示するタグのaに入る記述はどれか。ここで,imgタグは,src="ファイル名"で指定したファイル名の画像を表示する。 〔Webサーバのディレクトリ構成〕 ルート └ … - www ─── main ─┬─ tenpo ─── nsiten └─ tgazou 〔ファイルの指定方法〕 (1) ファイルは,“ディレクトリ名¥…¥ディレクトリ名¥ファイル名”のように,経路上のディレクトリを順に“¥”で区切って並べた後に“¥”とファイル名を指定する。 (2) カレントディレクトリは“.”で表す。 (3) 1階層上のディレクトリは“..”で表す。 (4) 始まりが“¥”のときは,左端にルートディレクトリが省略されているものとする。 (5) 始まりが“¥”,“.”,“..”のいずれでもないときは,左端にカレントディレクトリ配下であることを示す“.¥”が省略されているものとする。 〔写真1を表示するタグ〕 <img src=" a ¥s01.jpeg " … >
平成23年度 特別試験 ITパスポート試験 問100
This question's explanation and your answers so far.
問 100
- ア
正解 A relative path is based on the nsiten directory (the current directory), where ank01.html, the file in which the tag is written, is located. In the structure shown in the figure, tenpo and tgazou sit side by side directly under main, and nsiten is directly under tenpo. Therefore, to go from nsiten to tgazou, where the photo is, you first move up one level to tenpo with “..”, then up one more level to main with another “..”, and from there go down into tgazou, which is directly under main. Writing this route with “¥” as the separator, following specification rules (1) and (3), gives ..¥..¥tgazou, and adding ¥s01.jpeg after it forms the complete relative path src="..¥..¥tgazou¥s01.jpeg". Thus the description that goes into a is ア.
Incorrectイ
..¥main¥tgazou means going up one level from the current directory nsiten to tenpo with “..”, and then looking for main directly under tenpo. In the figure, however, main is the parent of tenpo, not its child, and there is no directory named main under tenpo, so this route cannot be followed. The mistake is that it goes up one level too few.
Incorrectウ
By specification rule (2), .¥tgazou points to a tgazou directly under the current directory (that is, nsiten). But tgazou is directly under main and does not exist under nsiten, so the photo cannot be found. This choice correctly grasps that a relative path is based on the current directory, but it is missing the “..” that goes up a level.
Incorrectエ
By specification rule (4), ¥www¥main¥tgazou is an absolute path whose leading root directory is omitted, that is, it specifies that www lies directly under the root. In the figure, however, a “…” is drawn between the root and www, showing that other directories lie in between. Since www is not necessarily directly under the root, this absolute path does not lead correctly to the target.
- A relative path is based on the current directory (here nsiten, where the HTML file is placed); “.” means the current directory and “..” means one level up. Build the route by first going up with “..” to the common parent (main) shared with the target directory, and then going back down.
- A specification that begins with “¥” is an absolute path from the root. When the figure shows a “…” between the root and www, intermediate levels have been omitted, so an absolute path written as if starting directly under the root does not hold.