1.2.4 Types of Programming Language Flashcards

1
Q

Procedural Programming

A

Uses a sequence of instructions which are carried out in a step by step manner.

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

Procedural Programming disadvantages

A
  • May be inefficient when trying to solve certain problems.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Procedural Programming advantages

A
  • It can be applied to a wide range of problems
  • It is easy to write and interpret.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Why is assembly language easier to use than machine code?

A

It uses mnemonics rather than binary

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

Why are the commands that assembly language uses processor specific?

A

It directly interacts with the CPU’s special registers.

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

Mnemonic: ADD

A

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

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

Mnemonic: SUB

A

Subtract the value at the given memory address from the value in the accumulator

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

Mnemonic: STA

A

Store 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
9
Q

Mnemonic: LDA

A

Load 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
10
Q

Mnemonic: INP

A

Allow 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
11
Q

Mnemonic: OUT

A

Outputs the value currently held in the accumulator

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

Mnemonic: HLT

A

Stops the program at that line, preventing the rest of the code from executing.

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

Mnemonic: DAT

A

Creates a flag with a label at which data is stored

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

Mnemonic: BRZ

A

Branches to a given address if the value in the accumulator is zero. This is a conditional branch.

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

Mnemonic: BRP

A

Branches to a given address if the value in the accumulator is positive. This is a conditional branch.

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

Mnemonic: BRA

A

Branches to a given address no matter the value in the accumulator. This is an unconditional branch.

17
Q

What does addressing modes allow for?

A

A much greater number of locations for data to be stored, as the size of the operand would otherwise constrain the number of addresses that could be accessed.

18
Q

What does the addressing mode do?

A

Specifies how the operand should be interpreted.

19
Q

What is the addressing mode part of?

A

The opcode.

20
Q

Immediate Addressing

A

The operand is the actual value upon which the instruction is to be performed, represented in binary.

21
Q

Direct Addressing

A

The operand gives the address which holds the value upon which the instruction is to be performed. This is used in LMC.

22
Q

Indirect Addressing

A

The operand gives the address of a register which holds another address, where the data is located.

23
Q

Indexed Addressing

A
  • An index register is used, which stores a certain value.
  • The final address of the data is determined by adding the value in the index register to the operand.
24
Q

Class

A

A template defining the attributes and methods that can be used to create a type of data known as an object.

25
Q

Object

A

An instance of a class, with a set of attributes and methods.

26
Q

Setter

A

A method that sets the value of a particular attribute.

27
Q

Getter

A

A method which retrieves the value of a given attribute.

28
Q

Why use getters and setters?

A

To ensure attributes cannot be directly edited and accessed.

29
Q

What does Encapsulation do?

A

It protects attributes from being directly accessed.

30
Q

How is Encapsulation implemented?

A

By only allowing class methods to access data in an object’s attributes.

31
Q

Constructor

A

Creates an instance of a class.

32
Q

Inheritance

A

The concept of subclasses inheriting the methods and attributes of its parent class.

33
Q

Polymorphism

A

Objects of different classes can use the same method to perform an action.

34
Q

OOP Advantages

A
  • Allows for a high level of reusability
  • Classes can be used across multiple projects
  • Encapsulation makes the code more reliable by protecting attributes from being directly accessed.
  • Modular structure makes it easy to maintain and update
35
Q

OOP Disadvantages

A
  • Different style of programming, and so requires an alternative style of thinking.
  • OOP is not suited to all types of problems. Where few components are reused, OOP may result in a longer more inefficient program
  • Generally unsuitable for smaller problems.