Module 4 Chapter 3 Programming Language Classification Flashcards
What is machine code?
Instructions stored in binary that can be read by a computer. All code must be converted into machine code for it to be run. It is an example of a low-level programming language.
What are the two parts of an instruction in machine code?
Opcode - the instruction
Operand - the data or memory address
In which order do opcode and operands come?
Opcode then operand
Give an example of a basic assembly language instruction set.
LDA - load the value stored in memory location specified by the operand into the accumulator
STO - Store the value in the accumulator in memory location specified by the operand
ADX - Add the value specified in the operand to the value in the accumulator
CMP - Compare the contents of the accumulator with the contents of the location specified by the operand
BLT - Jump to the address held in the operand if the accumulator held the lesser value than the comparison
BGT - Jump to the address held in the operand if the accumulator held the greater value in the last comparison
JMP - Jump to the address held in the operand
PRT - Print the contents of the address given in the operand
STOP - Stop running the program
What is abstraction?
Abstraction is using simple commands to represent lengthy processes in low-level programming languages to make writing reading and editing code easier. For example: LDA 8 STO 10 LDA 9 STO 8 LDA 10 STO 9 in assembly language becomes x , y = y , x in python.
Give an example of a basic machine code instruction set.
0000 - load the value stored in memory location specified by the operand into the accumulator
0001 - Store the value in the accumulator in memory location specified by the operand
0010 - Add the value specified in the operand to the value in the accumulator
0011 - Compare the contents of the accumulator with the contents of the location specified by the operand
0100 - Jump to the address held in the operand if the accumulator held the lesser value than the comparison
0101 - Jump to the address held in the operand if the accumulator held the greater value in the last comparison
0110 - Jump to the address held in the operand
0111 - Print the contents of the address given in the operand
1000 - Stop running the program
Give an example of a first generation programming language.
Machine code
Give an example of a second generation programming language.
Assembly language
What is assembly language?
The second generation of programming languages, it was a great improvement the binary used in machine code as it used simple mnemonics to represent the opcode and either decimal or hexadecimal digits for the operand. This made reading writing and editing code in assembly language far easier and led to fewer errors in important programs. It is still considered a low-level programming language.
What is FORTRAN?
The first high-level programming language and it was developed by John Backus in the 1960s. It allowed programmers to write programs the same way they wrote formulae and algorithms, hence the name: FORmula TRANslation.
FORTRAN is an example of an imperative high-level language (as are ALGOL, BASIC and COBOL) because each instruction represents one or more command in a low-level programming language.
When is assembly code used today?
When a program needs to execute as fast as possible, occupy as little space as possible or manipulate individual bits and bytes. Examples include real-time systems, sensors and device drivers.