1.2.4 - Types of programming languages Flashcards

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

What are procedural languages?

A

1) High-level, 3rd generation, imperative languages.

2) Use sequence, selection and iteration.

3) Program gives a series of instructions in a logical order line by line to state what to do and how to do it.

4) Program statements are in blocks called procedures and functions.

5) Break the solution down into subroutines which are rebuilt and combined to form a program.

6) Statements are in a specific order i.e. sets tasks to be completed in a specific way.

7) Logic of program is given as a series of procedure calls.

8) Examples include: VB.NET and Python.

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

What is assembly code?

A

Is a machine-oriented language related closely to the specific design of the computer being programmed.

Is a LLL but higher level than machine code i.e. each instruction is generally translated into 1 machine code instruction.

Uses descriptive names for data stores. Uses mnemonics for instructions.

Uses labels for addresses to allow selection.

May use macros. Is translated by an assembler.

Easier to write than machine code, but more difficult than HLL.

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

What are 4 different addressing modes?

A

Immediate addressing

Direct addressing

Indirect addressing

Indexed addressing

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

What is immediate addressing?

A

Used in assembly language.

Uses data in address field as a constant.

Data in the operand is the value to be used by the operator e.g. ADD 45 adds the value 45 to the value in the
ACC.

In summary reads the opcode, to see what to do, and then the operand is what value is stored.

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

What is direct addressing?

A

The opcode is the instruction still but the operand is the address of the value that is going to be stored.

For example: ADD 1 would add the value at address 1, to the ACC.

The number of memory locations available that can be addressed is limited by the size of the address field.

Code is not relocatable so uses fixed memory locations.

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

What is indirect addressing?

A

Similar to direct addressing but the operand is the address of the address for the value (E.g. in ADD 23, if address 23 stores 45, address 45 holds the number to be used)

Used to access library routines.

Increases the size of the address that can be used allowing a wider range of memory locations to be accessed.

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

What is indexed addressing?

A

Uses the Index Register to calculate the address. If i have ADD 2, it will use the address of 2 plus whatever is in the index register to find the value.

Allows efficient access to a range of memory locations by incrementing the value in the IR e.g. used to access an
array

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

What is Object-Oriented Programming (OOP)?

A

In OOP, program components are split into small units called objects/classes which are used by and interact with other objects to build a complex system.

Most programs nowadays are built using OOP at least to some extent.

Examples of OOP languages include: Java, C++ and C#

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

What is a class in OOP?

A

A template defining methods and attributes used to construct a set of objects that have state and
behaviour.

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

What is an object in OOP?

A

These are program building blocks. They are self-contained instances of classes based on real-world
entities which contain attributes and methods.

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

What is a method in OOP?

A

Is a program code subroutine that forms the actions an object can carry out.

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

What is an attribute?

A

Is a data value, stored in a variable associated with an object.

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

What is a constructor?

A

The method used to describe how an object is created and sets the attributes.

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

What are 3 fundamental concepts in object-oriented programming (OOP)

A

Inheritance
Encapsulation
Polymorphism

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

What is inheritance in OOP?

A

Is when a derived class inherits all the methods and attributes of its parent class/superclass

The inheriting class may override some of these methods and attributes and may also have additional extra
methods and attributes of its own.

This means that one class can be coded and used as the base for similar objects which will save time.

Essentially the class is reusable

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

What is encapsulation in OOP?

A

Is the process of data hiding by keeping an object’s attributes private so their values can only be directly
accessed and changed via public methods defined for the class and not from outside the class.

This means that objects only interact in the way intended and prevents indiscriminate, unexpected changes to
attributes as this could have unforeseen consequences.

Maintains data integrity.

Instead getters and setters are used.

17
Q

What is polymorphism in OOP?

A

Means that objects of different types can be treated in the same way.

This allows the same method to be applied to objects of different classes. An example might be an array with
objects of different classes having the same method applied to all of them.

The code written is able to handle different objects in the same way which reduces the volume of code produced.

18
Q

What are the 3 programming paradigms we need to know?

A

Procedural language
Assembly language
OOP language (C#, Java)