1.2.4 types of programming languages Flashcards
what are programming paradigms
Different approaches to using a programming language to solve problems.
which two broad categories are programming paradigms split into
-imperative
-declarative
Imperative programming paradigms
uses code that clearly specifies the actions to be
performed
Declarative programming paradigms
focuses on stating the desired result rather than the exact series of instructions that need to be performed to get to the result. . It is the role of the programming language to determine how best to obtain the result and the details about how it is obtained are abstracted from the user.
Advantages of procedural programming
-can be applied to a wide range of problems
- relatively easy to write and interpret
procedural programming
This is a type of imperative programming which uses a sequence of
instructions which may be contained within procedures. These instructions are carried out in a step-by-step manner.
state a use of declarative programming
-Artificial intelligence
-expert systems/knowledge based systems
identify the 4 main structures used in structural programming
-sequence
-selection
-iteration
-recursion
Sequence
Code is executed line-by-line, from top to bottom.
Selection
A certain block of code is run if a specific condition is met, using IF
statements.
Iteration
A block of code is executed a certain number of times or while a condition is met. Iteration uses FOR, WHILE or REPEAT UNTIL loops.
Recursion
Functions are expressed in terms of themselves. Functions are executed, calling themselves, until a certain condition known as a base case (which does not call the function) is met.
what is procedural programming suited for
suited to problems that can easily be expressed as a series of instructions
how does assembly language differ from machine code
Assembly language uses mnemonics rather than binary. One line in assembly language is equal to one line in machine code
mnemonics