1.2.4 Types of programming language Flashcards

1
Q

What is a programming paradigm?

A

“To describe an example of a way of doing things.”​
Software written using programming languages.

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

Why do we need different programming paradigms?

A

-some problems are better suited to being solved using certain paradigm

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

What does Turing complete mean?

A

-Turing complete languages can solve all the problems that a computer is able to solve
-Most programming languages in most programming paradigms are said to be Turing complete

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

Low level:
machine code

A

-programs directly in 1s and 0s
-least abstract

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

Low level:
assembly language

A

-uses mnemonics
-one to one relationship
-written in assembly language and translated by an assembler

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

High level language:

A

-each instruction could be many lines of machine code
-HLL fit into two categories imperative and declarative

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

What are imperative languages?

A

-use statements that change a program’s state in the form of sequence, selection, iteration, etc
-procedural programming is a type of imperative programming
-OOP paradigms are a modern extension of the imperative programming

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

What are declarative languages?

A

-focus on whatthe program should accomplish

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

Advantages of machine/assembly:

A

-Assembly has the same efficiency of execution as machine due to its one-to-one nature
-provides direct access to system features without having to go through a software interface -this improves the speed of the program

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

disadvantages of machine/assembly:

A

-code can be difficult to understand so it is hard to modify and maintain
-code can be tedious to write and very prone to bugs

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

Features of procedural languages:

A

-focus on telling a computer exactly what to do by way of step-by-step instructions
-Blocks of code identifyset tasksthat need to be completed using procedures and functions
-need to be able to read, trace, amend and write this code

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

Concepts of procedural languages:
(spec doesn’t specify)

A

-pre defined functions
-local/global variables
-parameter passing
-modularity
-procedures
-library

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

What is LMC?

A

-LMC is a conceptual computer often used in education theory and exams to help students learn, test and understand assembly language
-The instruction set contains 11 mnemonics

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

What are the 11 mnemonics?

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

What are the addressing methods? (4)

A

-direct
-indirect
-immediate
-indexed

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

Why do we have different address methods?

A

-By utilizing different addressing modes, the operand can take on different meanings

17
Q

Direct addressing:

A

-The value in the address is a reference to the address in memory where the required value is located

18
Q

Indirect 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
(use instruction to find address, use value to find next address = value found)

19
Q

Immediate addressing:

A

-the value in the address is actually the value to be used

20
Q

Indexed addressing:

A

-There is an index register (IR) that is set to 0
-The address of the
operand is determined by adding the operand to the index register

21
Q

What is object-oriented programming?

A

-attempts to capture or group
information, data and related functionality (code) into structured items
known as objects

22
Q

Classes vs objects:

A

-a class is a template of an object, containing methods and attributes
-an object is an instance of a class

23
Q

What is instantiation?

A

-The process of creating an object from a
class template

24
Q

What is a constructor?

A

-a special method within the class that runs when an object of that class type is created

-When the object is instantiated the constructor
method takes the values of the parameters passed into the object and sets its local attributes to their initial values

25
What is inheritance?
-Inheritance is when a class takes on the methods and attributes of a parent class -The inheriting class may override some of these methods / attributes -may have additional extra methods and attributes of its own
26
What is encapsulation?
-When an attribute is made private (so it can’t be directly accessed or changed from outside the class) -Public methods are used to read / amend the attribute’s value
27
Advantages of encapsulation:
-Reduces the chance of errors/inconsistences -Ensures objects can only be changed in the way intended/ -Ensuring changes are consistent with how the object should behave -Protecting data/ Can’t be changed accidentally