1.2.4 Types of Programming Language

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/21

encourage image

There's no tags or description

Looks like no tags are added yet.

22 Terms

1
New cards

What is an Imperative programming paradigm?

  • Concerned with how a problem should be overcome.

  • Series of commands specifying what has to be done, and when, to achieve a result.


2
New cards

What is a Declarative programming paradigm?

  • Concerned with what is required.

  • Focuses on the end result.


3
New cards

What is Procedural programming?

  • Example of Imperative programming.

  • Programs are broken down into key blocks called ā€˜procedures’ and ā€˜functions’ and run as a sequence of steps.

  • Procedural languages describe which steps to take to solve a problem and how to complete each step.


4
New cards

What is Object Oriented Programming?

  • Another example of Imperative Programming

  • In OOP, we represent the solution to a problem through ā€˜objects’.

  • Each object has ā€˜attributes’ that are variables that store information about that object.

  • It also has methods. Methods are actions an object can carry out.


5
New cards

What is a Method?

  • A method in OOP is a procedure associated with a class.

  • A method defines the behaviour of the objects that are created from the class.

  • A method is an an action an object is able to perform.

e.g Object = Human, Method = Walk


6
New cards

What is a Function?

  • Combination of instructions that achieve a result.

  • Function needs inputs and returns results.


7
New cards

What is Functional programming?

  • Example of Declarative programming.

  • Functions form the core of the program.

  • Programs are made up of lines of code consisting of function calls.

e.g C# and Java


8
New cards

What is Logic programming?

  • An example of Declarative programming.

  • Programs are based around facts and rules.

  • Specially designed for fault diagnosis, natural language processing, planning and machine learning.

e.g Prolog


9
New cards

What is Machine language?

  • Set of instructions executed directly by the CPU.

  • Each instruction has a specific task (e.g Load)

  • Consists entirely of binary so difficult to understand.


10
New cards

What are Assembly Languages?

  • Allows use of mnemonics instead of binary code.

  • e.g Little Man Computer

  • An ā€˜Assembler’ translates assembly language into machine language.


11
New cards

What are High Level Languages?

e.g Java, Python, C++

  • All the paradigms covered so far.

  • User friendly languages.

  • Similar to human languages.


12
New cards

What is Direct addressing?

  • Only addressing mode used in LMC.

  • The operand represent the memory location of the data we want.

In the example if we loaded direct 4 it’d load the content stored at Memory Location 4 which in this case is 8 into the accumulator.


<ul><li><p>Only addressing mode used in LMC.</p></li><li><p>The operand represent the memory location of the data we want.</p></li></ul><p>In the example if we loaded direct 4 it’d load the content stored at Memory Location 4 which in this case is 8 into the accumulator.</p><p></p>
13
New cards

What is Immediate Addressing?

  • The operand is the actual value we want.

In this case if we loaded immediate 4 it would load 4 into the accumulator.


<ul><li><p>The operand is the actual value we want.</p></li></ul><p>In this case if we loaded immediate 4 it would load 4 into the accumulator.</p><p></p>
14
New cards

What is Indirect addressing?

  • The operand is the address of the data we want.

In this case it’d go memory location for where it shows 8 is the address of where the content we need is stored. Then 27 is loaded into the accumulator.

<ul><li><p>The operand is the address of the data we want.</p></li></ul><p>In this case it’d go memory location for where it shows 8 is the address of where the content we need is stored. Then 27 is loaded into the accumulator.</p>
15
New cards

What is Indexed addressing?

  • One of the registers in the CPU is the index register.

  • The address given is the base address which is then added to the value in the index register.

  • By incrementing the index register, it is possible to iterate efficiently through an array.

In the example if we load indexed R0 it would put 15 into the accumulator since it’s stored at memory location 6 and the index register holds six.

If we loaded indexed R0 when R0 is incremented to contain 1, we would go up to memory location 7 and 32 would be put into the accumulator.


<ul><li><p>One of the registers in the CPU is the index register.</p></li><li><p>The address given is the base address which is then added to the value in the index register.</p></li><li><p>By incrementing the index register, it is possible to iterate efficiently through an array.</p></li></ul><p>In the example if we load indexed R0 it would put 15 into the accumulator since it’s stored at memory location 6 and the index register holds six.</p><p>If we loaded indexed R0 when R0 is incremented to contain 1, we would go up to memory location 7 and 32 would be put into the accumulator.</p><p></p>
16
New cards

What is Abstraction?

  • Using abstraction, a programmer hides many of the details about an object and shows only the most relevant information.

  • This reduces complexity and increases efficiency.


17
New cards

What is Encapsulation?

  • Methods and attributes of an object are hidden so the object can be used by other parts of a program without it having to reveal it’s details.

  • Keeps the data and the code safe from external interference.


18
New cards

What is Inheritance?

  • Process by which new classes are created from existing classes and inherit the general characteristic of those classes.


19
New cards

What is Polymorphism?

  • One name but many forms.

  • Property of a object can change without the context.


20
New cards

How do you create a class?

  • The word ā€˜class’ followed by name of class.

  • A list of private attributes

  • Word ā€˜endclass’


<ul><li><p>The word ā€˜class’ followed by name of class.</p></li><li><p>A list of private attributes</p></li><li><p>Word ā€˜endclass’</p></li></ul><p></p>
21
New cards

What is a Constructor?

  • New objects are created with constructors. These are procedures with name new. e.g public procedure new()

  • A constructor is an example of a method.

  • It is public so it can be accessed outside of the class but is always included within the class.


22
New cards

How do you create a new class and inherit the general characteristic of existing classes?

  • Denoted by the inherits keyword.

  • Methods in the original class (superclass) are called with the keyword super.

  • Constructor method wise this would be super.new()