Knowledge Base Home Knowledge Base Home | Knowledge Base Glossary Glossary | Contact Us Contact Us

Browse Categories General Knowledge :: Computer

 

How do I improve my general knowledge? Many people ask this question. So, I've decided to put some general knowledge questions in the form of a quiz along with their answers so that you can learn and improve your general knowledge. If you have any tips or suggestions to improve general knowledge and would like to share them with our readers then you are most welcome to put them in your comments. If this quiz is helpful to you then make sure to send it to as many friends as you can so that they too can benefit from it.

 

 Computer

 

IV   PROGRAMMING LANGUAGES

Application of Programming Languages
Programming languages allow people to communicate with computers. Once a job has been identified, the programmer must translate, or code, it into a list of instructions that the computer will understand. A computer program for a given task may be written in several different languages. Depending on the task, a programmer will generally pick the language that will involve the least complicated program. It may also be important to the programmer to pick a language that is flexible and widely compatible if the program will have a range of applications. These examples are programs written to average a list of numbers. Both C and BASIC are commonly used programming languages. The machine interpretation shows how a computer would process and execute the commands from the programs.

Programming languages contain the series of commands that create software. A CPU has a limited set of instructions known as machine code that it is capable of understanding. The CPU can understand only this language. All other programming languages must be converted to machine code for them to be understood. Computer programmers, however, prefer to use other computer languages that use words or other commands because they are easier to use. These other languages are slower because the language must be translated first so that the computer can understand it. The translation can lead to code that may be less efficient to run than code written directly in the machine’s language.

A   Machine Language

Computer programs that can be run by a computer’s operating system are called executables. An executable program is a sequence of extremely simple instructions known as machine code. These instructions are specific to the individual computer’s CPU and associated hardware; for example, Intel Pentium and Power PC microprocessor chips each have different machine languages and require different sets of codes to perform the same task. Machine code instructions are few in number (roughly 20 to 200, depending on the computer and the CPU). Typical instructions are for copying data from a memory location or for adding the contents of two memory locations (usually registers in the CPU). Complex tasks require a sequence of these simple instructions. Machine code instructions are binary—that is, sequences of bits (0s and 1s). Because these sequences are long strings of 0s and 1s and are usually not easy to understand, computer instructions usually are not written in machine code. Instead, computer programmers write code in languages known as an assembly language or a high-level language.

B   Assembly Language

Assembly language uses easy-to-remember commands that are more understandable to programmers than machine-language commands. Each machine language instruction has an equivalent command in assembly language. For example, in one Intel assembly language, the statement “MOV A, B” instructs the computer to copy data from location A to location B. The same instruction in machine code is a string of 16 0s and 1s. Once an assembly-language program is written, it is converted to a machine-language program by another program called an assembler.

Assembly language is fast and powerful because of its correspondence with machine language. It is still difficult to use, however, because assembly-language instructions are a series of abstract codes and each instruction carries out a relatively simple task. In addition, different CPUs use different machine languages and therefore require different programs and different assembly languages. Assembly language is sometimes inserted into a high-level language program to carry out specific hardware tasks or to speed up parts of the high-level program that are executed frequently.

C   High-Level Languages

UPI/THE BETTMANN ARCHIVE
Grace Hopper
A pioneer in data processing, Grace Hopper received credit for creating the first compiler in 1952. Hopper helped to develop two computer languages and to make computers attractive to businesses. One of the most prominent women in the computer industry, Hopper died in 1992.

High-level languages were developed because of the difficulty of programming using assembly languages. High-level languages are easier to use than machine and assembly languages because their commands are closer to natural human language. In addition, these languages are not CPU-specific. Instead, they contain general commands that work on different CPUs. For example, a programmer writing in the high-level C++ programming language who wants to display a greeting need include only the following command:

cout << ‘Hello, Encarta User!’ << endl;

 

This command directs the computer’s CPU to display the greeting, and it will work no matter what type of CPU the computer uses. When this statement is executed, the text that appears between the quotes will be displayed. Although the “cout” and “endl” parts of the above statement appear cryptic, programmers quickly become accustomed to their meanings. For example, “cout” sends the greeting message to the “standard output” (usually the computer user’s screen) and “endl” is how to tell the computer (when using the C++ language) to go to a new line after it outputs the message. Like assembly-language instructions, high-level languages also must be translated. This is the task of a special program called a compiler. A compiler turns a high-level program into a CPU-specific machine language. For example, a programmer may write a program in a high-level language such as C++ or Java and then prepare it for different machines, such as a Sun Microsystems work station or a personal computer (PC), using compilers designed for those machines. This simplifies the programmer’s task and makes the software more portable to different users and machines.

Powered by  AHC Networks