Unit 1: History of Programming Flashcards

1
Q

Machine code

A

A form of digital (binary) information that is processed by and determines the actions performed by a computer’s Central Processing Unit (CPU).

The code is normally stored as a sequence of bytes in memory, and the fundamental functionality of a CPU is to execute this code as a sequence of instructions.

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

3 Actions resulting from machine code instructions

A
  • Logical and arithmetic manipulation of digital data
  • Transfer of data from one memory location to another
  • Making the sequence of execution jump to a new memory location
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

How many registers does a Z80 CPU have?

A

8 main registers designated
A, B, C, D, E, F, H, L

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

How much information can a Z80 register store?

A

8 Binary Bytes

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

4 Kinds of operations that can be performed by a Z80 CPU

A
  • Load a byte into a register
  • Copy bytes from one register to another
  • Copy bytes from a register to a memory location or vice versa
  • Perform arithmetic operations on register contents.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Low-level programming language

A

A programming language that provides little or no abstraction from a computer’s instruction set architecture.

Generally this refers to either machine code or assembly language.

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

Instruction set

A

A set of instructions that the processor understands.

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

Machine code

A

The set of instructions that a CPU understands directly and can act upon.

A program written in machine code would consist only of binary.

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

Assembly language

A

Sits between machine code and high-level language in terms of ease of use.

While high-level languages use statements to form instructions, assembly language uses mnemonics - short abbreviations.

Each mnemonic directly corresponds with a machine code instruction.

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

Give 5 examples of Assembly mnemonics

A

LDA, STA, ADD, SUB, MOV

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

LDA Mnemonic

A

Loads a value from a memory address

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

STA Mnemonic

A

Stores a value in a memory address

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

ADD Mnemonic

A

Adds the value held in a memory address to the value held in the accumulator

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

SUB Mnemonic

A

Subtracts from the accumulator the value held in a memory address

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

MOV Mnemonic

A

Moves the contents of one memory address to another.

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

Von Neumann architecture

A

A description of the processing architecture that all CPUs use.

John von Neumann invented the processor architecture which stores a program in memory as instructions and executes them sequentially using the ALU, control unit, and registers.

This is known as a stored program concept.

17
Q

2 Parts to machine code and assembly instructions

A
  • The opcode
  • The operand
18
Q

Opcode

A

Operation code.

Specifies instructions that can be executed by a CPU / processor in machine code.

E.g. in an instruction like “move the value 3 to the memory address X”, the opcode is move.

19
Q

Operand

A

Data that is manipulated by the CPU/processor according to the given opcode.

E.g. in the instruction “ADD 3”, the operand is 3.

20
Q

Assembler

A

A program that translates assembly languages into machine code.

21
Q

Binary

A

A number system that contains two symbols, 0 and 1.

Also known as base 2.

22
Q

Compilation

A

The process of translating source code into object code all in one go.

The program can then be executed as a whole.

23
Q

Compiler

A

A program that translates high-level programming languages into machine code.

24
Q

Denary

A

The number system that is most commonly used by people.

It contains 10 unique digits 0 to 9. Also known as decimal or base 10.

25
Q

Hexadecimal

A

A number system using 16 symbols from 0-9 and A-F, also known as base 16 and hex.

26
Q

Translator

A

Program translators convert program code into machine code to be executed by the CPU.

27
Q

3 Types of translators

A
  • Interpreter
  • Compiler
  • Assembler
28
Q

Church-Turing thesis

A

A function on the natural numbers can be calculated by an effective method if and only if it is computable by a Turing machine.

All programming languages capable of certain fundamental processing capabilities are equivalent to Turing machines, and so have essentially the same computing power (they can perform the same calculations).

29
Q

Source code

A

A set of instructions that are written in human-readable programming language.

Source code must be translated into machine code before a computer can understand and execute it.

30
Q

3 Advantages of compilers

A
  • Compiled programs run quickly since they have already been translated.
  • A compiled program can be supplied as an executable file (ready to run).
  • Compilers optimise code. Optimised code can run quicker and take up less memory space.
31
Q

2 Disadvantages of compilers

A
  • Source code must be re-compiled every time the programmer changes the program.
  • Source code compiled on one platform will not run on another - the machine code is specific to the processor’s architecture.
32
Q

Interpreter

A

Translates source code into machine code one instruction at a time.

The resulting machine code is then executed immediately.

33
Q

2 Advantages of interpreters

A
  • Instructions are executed as soon as they are translated.
  • Errors can be quickly spotted - once an error is found, the program stops running and the user is notified at which part of the program the interpretation has failed. This makes interpreters extremely useful when developing programs.
34
Q

4 Disadvantages of interpreters

A
  • Interpreted programs run slowly as the processor has to wait for each instruction to be translated before it can be executed.
  • The program has to be translated every time it is run.
  • Interpreters do not produce an executable file that can be distributed. As a result, the source code program has to be supplied, and this could be modified without permission.
  • Interpreters do not optimise code - the translated code is executed as it is.