CGI Programs - Quiz Explanation

The correct answers are indicated below, along with text that explains the correct answers.
 
1. What protocol is used for the Web client to talk to the server?
Please select the best answer.
  A. HTML
  B. HTTP
  C. CGI
  D. Perl
  The correct answer is B.
HTTP is the HyperText Transfer Protocol. It is the protocol used on the Internet to request and send Web pages.


2. What are some important characteristics of the HTTP protocol?
1. The client always initiates a connection.
2. The server always initiates a connection.
3. Connections are persistent.
4. Connections are not persistent.
5. Requests always precede responses.
6. Requests and responses may occur in any order.
7. HTML is the only possible content of a response.
8. HTML is one of many possible contents of a response.
Please select the best answer.
  A. 1, 4, 5, and 8
  B. 2, 4, 6, and 8
  C. 1, 3, 5 and 7
  D. 5 and 8
  The correct answer is A.
The HTTP connection is always initiated by the client (browser). HTTP connections end after the server has responded to the client (yes, HTTP version 1.1 has provision for persistent connections, but they will not be possible in many circumstances and they cannot be counted on). A server cannot send a response to the client without first getting a corresponding request from the client. The server may respond with HTML, an image, some other multimedia, in fact, it can be any content at all.

3. What is the purpose of a MIME header in a CGI response?
Please select the best answer.
  A. to initiate the connection with the client
  B. to specify the format of the output
  C. to send a mail message to the Webmaster
  D. to combine a GIF and JPEG image
  The correct answer is B.
The purpose of a MIME header in a CGI response is to specify the format of the output. The server's response can be any type of content at all. The "content-type" MIME header tells the client what sort of content it is so that the client can display it appropriately.