1.2.4 Types of Programming Techniques Flashcards

1
Q

What is a programming paradigm?

A
  • To describe an example of a pattern
  • To describe an example of a way of doing things
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Machine code (4)

A
  • Least abstract
  • Closest to what happens on a computer
  • Programs directly in 1s and 0s
  • These translate into matching electrical signals e.g. 1 for high voltage and 0 for lo
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Assembly language (4)

A
  • Low level language that uses short code (mnemonics)
  • Each mnemonic matches a specific sequence of 1s and 0s
  • One-to-one relationship
  • Written in assembly language and translated by a specific assembler
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

High Level language

A
  • Written in the language that is designed to be easily understood by humans
  • Uses syntax that is similar to human language to form instructions
  • Must be translated into machine code before it can be run (compilation)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Features of procedural languages

A
  • Focus on telling a computer exactly what to do by way of step-by-step instructions
  • Lay code as a series of statements (SSI)
  • Code is developed in a modular way using functions and procedures
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Features of procedural languages

A
  • Pre defined functions
  • Local variables
  • Global variables
  • Parameter passing
  • Modularity
  • Procedures
  • Library
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What are pre defined functions?

A

Functions pre-written within a programming language

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

What are local variables?

A

A variable that can only be accessed within the specific function or procedure it was declared in

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

What are global variables?

A

A variable that can be accessed throughout the whole program and used by all modules

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

What is parameter passing?

A

Allows variable values to be passed into procedures and functions for use in those blocks of code

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

What is modularity?

A

The concept of separating the functionality of a program into individual, interchangeable blocks, each designed to carry out a single task
- These all combine to make a complete program and make the program more readable

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

What is a library?

A

A collection of pre-built functions and procedures that can be linked and used y a programmer in their own code

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

LMC: ADD

A

Add

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

LMC: SUB

A

Subtract

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

LMC: STA

A

Store

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

LMC: LDA

17
Q

LMC: BRA

A

Branch always

18
Q

LMC: BRZ

A

Branch if zero

19
Q

LMC: BRP

A

Branch if positive

20
Q

LMC: INP

21
Q

LMC: OUT

22
Q

LMC: HLT

A

End program

23
Q

LMC: DAT

A

Data location

24
Q

Different modes of addressing memory

A
  • Immediate addressing
  • Direct addressing
  • Indirect addressing
  • Indexed addressing
25
What is the opcode?
Part of the instruction that specifies which operation the processor should perform
26
What is the operand?
The pieces of data for the opcode to act on
27
What is immediate addressing?
- The operand specifies a values which will be used in the operation
28
What is direct addressing?
- The operand specifies the address of a memory location - Contents of this memory location will be used in the operation
29
What is indirect addressing?
- The operand specifies the address of a memory location which holds the address if another memory location - Contents of the second location will be used in the operation
30
What is indexed addressing?
- Operand specifies the address of a memory location - Contents of the index register will be added to the address to determine a second address - Contents of the second location will be used in the operation
31