Languages Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

Programming languages

A

A program is a set of instructions that the computer can understand and enables a computer to perform a specific task
Since the computer can only understand binary code (series of 1s and 0s), all computer languages must be eventually reduced to binary code and the way this is done depends on the type of language used
There is a variety of computer languages and the one that is chosen for a specific job depends on the job being done

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Programming language cateogories

A

Low-level languages
high-level languages

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Low level languages

A

Closely related to the design of the machine
Available instructions reflect on the way the machine is built
These are related to the specific architecture and hardware of a particular type of computer
These are easy for the computer to understand but more difficult for the programmer to understand
Machine code and Assembly language are examples of low level languages
Programs are very small and executes very fast
Can write programs to control hardware directly

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Machine language (machine code)

A

This is the language directly understood by the machine and it consists of a series of 1s and 0s
Due to this it is difficult to understand
All other programs written in high-level or assembly language must be translated into machine code before the instructions can be carried out
Machine code is often machine specific, which means that one computer’s machine code will not be understood by a different type of computer (depending on the manufacturer)
Due to this machine code is non portable
A program written in machine code needs no translation and therefor very fast
A lot of games and simulation programs are written in machine code for this reason

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Translator

A

Computer program used to convert a program from one language to another
This is a general name for three types of translation programs, assembler, compilers and interpreters

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Source code

A

High level language or assembly code as written by the programmer, that a compiler or assembler, respectively, can convert to object code

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Object code

A

Machine code that a complier or assembler produces from higher level source code.
This is the translated source code
Often this will be machine code, but might also be an intermediate code, which has to further translated before it can be executed

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Assembler

A

A program that translates (assembles) a program written in assembly language into machine code

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Compiler

A

A software that translates a program written in high level language (source code) in one go (source code translated all at once) which can then be saved and executed later without the presence of a compiler
Usually had the .exe extension

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Interpreter

A

Translates high level source code, but at one line at a time and then executes it
No object code is produced, so the program has to be interpreted each time it is run
Interpreter program must be present for the program to run

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Advantages of a compiler over an interpreter

A

The object code can be saved on the disk and run whenever required without the need to recompile, however if an error is discovered the whole program needs to be recompiled
The object code executed faster than interpreted code
The object code produced by the compiler cannot be distributed or executed without having to have the compiler present
The object code is more secure, as it cannot be read without a great deal of ‘reverse engineering’

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Disadvantages of compiler

A

A compiler cannot produce any object code unless the whole program is correct- they tend to report a lot of errors initially, making it harder to debug a program
Need the whole program to recompile cannot run partially created programs

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Advantages of a interpreter over a compiler

A

Useful for program development as there is no need for lengthy recompilation each time an error is discovered
Interpreters find errors when it happens and tells the user what has gone wrong
It is easier to partially test and debug programs

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Disadvantages of Interpreter

A

Programs tend to run slower using an interpreter because the interpreter has to translate the source code while the program is running and each time the program is running

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Will a programmer use a interpreter or compiler

A

Typically, a programmer might use an interpreter during program development
A program that is tested and ready for distribution would then be compiled and saved object code would be distributed

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Assembly language

A

Low level programming language as the programmer is working at the lowest level of detail, the CPU hardware itself
this closely related to the computer’s own machine code. Each instruction in assembly language is the same as the machine code instruction
Instead of writing actual machine code instructions, the assembly language programmer is generally able to make use of descriptive names for data stores and short memorable keywords called mnemonics for instructions
Mnemonic is a short, simple acronym that represents each of the CPU’s instruction set.
E.g. LDR-load register, STR- store, CMP-compare, ADD-add
The program is then assembled using a translator known as an assembler into the appropriate machine code instructions

17
Q

High level languages

A

Developed with the programmer in mind than the computer
Such languages have the advantage that they are not as machine dependent as machine code or assembly language, so once a program has been written it can be used on different computer with very little alteration
High level language instructions are very similar to English, which means that programming is made easier and debugging is easy as the instructions are easy to understand and remember

18
Q

Advantages of high level languages

A

Simple instructions similar to English make high level languages easy to understand
It is easy to correct errors and test programs
These programs can be used on different makes of computer

19
Q

Advantages of high level languages

A

Simple instructions similar to English make high level languages easy to understand
It is easy to correct errors and test programs
These programs can be used on different makes of computer