Thursday, December 13, 2012

Computer Science interview questions and answers





CGI refers Common Gateway Interface. It is one of the earliest scripting languages .a CGI application runs entirely on server,and can be used to create dynamic web applications. CGI programs are small executables, that the server executes in response to a request from a browser.it is most common application in the forms processing.CGI allows you to create pages for users as individual requests come in , and you can customize pages to match that information.

Perl : it is a language with powerfull text-processing capabillities.Perl is undoubtedly the most common language used for scripting CGI.
i don't have any practical exposure abt perl that's why i m giving you some theoritical knowledge regarding this.the matter of the fact is that now CGI is loosing its market just because of its extra overhead on server and ISAPI is taking its place; well proceed further..

most of CGI is just standard Perl, with a few changes here and there .

CGIs process input differently than old Perl scripting does - and this is the only difference you'll find between the two. Once the CGI scripts process the input, it becomes data, which is treated pretty much the same way by both CGI and Perl scripts. CGI input can be retrieved in two different ways: "get" and "post." 

Perl has allowed us to provide a very easy to use and enjoyable interface to our database servers. The servers are actually on NT running a proprietary database software package. The database software is very good at performing both full text and exact term searches of the term data. However, the software interface to the database engines is weak and unusable at best. By using Perl to talk to the database server's HTTP interface we were able to extract the desired results data and then use Perl's power to reformat the results into something pleasing and tailored to the user's preferences. 

we can write Perl script on texteditor.it is possible to write simple programs in Perl with minimum of effort.

As we can write CGI programs in c++,c but perl is mostly preffered.

Perl is a full fledged programming language.It was desgined with an objective to make dynamic and smart web pages.
It has an extensive structure handling feature.Syntaxwise this language is short but its library makes it like C.I mean short but powerful.Here is an exaple:
This is a program written in Perl which will take user input for two enteries and will add them,
1 print "Please Enter 1st no to add:\n";'\n is to move to the other line with out printing it, the messages doesn't matter how many times u use the print statement will print on the same line[like C]'
3 $number1=<STDIN>;'causes execution of the program whilw the computer is waiting for user input'
4 chomp $number1;'removes charecter/no from the ending of the line placed as the input[previous input](for new entry)'[I take this to be an ambiguity and should be removed by making its compiler powerful and understanding that a new input is supposed to be made so clear the previous input so that syntax becomes shorter like we do this in C]
6 print "Please enter second no:";
8 $number2=<STDIN>;
10 chomp $number2;
13 $sum=$number1+$number2;
print "The sum is $sum";'no need to express format type as the variable is scaler and is defined wherever need'
Now that was a sample program.If I am asked to compare its syntax with some language.It would certainly be the Basic.
Now a brief account of Perl's programming approach.
Programs may be written in different ways and Perl is a highly portable language.Its code is easy to understand.
Perl 3, 4 and 5 and 6 are the versions available in the market but Perl 6 is the latest in use.Perl 6 (2000)is a complete rewrite of internals and externals after complete re-organization of done in its previous version. 
Computer languages are divided into two major classes. (1).Procedural Programming Languages and (2).Object Oriented programming Languages. Today we got to discuss the second class so let's start with it.

To understand Object Oriented Programming(Language) well, one should have good acquanitance with fundamental Programming techniques. 
The Programming Languages have divided the world into two parts. *Data and *Operations on Data. Data is static and is immutable unless affected by the certain operations which could certainly bring about a mutation in the structure of it(data). The operations which operate Data are called as procedures or functions. A point to understand here is that these functions or procedures which we pronounce as operations on data have no lasting state, they are only useful when they affect data in a desired fashion as that is the purpose of their life.
Now being succinct I come straight to the main topic and will depict why to use OOPL? How much distinct it is intrinsically from the PPLs?
answering first query; OOPLs provide the programmer with the following advantages which are not provided by the former class as it makes programs: 
1. more intuitive to design 
2. faster to develop
3. amenable to modifications
4. easier to understand 
5. conceiving program tasks in a better way
6. more secure and easy to restrict
7. inherit from classes and to overload methods which could be run recursively and need to be defined once
8. get merged with other programs in such a way that no fear of data loss remains likely

Second query is answered as so; Same functions and procedures used in PPLs are extended and re-organized in a novel way. Making it closer to the nature but yet has a drawback of the lack of elucidation which makes it harder to understand. It means that the OOPL(s) have the same state and behavior and a real high level unit called object to make the programming dynamic and faster.

Now to define OOP, firstly one should learn what an object stands for?

Object is everything and just a black box. This statement means that everything present on the suface of the planet is an object, while taking OOP as an ad hoc it is merely a box which has a function to receive and transmit data according to the signals or commands. Making it easier to understand I will put it this way. OOP is something which groups Data and Operations into modular units called Object. This object will receive signals in the form of command syntax will operate the data the way, it(code) is directing and then finally to bring the result back to the programmer alongwith the command control. 
Here we reach a conclusion and in a better postition to define OOP.
"The insight of object-oriented programming is to combine state and behavior, data and operations on data, in a high-level unit, an object, and to give it the language support"

Now a curt description of the Object Oriented Development Environment 

Basically this environment is comprised of three parts.
1. A library of objects, software frameworks and kits(for building GUI and other graphical applications).
2. A set of Development tools(Merging and modifying more than one programs etc)
3. An Object-Oriented Programming Language(Enabling a programmer to encode a program into the specified fashion, and making the system understand to work according the user needs and commands)
Now some brief notation of the most important and frequently used OOP terms.
1. Object(defined earlier)
2. Message(Software objects communicate with each other via messages)
3. Class(A prototyped that defines the variables and methods common to all objects of the similar kind, thereby making program re-useable and extensible)
4. Inheritance(Provides a natural and powerful mechanism for organizing software programs, usually a class inherits state and behavior from its super-class)
5. Overloading(multiple declaration or assignment of a method)

That was a brief introduction to the OOP(L). Any kind of supplementation has got full scope and will surely get a decent response.
Two of the more common data objects found in computer algorithms are stacks and queues. 
Stacks are data structures, which maintain the order of last-in, first-out (LIFO)
Queues are data structures, which maintain the order of first-in, first-out (FIFO)

***Stack: A stack is a storage device that stores information in such a way that the item stored last is the first item retrieved. A stack is an ordered list in which all insertions and deletions are made at one end, called the top.

Stack Pointer: the register that holds the address for the stack is called a stack pointer (SP)coz its value always points at the top item in the stack.

Please Share it! :)

0 comments:

Post a Comment

 
PLEASE VISIT MY OTHER BLOG TO DOWNLOAD LATEST FULL CRACKED SOFTWARES,GAMES,COMPUTER NOTES,VIDEO TUTORIALS,AND MUCH MORECLICK HERE