1.2.4 Flashcards

Types of programming language (33 cards)

1
Q

Key features of procedural languages

A

Sequence
Selection (a.k.a. Branching)
Iteration
Recursion.

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

Positives and negatives of procedural languages

A
  • Simple to implement.
  • Applicable to many problems.
  • Is not suited to every problem.
  • Uses traditional data types and structures.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What are procedural languages good for?

A

Writing code with lots of algorithms.
Anything where you want fine control and high performance but want more portability than assembly language.

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

What are procedural languages bad for?

A

Brevity (other paradigms provide more concise alternatives).

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

Object oriented language features and examples

A

Encapsulation, Instantiation, Inheritance, Polymorphism.

Example languages: Java, C++, C#, Python, JavaScript

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

What are object oriented languages good for?

A

Abstraction when dealing with real world objects.

Modularity.

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

What are object oriented languages bad for?

A

Efficient code for limited resource environments
transparent (easy to trace) code
concurrent programming

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

Low level languages key features and examples

A

Opcodes (Mnemonics), Operands, Registers, Memory Modes

ARM Assembly, x86 Assembly, Little Man Computer

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

What are low level languages good for?

A

Device drivers
OS development (particularly embedded systems)
ultra high performance code

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

What are low level languages bad for?

A

Portability
abstraction
rapid development

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

Features an examples of functional languages

A

First Class, Higher Order and Pure Functions. Immutability

JavaScript, LISP and countless other multi-paradigm languages Haskell (Pure functional language)

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

What are functional languages good for?

A

Robust, predictable and reliable code.
Efficient and highly optimisable code.
Concurrency safe processing.

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

What are functional languages bad for?

A

Beginners

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

Declarative languages features and examples

A

Queries, C.R.U.D., Facts and Rules, Relationships

SQL, Prolog

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

What are declarative languages good for?

A

Databases, Expert systems, Artificial Intelligence

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

What are declarative languages bad for?

A

Control over what the computer is actually doing!

17
Q

What are the modes of memory addressing?

A

Immediate Addressing (literal)

Direct Addressing (reference to a cell in memory)

Indirect Addressing (reference to a cell in memory pointing to another cell)

Indexed Addressing (reference plus offset)

18
Q

Immediate Addressing (Literal)

A

Operand is an actual value, i.e. a literal number, rather than a memory location. Literal.

Needs no access to RAM - no fetch is required.

Range of values is limited by the size of the operand (eg if there are 4 bits for the operand, the literal value can only be 0 - 15)

19
Q

Direct Addressing (Pointer)

A

Operand is a memory location, like Little Man Computer.

This mode is good when programmer a wants global variable.

Address is constant throughout the program executive since it’s part of the assembly program instruction

20
Q

Indirect Addressing (Pointer to Pointer)

A

Operand is a memory location pointing to another memory location to be used.

Multiple fetches are required.

This mode allows access to more memory. Why? An 8 bit instruction might have 4 bits for the opcode, 4 bits for the operand (max 16 memory locations can be referenced). The pointed to memory location can use all 8 bits to reference 128 memory locations available.

21
Q

Indexed Addressing (Pointer plus offset)

A

Operand is a memory location plus an offset stored in a special Index Register.

This mode is ideal to store and access values stored sequentially for example in arrays since arrays are stored in contiguous memory locations. The pointer points to the memory location of the first element in the array. By incrementing or decrementing the offset, different elements of the array can be indexed.

22
Q

Class

A

A template for an object. Defines the behaviour and state of the object.

23
Q

State

A

Defined by attributes giving the object’s properties.

24
Q

Behaviour

A

Defined by the methods. Describes the action an object can perform.

25
Instantiation
Using a class to create an object.
26
Object
An instance of a class. Classes can create multiple objects.
27
Setter
A method which sets the value of an attribute.
28
Getter
A method which retrieves the value of an attribute.
29
Constructor method
Allows a new object to be created from a class. Every class must have one.
30
Inheritance
Process where a subclass will inherit all methods and attributes of a superclass.
31
Polymorphism
Allows objects to behave differently depending on their class.
32
Overloading
Avoiding a method by passing different parameters to a method.
33
Overriding
Redefining a method to allow it to produce a different output or function differently.