April 21, 2021

CGI Perl Interview Question and Answers

CGI Perl Interview Question and Answers

Perl Scripting Online Training1. What is CGI?

ANS: The Common Gateway Interface, or CGI, is a standard for external gateway programs to interface with information servers such as HTTP servers.

A plain HTML document that the Web daemon retrieves is static, which means it exists in a constant state: a text file that doesn’t change.

A CGI program, on the other hand, is executed in real-time, so that it
can output dynamic information.

2. Difference between CGI and JAVA?

ANS: CGI is a protocol for running programs on a WWW server. Whilst JAVA can also be used for that, and even has a standardized API (the servlet, which is indeed an alternative to CGI), the major role of JAVA on the Web is for client side programming (the applet).

3. Is CGI a script or a program?

ANS: The distinction is semantic. Traditionally, compiled executables(binaries) are called programs, and interpreted programs are usually called scripts. In the context of CGI, the distinction has become even more blurred than before. The words are often used interchangeable.

4. What is the meaning of rigging?

ANS: Rigging is use for if we want to give animation for any object or character then we apply to character or object internal  bone setting(like our bones) that is called rigging. When apply rigging, then we can give proper animation.

5. When do I need to use CGI?

ANS: There are innumerable caveats to this answer, but basically any
Webpage containing a form will require a CGI script or program
to process the form inputs.

6. What is the difference between object oriented and structured oriented programming?

ANS: Object Oriented means programme will be their in terms of Class and Object relationship will be their.

* Structured Oriented Means programme will be their in terms of multiple Functions.

7. Can I do HTTP authentication using CGI?

ANS: Yes, we can use CGI to trigger the browser’s standard Username/Password dialogue.

8. How can I run my CGI program ‘live’ in a debugger?

ANS: At First, in the CGI code, at it’s start, add “sleep (30);” This will cause the CGI to do nothing for thirty seconds (you may need to adjust this time). Compile the CGI with debuging info (“-g” in gcc) and install the CGI as normal. Next, using your web browser, activate the CGI. It will of course just sit there doing nothing. While it is ‘sleeping’, find it’s PID(ps -a | grep <cgi name>).

Load your debugger and attach to that PID(“attach <pid>” in gdb). You will also need to tell it where to find the symbol definitions (“symbol-file <cgi>” in gdb). Then set a break point after the invocation of the sleep function and you are ready to debug. Do be aware that your browser will eventually timeout if it doesn’t receive anything.

9. How can I stop my CGI script reading and writing files as “nobody”?

ANS: CGI scripts are run by the HTTPD, and therefore by the UID of the HTTPD process, which is (by convention) usually a special user “nobody”.

10. What is a CGI bin directory?

ANS: A CGI bin directory is a special directory on the server where CGI scripts are allowed to be executed. Most servers are configured to only allow CGI scripts to be executed from one location, in order to minimize security holes. Poorly written scripts can wreak havoc on a server if allowed to run unchecked – most system admins will want to verify that the script is not doing anything malicious before letting you run it.

For Best Perl Scripting Online Training in India please visit http://www.revanthtechnologies.com