1.2.4 Types of Programming Language Flashcards

You may prefer our related Brainscape-certified 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
Q

What does the addessing mode in the opcode specify?

A

How the operand should be interpreted

26
Q

Name the 4 modes of addressing.

A

Immediate addressing
Direct addressing
Indirect addressing
Indexed addressing

27
Q

What is immediate addressing?

A

The operand is the actual value upon which the instruction is to be performed

28
Q

What is direct addressing?

A

The operand gives the address which holds the value upon which the instruction is to be performed

29
Q

What is indirect addressing?

A

The operand gives the address of a register which holds the address of the value upon which the instruction is to be performed

30
Q

What is indexed addressing?

A

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
Q

What is a class?

A

A template for an object which defines its state and behaviour

32
Q

What are the attributes of an object?

A

Gives an object’s properties

33
Q

What are the methods of an object?

A

Describe the actions it can perform

34
Q

What is an object?

A

An instance of a class

35
Q

What is a setter?

A

A method that sets the value of a given attribute

36
Q

What is a getter?

A

A method that retrieves the value of a given attribute

37
Q

What is encapsulation?

A

Using getters and setters to ensure attributes of a class cannot be directly accessed/edited but can only be altered by public methods

38
Q

What is inheritance?

A

Process in which subclass inherits all methods & attributes of a superclass

39
Q

Why is polymorphism?

A

Enables objects to behave differently depending on their class

40
Q

What is meant by overloading in polymorphism?

A

Passing different parameters into a method

41
Q

What is meant by overriding in polymorphism?

A

Redefining a method so that it functions differently to produce a different output

42
Q

What are three advantages of OOP?

A

High level of re usability
Code made more reliable through encapsulation
Makes code easy to maintain and update

43
Q

What is a disadvantage of OOP?

A

Not suited to all problem types