LECTURE NOTE: PROGRAM DESIGN,
ALGORITHMS, CONTROL STRUCTURES &
PROGRAMMING LANGUAGES
1.0 PROGRAMS AND PROGRAM
DEVELOPMENT
1.1 Definition of a Program
A program is a set of logically arranged instructions written in a programming language that tells the
computer how to perform a specific task.
Programs are used to solve problems, automate tasks, or control systems.
1.2 Major Features of a Good Program
A good program should possess the following qualities:
1. Correctness – It must produce the right output for all valid inputs.
2. Efficiency – It should use minimal system resources (CPU, memory, time).
3. Simplicity – The structure should be easy to understand and follow.
4. Modularity – Program should be broken into smaller manageable units.
5. Maintainability – Easy to modify or improve in the future.
1.3 Steps in Developing a Good Program
1. Problem Definition
Clearly understanding what is required.
2. Analysis
Identifying inputs, processes, and outputs.
3. Algorithm Design
Writing the step-by-step solution.
4. Flowcharting
Creating a diagram that represents the algorithm.
5. Coding
Translating the algorithm into a programming language.
6. Testing and Debugging
Running the program to find and fix errors.
7. Documentation and Maintenance
Providing explanations for future reference.
1.4 Importance of Debugging and Documentation
Debugging
Helps identify and correct logical, runtime, or syntax errors.
Ensures program reliability and correctness.
Documentation
Helps future programmers understand the program.
Essential for maintenance, upgrades, and user support.
2.0 ALGORITHMS, FLOWCHARTS &
PSEUDO CODE
2.1 Algorithm: Definition
An algorithm is a finite, step-by-step procedure used to solve a problem.
Key Characteristics of an Algorithm
1. Definiteness – Each step must be clear.
2. Finiteness – The algorithm must terminate.
3. Input – Must have zero or more inputs.
4. Output – Must produce at least one result.
5. Effectiveness – Steps must be basic and executable.
2.2 Difference Between Algorithm, Flowchart, and Pseudocode
Term Description Nature
Algorithm Step-by-step instructions in plain English Textual
Flowchart Diagram that visually represents an algorithm Graphical (Diagram required)
Pseudocode A structured, English-like representation of a program Hybrid textual
2.3 Flowchart: Sum and Average of Three Numbers
(Diagram required here — use standard flowchart symbols)
Steps to represent:
1. Start
2. Input A, B, C
3. SUM = A + B + C
4. AVG = SUM / 3
5. Print SUM, AVG
6. Stop
3.0 CONTROL STRUCTURES IN
PROGRAMMING
Control structures determine how instructions are executed in a program.
3.1 Types of Control Structures
1. Sequence Structure
Instructions executed in order.
Example:
Read A
Read B
Sum = A + B
Print Sum
2. Selection (Decision) Structure
A condition controls the flow (IF, ELSE).
Example:
IF Age >= 18 THEN
Print "Adult"
ELSE
Print "Minor"
3. Repetition (Looping) Structure
Repeats a set of instructions.
Example:
FOR i = 1 to 10
Print i
END FOR
3.2 Algorithm Using Selection: Largest of Two Numbers
Algorithm
1. Start
2. Input A, B
3. IF A > B then
Print A is largest
ELSE
Print B is largest
4. Stop
3.3 Advantages of Using Control Structures
1. Helps organize program logic.
2. Improves readability and maintainability.
4.0 MODULAR PROGRAMMING AND
DESIGN METHODS
4.1 Concept of Modular Programming
Modular programming is the practice of dividing a program into smaller, independent units called
modules.
Benefits
Easier debugging
Reusability
Better organization
Simplifies teamwork
4.2 Top-Down Design
This is the method of breaking a main problem into smaller subproblems until each is simple enough to
be solved directly.
4.3 Program Structure Charts
A structure chart shows the breakdown of a program into modules.
It uses rectangles to represent modules.
Lines indicate relationships.
Structure charts help to:
Visualize program modules
Show hierarchy
Identify data passed between modules
4.4 Advantages of Modular Programming
1. Easier testing and debugging
2. Supports teamwork
3. Enhances reusability
5.0 PROGRAMMING PROBLEM-SOLVING
STAGES
5.1 Stages of Solving Programming Problems
1. Problem Definition
2. Analysis
3. Algorithm Development
4. Flowcharting (Diagram required)
5. Coding
6. Testing and Debugging
7. Documentation and Maintenance
5.2 Example: Student Grade Calculator
Algorithm
1. Start
2. Input Score
3. IF Score ≥ 70 → Grade = "A"
ELSE IF Score ≥ 60 → Grade = "B"
ELSE IF Score ≥ 50 → Grade = "C"
ELSE IF Score ≥ 45 → Grade = "D"
ELSE → Grade = "F"
4. Print Grade
5. Stop
Flowchart
5.3 Difference Between Coding, Testing, and Debugging
Term Meaning
Coding Writing the program using a programming language.
Testing Running the program to check if outputs match expectations.
Debugging Finding and fixing errors discovered during testing.
6.0 PROGRAMMING LANGUAGES
6.1 Machine, Low-Level, and High-Level Languages
Machine Language
Binary (0s and 1s)
Hardware-dependent
Fast but difficult to understand
Low-Level Language
Assembly language
Uses mnemonics like MOV, ADD
Close to hardware but more readable
High-Level Language
Human-readable (Python, Java, C++)
Portable across machines
Slower but easier to use
6.2 Features that Differentiate System Commands from Program
Statements
1. System commands are OS-level instructions; program statements belong to a language.
2. System commands control hardware or files; program statements control program logic.
3. System commands run immediately; program statements need compilation or interpretation.
6.3 Examples of Programming Languages
Low-Level Languages
1. Assembly Language
2. Machine Language
High-Level Languages
1. Python
2. Java
3. C++
4. Visual Basic