CGI Scripts | Interview Questions & Answers


CGI is an acronym and it stands for Common Gateway Interface. Here are interview questions and answers on CGI scripts.

Q1. What is CGI Script?

Ans:

  • CGI stands for Common Gateway Interface.
  • It is a program that runs on the web server.
  • It helps in creating interactive web pages dynamically based on inputs given by the user.
  • CGI scripts can be written in any language.
  • Reside in a special directory in the web server typically “cgi-bin”.

Q2. Which computer language generally used to write CGI scripts? 

Ans: Remember the fact that CGI scripts can be written in any language. CGI scripts are generally written in:

  • Perl scripts
  • C/C++ programs
  • Unix Scripts

Q3. What does the REQUEST_METHOD environment variable specify?

Ans: It specifies whether we are using the GET or the POST method to send data to the server.

Q4. How does the form data get accessed in POST?

Ans: As a continuous stream of bytes from standard input, the number of bytes is stored in content length environment variable.

 

Q5. Why POST method more secure as compared to GET method?

Ans: In GET method, data sent as part of the URL. Hence, browser history and logs are stored in plaintext.  While in POST method, parameters are not stored in browser history and server logs.

Q6. How does the CGI scripts know that the form data as received has been URL encoded?

Ans: CONTENT_TYPE environment variable.

Q7. What is the function of UNIX command “finger”?

Ans: “finger” command is used to display following information:

  • Login name
  • Full name
  • Office location
  • Phone number
  • Login time
  • Idle time
  • Project files

Q8. List out the differences between an interpreted language and a compiled language.

Ans:

Interpreted LanguageCompiled Language
An interpreted language is parsed, interpreted and executed each time on run.First source code is compiled, then executed.
Javascript, PythonAssembler, COBOL, C/C++
Less efficientMore efficient
Interpreted language produces the result from programCompiler produces a program written in assembly language

Q9. How does the form data get accessed in GET, and in what form?

Ans: As a continuous stream of bytes from standard input, the number of bytes is stored in content length environment variable.

 

Q10. Is there any difference between CGI script and Java?

Ans:

CGIJAVA
The protocol used to run programs on web servers.Java is having its own standard APIs to, run the programs on web servers.
Not very scalable and secure.Object-oriented and secure.
Platform dependent.Platform independent.
No provision for separation between the presentation and business logic.Java defines the clear separation between presentation and business logic.


Subscribe us to receive more such articles updates in your email.

If you have any questions, feel free to ask in the comments section below. Nothing gives me greater joy than helping my readers!

Disclaimer: This tutorial is for educational purpose only. Individual is solely responsible for any illegal act.

1 thought on “CGI Scripts | Interview Questions & Answers”

Comments:

Your email address will not be published. Required fields are marked *

 
error: