1.2.4 Types of Programming Language Flashcards

1
Q

Name the 2 categories that programming paradigms can be split into.

A

Imperative
Declarative

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

What are imperative programming paradigms?

A

Code that clearly specifies actions to be performed

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

Name the 2 imperative programming paradigms.

A

Procedural
Object-oriented

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

What are the features of a procedural programming paradigm?

A

Can be applied to a wide range of problems
Easy to write and interpret
Written as a sequence of instructions
Instructions are carried out sequentially

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

What are the features of a object-oriented programming paradigm?

A

Suited to problems that can be broken into reusable components with simillar characteristics
Based on objects formed from classes which have attributes and methods

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

What are declarative programming paradigms?

A

States the desired result and programming language determines how best to obtain the result
Details about how result is obtained are abstracted from user

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

Name the 2 declarative programming paradigms.

A

Functional
Logic

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

What is the disadvantage of procedural language?

A

Not possible to solve all problems or may be inefficient to do so

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

Name the 4 main programming structures of procedural programming.

A

Sequence
Selection
Iteration
Recursion

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

What is assembly language?

A

Low level language of mnemonics with a one-to-one relationship to machine code

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

What is the function of ADD?

A

Adds the value at the given memory address to the value in the accumulator

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

What is the function of SUB?

A

Subtracts the value at the given memory address to the value in the accumulator

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

What is the function of STA?

A

Stores the value in the accumulator at the given memory address

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

What is the function of LDA?

A

Loads the value at the given memory address into the accumulator

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

What is the function of INP?

A

Allows the user to input a value which will be held in the accumulator

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

What is the function of OUT?

A

Prints the value currently held in the accumulator

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

What is the function of HLT?

A

Stops the program at that line, preventing any remaining code from executing

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

What is the function of DAT?

A

Creates a flag with a label at which data is stored

19
Q

What is the function of BRZ?

A

Branches to the given address if the value in the accumulator is zero

20
Q

What is the function of BRP?

A

Branches to a given address if the value in the accumulator is positive

21
Q

What is the function of BRA?

A

Branches to a given address no matter the value in the accumulator

22
Q

How are machine code instructions formed?

A

Opcode
Operand

23
Q

What is opcode?

A

Specifies the instruction to be performed & the addressing mode

24
Q

What is operand?

A

A value related to the data on which the instruction is to be performed

25
What does the addessing mode in the opcode specify?
How the operand should be interpreted
26
Name the 4 modes of addressing.
Immediate addressing Direct addressing Indirect addressing Indexed addressing
27
What is immediate addressing?
The operand is the actual value upon which the instruction is to be performed
28
What is direct addressing?
The operand gives the address which holds the value upon which the instruction is to be performed
29
What is indirect addressing?
The operand gives the address of a register which holds the address of the value upon which the instruction is to be performed
30
What is indexed addressing?
An index register stores a value The address of the value upon which the instruction is to be performed is determined by adding the operand to the index register
31
What is a class?
A template for an object which defines its state and behaviour
32
What are the attributes of an object?
Gives an object's properties
33
What are the methods of an object?
Describe the actions it can perform
34
What is an object?
An instance of a class
35
What is a setter?
A method that sets the value of a given attribute
36
What is a getter?
A method that retrieves the value of a given attribute
37
What is encapsulation?
Using getters and setters to ensure attributes of a class cannot be directly accessed/edited but can only be altered by public methods
38
What is inheritance?
Process in which subclass inherits all methods & attributes of a superclass
39
Why is polymorphism?
Enables objects to behave differently depending on their class
40
What is meant by overloading in polymorphism?
Passing different parameters into a method
41
What is meant by overriding in polymorphism?
Redefining a method so that it functions differently to produce a different output
42
What are three advantages of OOP?
High level of re usability Code made more reliable through encapsulation Makes code easy to maintain and update
43
What is a disadvantage of OOP?
Not suited to all problem types