Computer Programming Assignment (Questions and
Answers)
1. Definition of Computer Programming
Computer Programming is the process of writing instructions (codes) that tell a computer how to perform specific
tasks. Examples include programs written in Python, Java, C++, and JavaScript.
Examples:
1. Calculator Program
2. School Result Processing System
3. Mobile Apps
Features of a Good Program (8)
Correctness – Produces correct output.
Efficiency – Uses minimal time and memory.
Readability – Easy to understand.
Simplicity – Not complex.
Reliability – Works without failure.
Maintainability – Easy to update.
Portability – Works on many systems.
Flexibility – Can be modified easily.
Steps in Developing a Good Program
Problem Definition
Program Design
Algorithm Development
Coding
Testing and Debugging
Documentation
Maintenance
2. Definition of Algorithm
An algorithm is a step-by-step procedure used to solve a problem.
Typical Programming Tasks
Problem Analysis
Algorithm Design
Coding
Testing
Debugging
Documentation
Maintenance
3. Methods of Representing an Algorithm
Flowchart
Pseudocode
Natural Language
Decision Table
Pseudocode: Area of a Triangle
Start
Input base, height
Area = 1/2 * base * height
Output Area
Stop
Pseudocode: Average of 8 Numbers
Start
Sum = 0
For i = 1 to 8
Input number
Sum = Sum + number
End For
Average = Sum / 8
Output Average
Stop
Algorithm: Buying a Computer from Market
Start
Enter car
Drive to market
Park car
Enter shop
Select computer
Pay money
Collect receipt
Return home
Stop
4. Definition of Flowchart
A flowchart is a graphical representation of an algorithm using symbols.
Main Flowchart Symbols (5)
Oval – Start/Stop
Parallelogram – Input/Output
Rectangle – Process
Diamond – Decision
Arrow – Flow line
Uses of Flowchart (5)
Problem solving
Program design
Debugging
Communication
Documentation
Advantages of Flowchart (5)
Easy understanding
Better communication
Helps debugging
Improves logic
Good documentation
Disadvantages of Flowchart (5)
Time consuming
Hard to modify
Large diagrams
Needs special skills
Difficult for complex programs
Algorithm: Convert Naira to Dollar
Start
Input Naira
Input ExchangeRate
Dollar = Naira / ExchangeRate
Output Dollar
Stop
Flowchart Description
Start → Input Naira → Input Rate → Divide → Display Dollar → Stop