1.2.4 Flashcards

1
Q

programming paradigm

A

“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

turing complete language

A

languages that can solve all the problems that a computer is able to solve

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

the need for multiple programming paradigms

A

there are other ways of doing things (there are other programming paradigms) but some problems are better suited to being solved using a certain paradigm

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

characteristics of programming paradigms

A

we expect programming languages to include facilities like variables, loops, conditions and arrays, syntax or commands are different, but the underlying concepts haven’t changed much

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

low level languages

A

machine language
assembly language

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

low level languages - pros

A

Assembly language has the same efficiency of execution as machine code due to its one-to-one nature
can produce very precise, locally optimised and efficient code
provides direct access to system-level features without having to go through a software interface (improves the speed of the program)
you are in complete control of your code

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

low level languages - cons

A

machine-dependant, and code is very hard – if not impossible – to port.
Programmers who can write efficient assembly code are rare
Even in the hands of a talented programmer, code can be tedious to write and very prone to bugs
code can be difficult to understand, so hard to modify/maintain

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

machine language

A

Least abstract.
Closest to what actually 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 low.

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

assembly language

A

Uses short code words known as mnemonics.
Each mnemonics 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
10
Q

high level languages

A

imperitive
declarative

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

imperative language

A

uses statements that change a program’s state in the form of sequence, selection, iteration, etc…
consists of commands for a computer to perform and focus on describing how a program operates

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

procedural languages

A

a type of imperative programming paradigm where a program is built from one or more subroutines (procedures, functions etc)

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

Object-oriented programming paradigms

A

a modern extension of the imperative programming approach that focuses more on a modular approach to programming

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

declarative language

A

focuses on what the program should accomplish

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

LMC

A

Little Man Computer

a conceptual computer often used in education theory and exams to help students learn, test and understand assembly language

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

LMC - ADD

A

add

Add the contents of the memory address to the accumulator

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

LMC - SUB

A

subtract

Subtract the contents of the memory address from the accumulator

18
Q

LMC - STA

A

store

Store the value currently stored in the accumulator in the memory address

19
Q

LMC - LDA

A

load

Load the contents of the memory address into the accumulator

20
Q

LMC - BRA

A

branch always

Use the memory address as the address of the next instruction

21
Q

LMC - BRZ

A

branch if zero

Branch to the memory address if the accumulator is zero

22
Q

LMC - BRP

A

branch if positive

Branch to the memory address if the accumulator is zero or positive

23
Q

LMC - INP

A

input

24
Q

LMC - OUT

A

output

25
Q

LMC - HLT

A

end program

26
Q

LMC - DAT

A

data location

27
Q

LMC - in RAM

A

100 memory locations (0 to 99).

28
Q

LMC - in CPU

A

An arithmetic unit.
An accumulator (stores results of the last operation/calculation)
A program counter (stores address of the next instruction in memory)
An instruction register (holds first digit of the instruction read from memory (our opcode))
An address register (holds 2nd/3rd digits of the instruction read from memory (our operand))

29
Q

opcode v operand

A

0001 1010
opcode operand
instruction number

30
Q

modes of addressing memory (4 types)

A

immediate
direct
indirect
indexed

31
Q

immediate addressing

A

the value in the address part of the instruction is actually the value to be used, so the memory does not need to be searched to find the required value.

the instruction ADD 10 literally means, “Add 10,” not, “Add the value in address location 10.”

aka: immediate operand

32
Q

direct addressing

A

the value in the address part of the instruction is a reference to the address in memory where the required value is located.

the instruction ADD 10 means, “Go and find whatever is in memory address location 10 and add it to the accumulator.”

33
Q

indirect addressing

A

the value in the address part of the instruction is a reference to a memory location that contains the address in memory where the required value is located.

the instruction ADD 10 means, “Go and find memory address location 10. There, you will find another address. Go to this address and add what you find to the accumulator.”

useful - larger address range can be used to reference data/instructions

34
Q

indexed addressing

A

more efficient to use an index register (IR) for instructions that will be repeated many times

The IR is set to 0, so the first value is taken from 10 + 0.

the IR is incremented and the same instruction is used again – this time, the address is 10 + 1, then 10 + 2 etc…

35
Q

OOP

A

object orientated programming

a coding process that involves solutions (that represent real world entities) being constructed by means of objects that interact with each other. It uses classes as templates to construct objects

36
Q

OOP - classes

A

All classes have three main sections.
- The name of the class.
- Its attributes
- Its methods

37
Q

OOP - objects

A

when the class (the blue print) is use to make ‘an object’

38
Q

OOP - attributes

A

all the information shared by any object of this class type
i.e. variables associated with it

39
Q

OOP - methods

A

subroutines that form the actions an object can carry out

40
Q

OOP - inheritance

A

where 1 class retains the methods and attributes of its parents class and its own.

41
Q

OOP - encapsulation

A

the process of keeping an object’s attributes private so they can only be accessed and changed via public methods.

More readable, reusable and reliable code and the attributes can be validated.

42
Q

OOP - polymorphism

A

objects of different types can be treated in the same way.