Skip to content

平成24年度 春期 ITパスポート試験 問55

This question's explanation and your answers so far.

問55
頻出度★☆☆

Web サーバでクライアントからの要求に応じて適切なプログラムを動作させるための仕組みに CGI がある。CGI を経由して実行されるプログラムを作成できるスクリプト言語はどれか。

出典 平成24年度 春期 ITパスポート試験 問55
解説

問 55

  • Incorrectア

    CASL is an assembly language for COMET, a virtual computer defined for the Information Technology Engineers Examination, and it is a teaching language used in the exam to learn the basic principles of how programs work. There is no implementation of it that runs on a real web server, and it is not a scripting language at all but an assembly language whose instructions correspond one to one with machine language, so it is not a language for writing programs called via CGI.

  • Incorrectイ

    Fortran is an old programming language created for numerical and scientific computation, and it is a compiled language: the source code is compiled into an executable form before it is run. It suits matrix operations and the writing of mathematical formulas, but it is not a scripting language that executes source code directly, statement by statement, so it does not match what this question asks for, namely a scripting language that can be used to write a program executed via CGI.

  • ウ

    正解 The correct answer is ウ, Perl. CGI (Common Gateway Interface) is an agreement, that is, an interface specification, by which a web server that has received a request from a client starts an external program on the server to do the processing and returns what that program writes to standard output to the client as a response such as HTML. CGI itself is not a programming language but a rule for passing data between the server and an external program, so any language that can do input and output according to that rule may be used to write the program. In practice, however, the work is mainly string processing such as parsing request parameters and assembling response text, so a scripting language that needs no compilation and can be rewritten easily is used. Perl is very strong at text processing with regular expressions and is an interpreted scripting language whose source code can be run directly with no compilation step beforehand, and it has long been used as the leading language for writing CGI programs. Therefore the scripting language that can be used to write a program executed via CGI is ウ, Perl. Besides Perl, PHP, Python, and Ruby are also used for the same purpose.

  • Incorrectエ

    SQL is a database language (query language) used to instruct a relational database to define tables, to search, add, update, and delete data, to set access rights, and so on. It is a dedicated language for sending queries to a database management system (DBMS), not a general-purpose scripting language for building a whole application out of conditional branches and loops. A CGI program may issue SQL to make use of a database, but the CGI program itself is not written in SQL.

ここがポイント
  • Definition of CGI: an interface specification that lets a web server start an external program on the server in response to a client request and return that program's output as the response. CGI is not a language but an agreement on how data is passed, and it is the classic mechanism for realizing dynamic web pages.
  • Sort the options by whether they are scripting languages: Perl, PHP, Python, Ruby, and JavaScript are scripting languages that run without compilation; Fortran and C are compiled languages; CASL is an assembly language; SQL is a database language. Once you have the classification of languages down, questions that ask about language names can be answered reliably.
用語

Your answers