Assignment
This assignment is due for next week and must be hand written in your note book.
Write the meaning of the following:
1. Modem (Modulator/Demodulator)
2. Transmission Media:
a) Twisted Pair cable
b) Coaxial cable
c) Fibre-optic cable
d) Satellite transmission
e) Microwave
f) Infra-red
3. Wireless Technology:
a) Bluetooth
b) Wi-fi
c) Hotspot
Terms associated with data communication
Upload: This is the process by which one computer, the host, sends a file to a remote computer via
communication channels.
Download: This is the process by which a computer obtains a file from a host computer via communication
channels.
Point-to-Point Transmission: This is the process by which data is sent from one location to another.
Broadcast Transmission: This is the process by which data is transmitted in such a way that any person with
the correct equipment or technology can received it. This means that it is difficult to control who receives the
data.
Bulletin Board: This is a centralized computerized location to which remote computers can connect (usually
via a telephone line). Once connected, a user can upload messages and files or download those posted by other
users.
\
Introduction Programming
Problem Solving
A computer program is a set of instructions which are used to solve problems, from the very simple to the most
complex form of problems. A problem exists where there is a better way to complete a task.
There are two ways in which programs are designed, namely:
The Problem-Solving Stage: This involves the creation of steps in order to solve the problem, that is
writing algorithm. The computer is not touched during this phase.
The Implementation Phase: This is where you take the designs you came up with during the problem-
solving phase and implement them on the computer.
The following are the five main problem-solving steps:
Define the problem
Propose and evaluate solutions
Determine the most efficient solution
Represent the most efficient solution in the form of algorithm, be it, pseudocode or flow chart
Test the algorithm
Algorithm: An algorithm is a formal sequence of instructions that defines a solution to a problem. An
algorithm can be written using pseudocodes (English like statement) and flowcharts (symbols).
Determining the input, output, processing and storage:
After defining the problem, the next step is to break it down into the main components, namely:
Inputs – the data you are provided with or have obtained from the user. Some words that help you to
identify the inputs are; read, input, enter, given and accept.
Output – The results that should be produced. Some terms that help you to identify the outputs are;
output, print, prompt, write, display.
Processing – the task that must be performed, i.e. what must be done to the input to get the output.
Storage – the data or information that must be stored.
Defining Diagram
A defining diagram is a table that illustrates the main components of a problem. The table consists of three
columns with headings; Input, Processing and Output.
Example1:
Write a program that reads two numbers and print the total
Input Processing Output
Num1, Num2 -Read the two numbers Total
Or - Calculate the total
x, y - Print the total
or A, B
Types of Data
The types of data can be divided into three broad categories – textual, numerical and Boolean.
Textual Data
Textual data is data that may include a combination of letters, symbols and numbers. It can be in the form of a
single character, or a group of characters known as a string. There can be no calculation perform on textual data.
Numerical Data
When it comes to programming there are two main types of numbers:
Integers – These are numbers that don’t have a decimal point, for example 5, -20, 45, 0, 1000.
Real Numbers – These are numbers with decimal point, for example 10.25, -6.097, 350.0
Boolean
Boolean data is data that must be either true or false, whether or not a person is married. It is important to note
that Boolean data can also be yes or no as well as 1’s and 0’s.
Constant and Variable
A constant is data which doesn’t change example pi (π), speed of light, the number of months in a year and the
number of inches in a foot.
Variables on the other hand, are data that can change or take on other values. Examples are, the radius of a
circle. The area of a simple shape as well as the circumference of a circle.
Introduction to Algorithms
The following are characteristics an algorithm should have:
It must be precise – For instance, instead of saying to repeat a step ‘several times’, it should specify how
many times the step should be repeated.
It must be unambiguous – An algorithm shouldn’t include statements that may be interpreted multiple
ways. No required information should be missing.
It must terminate after a finite number of steps – Algorithm should not go on forever.
The instruction must be in a logical sequence – An algorithm should clearly state what order the steps
must be completed in.
It should always give the correct solution.
Algorithms can be represented in several ways. However, for the CSEC syllabus, two ways will be introduced,
namely; pseudocode and flowcharts
Pseudocode
Pseudocode is a special language used to write algorithms that has less stringent rules than programming
languages do. There is no ‘right’ way to write pseudocode. What is important is that you are consistent.
Selection Statement
A selection statement involves the IF construct and the loop statements (FOR, WHILE and REPEAT-UNTIL
construct).
IF Construct
The IF construct helps the program to make a decision based on a condition, be it that its met or not. Any
selection that containing the IF command allows deviation and selection to take place. If a condition is met an
instruction is carried out and if a condition is not met and instruct may or may not be carried out.
A condition is made up of three parts. The first part is the variable that was carried out before. The second part
is a relational operator, and the third part is a variable that was carried out before or a constant. The following
table show relational operators and their name:
Operator Meaning
= Equal to
≠ Not equal to
<> Not equal
> Greater than
< Less than
>= Greater than or equal to
<= Less than or equal to
Condition may involve data of different data types. When the data of the condition is the character data type, the
data should be enclosed in quotation marks. There are three types of IF construct that must be considered,
namely:
1) The IF-THEN construct
2) The IF-THEN-ELSE construct
3) The IF-THEN-ELSE-IF construct
IF-THEN Construct
The IF-THEN construct is made up as follows:
IF <condition> THEN
<one or more instructions which will be carried out if the condition is true>
ENDIF
Eg. 1 Write a structured algorithm that prompts the user to enter the time of day. If the time is 1600 hours,
output “Ring the bell, it’s time to go home”.
Eg. 2 Write a pseudocode that request the user to enter the number of students in the Day School. If the
number of students is greater than or equal to 15, print “Well attended”.
Eg. 3 Write a structured algorithm that prompts the user to enter the price and quantity of an item. If the
amount is less than or equal to $20,000.00 add 15% GCT to get the total amount purchased. The
algorithm should also print the price, quantity, amount, GCT amount and total amount.
Eg. 4 Write a structured algorithm to ask the user to enter a number. The algorithm should store the number as
N. If N is greater than 500, add 50 to the number. Print the number.
Eg. 5 Write a structured algorithm that request the user to enter a positive number which is stored in a variable
Z. If the number is less than 2500, it should subtract 20 from Z. Print the result.
IF-THEN-ELSE Construct
The IF-THEN-ELSE construct is made up as follows:
IF <condition> THEN
<one or more instructions which will be carried out if the condition is true>
ELSE
<one or more instructions which will be carried out if the condition is false>
ENDIF
Eg. 1 Write a structured algorithm that prompts the user to enter the age of a person. If the age is greater than
35, output “The person is old” otherwise output “The person is young”.
Eg. 2 Write a pseudocode that request the user to enter the mark a student received from doing their
homework. If the mark is less than or equal to 65, output “The student should stay back” otherwise
output “The student can go home”. Print the mark the student received.
Eg. 3 Write a structured algorithm that prompt the user to enter the price and quantity of an item. If the cost of
the amount purchased is greater than or equal to $15,000, give a discount of 30%, otherwise give a
discount of 2%. The algorithm should also calculate the amount due (amount due = amount purchased –
discount). Print the price, quantity, amount purchased, discount and amount due with suitable labelling.