1.2.4 Types of Programming Language Flashcards

(a) Need for and characteristics of a variety of programming paradigms. (b) Procedural languages. (c) Assembly language (including following and writing simple programs with the Little Man Computer instruction set). See appendix 5d. (d) Modes of addressing memory (immediate, direct, indirect and indexed). (e) Object-oriented languages (see appendix 5d for pseudocode style) with an understanding of classes, objects, methods, attributes, inheritance, encapsulation and polymorphism.

You may prefer our related Brainscape-certified flashcards:
1
Q

Name the four programming paradigms in the specification

A

Procedural, Object-Oriented, Functional and Declarative

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

How does procedural programming work?

A

A series of instructions tell the computer how to handle the data given in order to solve the problem.

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

What is structured programming?

A

A type of procedural programming which utilities the programming concepts of SIRS, Selection, Iteration, Recursion and Sequencing.

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

What data types do procedural languages have available?

A

Integer, Real, Floating numbers. Characters Boolean and String.

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

What data structures are found in procedural languages?

A

Arrays and records, however programmers can abstract their own data types such as stacks, queues, trees or a hash table.

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

What is a class?

A

A class is a template description of the methods and variables available within the objects produced from said class.

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

What is a object?

A

A object is a instance of a class.

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

What are the three defining features of OOP?

A

Inheritance, Polymorphism and Encapsulation.

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

What is inheritance?

A

Inheritance is the ability of a class to take attributes from another, when a class does this it is a sub class and the class the attributes were taken from is a super class.

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

What is polymorphism?

A

The ability of the programming language to differentiate between objects based on their class.

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

What is encapsulation?

A

The bundling of data and methods that operate on said data.

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

What are three advantages of OOP?

A

OOP methodology forces programmers to undertake extensive planning which makes for better design less prone to bugs.

Re usability, Objects defined, coded and tested can be reused in many different programs.

Maintenance, The modular structure of OOP makes it easier to maintain than other paradigms.

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

What is functional programming?

A

Functional programming is where statements are written as a series of functions where data input is taken as arguments and a output is produced.

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

What is declarative programming?

A

Where the programmer outlines the problem in statements and the programming language decides how best to solve said problem.

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

Give an example of a language that supports each programming paradigm.

A

Procedural - Python, Pascal
Object orientated - Java,Python,Delphi
Declarative - SQL
Functional - Haskell,Python,C#,Java.

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

How does an assembly language work?

A

Operation codes and addresses are represented using mnemonics, the assembler translates these into machine code for execution.

17
Q

Name all four addressing modes.

A

Indexed addressing
Direct addressing
Immediate addressing
Indirect addressing

18
Q

Explain indexed addressing.

A

Indexed addressing is when the operand contains the number of the index register and the constant value, the constant value is added to the index register in order to find the address of the data to be operated on.

19
Q

What is immediate addressing?

A

When the operand holds the data to be operated on.

20
Q

What is direct addressing?

A

When the operand holds the address of the data to be operated on.

21
Q

What is indirect addressing?

A

When the operand holds the address of the memory location where the address of the data to be operated is.

22
Q

Give an example of application for procedural programming.

A

Procedural - Educational due to it being easy to learn and widely applicable to many problems.

23
Q

Give an example of application for declarative programming.

A

Artificial intelligence.

24
Q

Give an example of application for functional programming.

A

Machine learning.

25
Q

Give an example of application for Object orientated programming.

A

Simulation and modelling systems.

26
Q

Write down a LMC program that inputs three numbers and calculates their sum.

A
INP
STA 1
INP 
STA 2
INP
ADD 1
ADD 2
OUT
HLT
27
Q

What does LDA do

A

Loads the value held at said memory location into the accumulator.

28
Q

What does STA do

A

Stores in the value in the accumulator in the given memory location.

29
Q

What does HLT do

A

Halts the program.

30
Q

What is a dynamic data structure?

A

A data structure that can increase or shrink in size. For example and Linked list or a queue.

31
Q

What is a static data structure?

A

A data structure fixed in size that cannot free up memory while the program is running.

32
Q

What is a linked list?

A

A linked list is a dynamic data structure used to hold a ordered sequence.

33
Q

What is an abstract data type?

A

A logical description of how the data is viewed and the operations that can be performed upon it.

34
Q

What is an array?

A

A series of memory locations holding data of the same type under the same name.

35
Q

What is an attribute in OOP?

A

Attributes, also known as fields, members and properties, are simply variables, low level storage attached to the object.

36
Q

What is a hash table and how does it work?

A

A way to store keys/value pairs.