Module 2 & Module 3 CAPE Computer Science Flashcards
Define function
A block of code that can be reused multiple times without being rewritten.
Properties/Attributes of a well defined algorithm
Provides a general solution to the a clearly defined problem.
Is unambiguous.
Has a finite number of steps.
Has proper flow control (allows one process to flow into the other).
What is a programming paradigm?
An approach to programming a computer to perform a task based on a set of consistent and logical principles.
List the 6 different programming paradigms
Procedural/Imperative
Declarative
Scripting
Aspect-Oriented
Functional
Object-Oriented
There are __________ different generations of programming languages.
There are five different generations of programming languages.
Briefly describe each generation of programing language.
1) First Generation Programming Language(1GL) - Low level language written in binary (1s and 0s), therefore no translation required for cod to be utilized by computer.
2) Second Generation Programming Languages (2GL) - Low level languages which consist of assembly language (written using mnemonics and symbolic code which is easier to understand by humans than machine code).
3) Third Generation Programming Languages (3GL) - High level programming languages which facilitate the use of human language like statements (such as English like ) and functions.
4) Fourth Generation Programming Languages (4GL) - Even closer to human languages such as English.
5) Fifth Generation Programming Languages (5GL) - Programming languages that solve problems by specifying constraints and conditions rather that using a programmer written algorithm (in dunce talk - programming languages that do not need programmer to solve problems, only the conditions and constraints of the problem (problem definition).
Advantages of each generation of programming language:
- 1GL - Fastest and most efficient execution of programs since it was already written in machine language (therefore no translation was necessary for the computer to understand it)
- 2GL
- Errors more easily identified than in 1GL
- Faster than the languages in subsequent
programming language generations. - 3GL
- Faster programming time (i.e. less time
taken to program)
- Closer to human languages than
predecessors.
- Errors more easily identified
- Can be executed on different computer
systems. - 4GL
- Little formal training necessary
- Easier to understand than predecessors
- Improves advantages of 3GL
- 5GL
- League of its own
- Can solve problems without
programmer-written algorithm (on its
own - given the conditions and
constraints)
Disadvantages of each programming language generation:
- 1GL
- Extremely difficult to learn since it’s
written with ones and zeroes (1s and 0s)
- Can only be executed on the computer it
is written on (i.e. not portable). - 2GL
- Longer processing time than 1GL
- Not completely portable - 3GL
- Slower execution of programs than
predecessors (because code has to be
preprocessed then translated before it
can be understood by the CPU. - 4GL
- Same disadvantage of 3GL
Define procedural programming
Procedural programming is a paradigm in which command are executed in the exact order that they stated in the code. Procedural programming tells the computer how the task is to be carried out rather than what the task is.
What is Object-Oriented Programming
Programming paradigm which focuses on objects, their attributes and their responsibilities. It resembles the real world and interactions that take place between all the different object classes.
Properties of Object - Oriented Programming:
- Abstraction
- Encapsulation
- Polymorphism
- Inheritance
Briefly describe each property of Object - Oriented Programming
Abstraction - All but the relevant attributes of an object are hidden by the programmer to reduce complexity and increase efficiently.
Inheritance - The ability of objects to receive (inherit) attributes from parent classes as well as other classes.
Encapsulation - The ability of an object to restrict access to certain attributes and functions that it possesses.
Polymorphism - The ability of variables or functions to have different forms (while the foundation remains the same) for application in different contexts.
Functional Programming Paradigm
Functional programming takes an approach which focuses on the assessment of mathematical statements in the form of functions. All computations are done by calling functions.
Declarative Programming Paradigm
Tells the computer what to do rather than how to do it (the opposite of procedural).
Scripting Programming Paradigm
Provides connection between applications by taking output of one and plugging it in as input of another.