CFAP
CFAP
● Machine language
○ The FIRST generation of programming language
○ The ONLY language that the computer directly recognizes.
○ Use a series of binary digits (1s and Os) or a combination of numbers and letters that represent binary digits.
○ Machine language Disadvantages
◆ Their instructions are extremely cryptic and difficult to learn
◆ Programs are lengthy
◆ Machine-dependent
◆ Not portable.
● Assembly Language
○ The SECOND generation of programming language
○ Using symbolic instruction codes (meaningful abbreviations)
○ A → addition
○ C→ compare
○ L → load
○ M → multiply
○ Assembly Language Disadvantages
◆ Difficult to learn.
◆ Programmers must use assembler to convert assembly language to machine language.
◆ Programs are lengthy
◆ Machine-dependent
◆ Not portable
Translator
● Translator Program -- the program that translates the source program into the object program.
● Source Program -- program written in a high-level programming language.
● Object Program -- the source program after it has been translated into machine language.
Algorithm
● The algorithm is the abstract idea of solving a problem.
● An algorithm is a step-by-step instructions that will transform input into output.
● It can be represent using pseudo code or flow chart
Algorithm
can be described using three control structures
● A Sequence
– is a series of statements that execute one after another
● A Selection - (branch)
– statement is used to determine which of two different statements to execute depending on certain conditions
● A Looping - (repetition)
– statement is used to repeat statements while certain conditions are met
Pseudo Code
● Artificial, informal language used to develop algorithms.
● It is usually referred to as the "false code"
● Similar to everyday English.
Flow Chart
● Graphical representation of an algorithm.
● Special-purpose symbols connected by arrows (flow lines).
Flowcharting structures
. Sequence - In a computer program or an algorithm, sequence involves simple steps which are to be executed one
after the other. The steps are executed in the same order in which they are written
. Selection - Selection is used in a computer program or algorithm to determine which particular step or set of steps
is to be executed
. Repetition - Repetition allows for a portion of an algorithm or computer program to be done any number of times
dependent on some condition being met. An occurrence of repetition is usually known as a loop.
– An essential feature of repetition is that each loop has a termination condition to stop the repetition, or the
–
obvious outcome is that the loop never completes execution (an infinite loop).
– The termination condition can be checked or tested at the beginning and is known as a pre-test loop or at the
end of the loop and is known as a post-test loop.
– Repetition Pre-test (structure)
● A pre-tested loop is so named because the condition has to be met at the very beginning of the loop or the body of
the loop is not executed.
● This construct is often called a guarded loop.
● The body of the loop is executed repeatedly while the termination condition is true.
An important difference between a pre-test and post-test loop is that the statements of a post-test loop are executed at
least once even if the condition is originally true, whereas the body of the pre-test loop may never be executed if the
termination condition is originally true. A close look at the representations of the two loop types makes this point apparent.
Benefits of flowchart
A flowchart helps to clarify how things are currently working and how they could be improved. It also assists in finding out
the key elements of a process and the start of the next one
The reasons for using flowcharts as a problem-solving tool are given below
● Makes logic clear - the main advantage of using a flowchart to plan a task is that it provides a pictorial
representation of the tasks, which makes the logic easier to follow.
The symbols are connected in such a way that they show the movement of information through the system visibly.
● Communication - being a graphical representation of a problem-solving logic, flowcharts are a better way of
communicating the logic of a system to all concerned.
● Effective analysis - with the help of a flow chart, the problem can be analyzed in an effective way
Benefits of flowchart
● Useful in Coding- the flowcharts act as a guide or blueprint during the analysis and program development phase.
Once the flowcharts are ready, the programmers can plan the coding process effectively.
● Proper testing and debugging- by nature a flowchart helps in detecting the errors in a program, as the developers
know exactly what the logic should do.
● Appropriate documentation - Flowcharts serve as a good program documentation tool. Since normally the programs
are developed for novice users.
Limitations of flowchart
● Complex- The major disadvantage of using flowcharts is that when a program is very large, the flowcharts may
continue for many pages, making them hard to follow.
● Costly- Drawing flowcharts are viable only if the problem-solving logic is straightforward and not very lengthy.
However, if flowcharts are to be drawn for a huge application, the time and cost factor of program development may
get out of proportion.
● Difficult to modify- due to its symbolic nature, any changes or modifications to a flowchart usually require redrawing
the entire logic again, and redrawing a complex flowchart is not a simple task.
● No update: usually programs are updated regularly. However corresponding updates in the flowchart may not take
place, especially in the case of large programs. As a result, the logic in the flowchart may not match with the actual
program.