Flashcards in 1.2.4 Types of Programming Language Deck (36)
Name the four programming paradigms in the specification
Procedural, Object-Oriented, Functional and Declarative
How does procedural programming work?
A series of instructions tell the computer how to handle the data given in order to solve the problem.
What is structured programming?
A type of procedural programming which utilities the programming concepts of SIRS, Selection, Iteration, Recursion and Sequencing.
What data types do procedural languages have available?
Integer, Real, Floating numbers. Characters Boolean and String.
What data structures are found in procedural languages?
Arrays and records, however programmers can abstract their own data types such as stacks, queues, trees or a hash table.
What is a class?
A class is a template description of the methods and variables available within the objects produced from said class.
What is a object?
A object is a instance of a class.
What are the three defining features of OOP?
Inheritance, Polymorphism and Encapsulation.
What is inheritance?
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.
What is polymorphism?
The ability of the programming language to differentiate between objects based on their class.
What is encapsulation?
The bundling of data and methods that operate on said data.
What are three advantages of OOP?
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.
What is functional programming?
Functional programming is where statements are written as a series of functions where data input is taken as arguments and a output is produced.
What is declarative programming?
Where the programmer outlines the problem in statements and the programming language decides how best to solve said problem.
Give an example of a language that supports each programming paradigm.
Procedural - Python, Pascal
Object orientated - Java,Python,Delphi
Declarative - SQL
Functional - Haskell,Python,C#,Java.
How does an assembly language work?
Operation codes and addresses are represented using mnemonics, the assembler translates these into machine code for execution.
Name all four addressing modes.
Explain indexed addressing.
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.
What is immediate addressing?
When the operand holds the data to be operated on.
What is direct addressing?
When the operand holds the address of the data to be operated on.
What is indirect addressing?
When the operand holds the address of the memory location where the address of the data to be operated is.
Give an example of application for procedural programming.
Procedural - Educational due to it being easy to learn and widely applicable to many problems.
Give an example of application for declarative programming.
Give an example of application for functional programming.
Give an example of application for Object orientated programming.
Simulation and modelling systems.
Write down a LMC program that inputs three numbers and calculates their sum.
What does LDA do
Loads the value held at said memory location into the accumulator.
What does STA do
Stores in the value in the accumulator in the given memory location.
What does HLT do
Halts the program.