Module 2 & Module 3 CAPE Computer Science Flashcards

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

Define function

A

A block of code that can be reused multiple times without being rewritten.

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

Properties/Attributes of a well defined algorithm

A

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).

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

What is a programming paradigm?

A

An approach to programming a computer to perform a task based on a set of consistent and logical principles.

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

List the 6 different programming paradigms

A

Procedural/Imperative
Declarative
Scripting
Aspect-Oriented
Functional
Object-Oriented

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

There are __________ different generations of programming languages.

A

There are five different generations of programming languages.

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

Briefly describe each generation of programing language.

A

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).

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

Advantages of each generation of programming language:

A
  1. 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)
  2. 2GL
    - Errors more easily identified than in 1GL
    - Faster than the languages in subsequent
    programming language generations.
  3. 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.
  4. 4GL
    • Little formal training necessary
    • Easier to understand than predecessors
    • Improves advantages of 3GL
  5. 5GL
    • League of its own
    • Can solve problems without
      programmer-written algorithm (on its
      own - given the conditions and
      constraints)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Disadvantages of each programming language generation:

A
  1. 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).
  2. 2GL
    - Longer processing time than 1GL
    - Not completely portable
  3. 3GL
    - Slower execution of programs than
    predecessors (because code has to be
    preprocessed then translated before it
    can be understood by the CPU.
  4. 4GL
    • Same disadvantage of 3GL
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Define procedural programming

A

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.

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

What is Object-Oriented Programming

A

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.

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

Properties of Object - Oriented Programming:

A
  1. Abstraction
  2. Encapsulation
  3. Polymorphism
  4. Inheritance
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Briefly describe each property of Object - Oriented Programming

A

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.

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

Functional Programming Paradigm

A

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.

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

Declarative Programming Paradigm

A

Tells the computer what to do rather than how to do it (the opposite of procedural).

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

Scripting Programming Paradigm

A

Provides connection between applications by taking output of one and plugging it in as input of another.

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

Aspect - Oriented Programming Paradigm

A

Works on solving cross cutting issues of object oriented programming. This makes variables truly independent.

17
Q

Problem Solving Process

A

Problem Definition: Problem is clearly defined.

Problem Analysis: Investigation of the problems allows for the inputs necessary and expected outputs to be determined.

Generation of Possible Solutions: All possible solutions are identified. This provides multiple options to be chosen from.

Analysis of Possible Solutions: Each identified solution is evaluated to see how well suited it is to the problem

Select and Develop Best Possible Solution: The most suitable solution is selected and represented using a flowchart or pseudocode.

Implementation and Review: The developed solution is deployed by the organization it was created for. Review is done to see if the solution met the need (was sufficient).

18
Q

What are the six stages of the Translation Process?

A

Lexical Analysis
Syntax Analysis
Semantic Analysis
Intermediate Code Generation
Code Optimization
Code Generation

19
Q

Briefly define each stage of the Translation Process.

A

Lexical Analysis - Source code is assessed and each component is grouped into tokens so that translator can acknowledge whether or not the terminology and symbols used align with those of the programming language.

Syntax Analysis - The code is compared to the grammar rules to the language to see if it complies.

Semantic Analysis - This is where a check is done to see if the functions and variables have been declared correctly.

Intermediate Code Generation - The stage at which production of machine independent code is produced.

Code Optimization - Code is transformed in order for memory efficiency and faster execution to be achieved (all while keeping the output of the original code intact).

Code Generation - Optimized intermediated code is compiled into and executable file which is more suited to specific languages.