Palphlrt Form 3 Only -Computer Studies
Palphlrt Form 3 Only -Computer Studies
R. MALEMBA
ST. PATRICK’S SECONDARY SCHOOL
2024 EDITION
COMPUTER STUDIES – FORM 3 PAMPHLET
Page 1 of 171
COMPUTER STUDIES
ST. PATRICK’S SECONDARY SCHOOL
TABLE OF CONTENTS
Page 2 of 171
R. MALEMBA
COMPUTER STUDIES
ST. PATRICK’S SECONDARY SCHOOL
TOPIC 1: USING SPREADSHEET I
INTRODUCTION
Many problems in Mathematics, science and finance requires a person to work with
numbers and manipulate them using formulas.
The simplest of doing this is to manually perform calculations using calculator
Today, several computer applications have been developed to analyze numerical data
One of such application is electronic spreadsheets
DEFINITION AND TYPES OF SPREADSHEETS
In financial accounting, spreadsheet is an accounting ledger book in which data is
organized into rows and columns.
TYPES OF SPREADSHEETS
There are two types of spreadsheets namely:
1. Manual or traditional spreadsheet
2. Electronic spreadsheet
1. TRADITIONAL SPREADSHEETS
A traditional spreadsheet is made up of sheet of papers divided into rows and columns
in which data is entered manually.
A manual worksheet is a ledger sheet within which values can be entered and arithmetic
computations made manually on them
Manual spreadsheets have been used:
i. To organize data into tabular format
ii. In financial and accounting offices where figures are entered for easier organization
and arithmetic computation
iii. In stock management where stock values are entered in an organized way.
2. ELECTRONIC SPREADSHEET
An electronic spreadsheet is an application software made up of rows and columns, and
is used to organize, calculate and analyse numerical data.
The rows and columns are similar to the ones of a manual spreadsheet.
Page 3 of 171
R. MALEMBA
COMPUTER STUDIES
ST. PATRICK’S SECONDARY SCHOOL
EXAMPLES OF ELECTRONIC SPREADSHEETS
i. Microsoft Excel
ii. OpenOffice Calc
iii. Lotus 1-2-3
iv. Corel Quattro Pro
COMPONENTS OF SPREADSHEETS
i. Worksheets
ii. Database
iii. Graphs
i Worksheet
A worksheet is a work area that is made up of rows and columns where data is entered
Each row is labelled with numbers (1,2,3,…) while columns are labelled with letters
(A,B,C,…) as shown below:
Page 4 of 171
R. MALEMBA
COMPUTER STUDIES
ST. PATRICK’S SECONDARY SCHOOL
ii. DATABASE
A spreadsheet database is a collection of related data items or records.
A record is made up of distinct data elements called fields that together form an entity.
An entity is something of interest such as a person, a place or item.
For example, a student is an entity of which can create a record containing first name,
last name, gender and date of birth fields.
Assuming that the worksheet holds these details for many students, row after row, the
worksheet can be considered as a database consisting of records that may be organized
by sorting, searching or querying
iii. GRAPHS
A graph is a pictorial representation of the relationship between two or more values on
a worksheet.
In most spreadsheet, graphs are referred to as charts.
A chart enables the user to present complex values from a worksheet in a simple, easy to
understand format.
Examples of charts include: pie chart, line carts, column chart and bar chart
USES OF A SPREADSHEET
Some of the uses of a spreadsheet include
i. Arranging information: since worksheets are made up of rows and columns, data can
be entered and organized automatically into printable tabular layout
Page 5 of 171
R. MALEMBA
COMPUTER STUDIES
ST. PATRICK’S SECONDARY SCHOOL
ii. Preparation of budget: a spreadsheet is used to prepare budgets and other accounting
documents like cash flows and expenditure statements
iii. Interest calculation: spreadsheet is used to compute both simple and compound
interest
iv. Statistical analysis: spreadsheet has tools that enable scientists and other users to
perform simple and complex statistical analysis. Simple analysis includes:
computation of mean, mode, deviation, sum and product. Complex analysis includes
computation of variance, cumulative distribution, regression analysis etc.
BENEFITS OF ELECTRONIC SPREADSHEET
Electronic spreadsheet offers various benefits over manual spreadsheets. These include:
i. Electronic spreadsheets enable computations to be done fast, accurate and efficiently
ii. Electronic spreadsheet offers a large virtual sheet for data entry and manipulation. A
manual spreadsheet has only 30 columns and 51 rows where as electronic spreadsheet
has at least 255 columns and 255 rows.
iii. It is easy to enter data in the worksheet because most spreadsheet provide
autocomplete and autocorrect features.
iv. Electronic spreadsheet utilizes the storage space on storage media to save and retrieve
documents.
v. Electronic spreadsheets enable the user to produce neat work because all the work is
edited on the screen and clean copy is produced.
vi. Electronic spreadsheets have better editing and formatting features.
vii. Electronic spreadsheets have inbuilt formula called function that enable the user to
quickly analyse numeric data.
viii. Electronic spreadsheets automatically adjust the result of a formula if the value in a
worksheet are changed. This is called automatic recalculation.
ix. Graphs let the user provide visual representation of data from a worksheet for easy of
interpretation.
DISADVANTAGES OF ELECTRONIC SPREADSHEETS
i. Startup cost including computer and software purchase may be high
ii. Learning how to use electronic spreadsheet requires considerable effort and is mostly at a
cost
Page 6 of 171
R. MALEMBA
COMPUTER STUDIES
ST. PATRICK’S SECONDARY SCHOOL
iii. Electronic spreadsheet files require to be protected against unauthorized access and
malware like viruses.
GETTING STARTED WITH MICROSOFT EXCEL
Microsoft Excel 2013 simply referred to as Excel is a member of Microsoft Office suite.
Earlier versions of Excel include Excel 97, Excel 2000, Excel XP/2002, Excel 2007 and
Excel 2010.
There are a number of ways used to start Excel. To launch Excel 2013 from the Start
menu, proceed as follows:
Page 7 of 171
R. MALEMBA
COMPUTER STUDIES
ST. PATRICK’S SECONDARY SCHOOL
Features of excel are as follows:
i. Rows: a row is a horizontal arrangement of cells in a worksheet. It is labelled using
numbers 1,2,3….. in the worksheet
ii. Column: a column is vertical arrangement of cells in the worksheet. It is labelled
using letters A, B, C …… in the worksheet
iii. A cell: a cell is intersection between a column and a row. A cell pointer indicates the
current active cell
iv. Worksheet: A worksheet is the work area made up of rows and columns where data
is entered
v. Workbook: A workbook is a spreadsheet file that consists of one or more related
worksheets.
vi. Labels: columns and rows have labels. Column labels are letters A-Z, AA-AZ, row
labels are numbers 1,2,3 ….. in the worksheet
vii. Cell address: Each cell has an address. The address is column label followed by
row label e.g. A1.
viii. Name box: It displays the address of the current cell
ix. File tab: Has common commands like New, Open, Save as, Print, Close etc.
x. Command ribbon: Each menu has a set of commands like Home ribbon has
commands.
xi. Formula bar: Is an input box where a cell entry or a formula is displayed before it
is inserted into the active cell.
xii. Worksheet tabs: worksheet tabs are located at the bottom of a spreadsheet. They
are labelled sheet1, sheet2 ……but can be renamed by right clicking the sheet and
click rename
SPREADSHEET DATA ENTRIES
Data entered into a spreadsheet can be classified into four categories namely:
i. Label
ii. Value
iii. Formulae
iv. Functions
Page 8 of 171
R. MALEMBA
COMPUTER STUDIES
ST. PATRICK’S SECONDARY SCHOOL
LABEL
A label is a text or alphanumeric characters entered in a cell.
By default, a label is aligned to the left of the cell and cannot be computed mathematically
A label is usually used to describe a row or column heading
Sometimes, numbers can be formatted so that they can be used as a label by adding an
apostrophe before the number e.g. ‘1990.
VALUES
A value is a numerical number that can be manipulated mathematically
By default, values are aligned to the right of the cell.
FORMULA
A formula a mathematical expression used to perform calculations
A formula starts with = sign followed by cell addresses and operator eg =B3 + D4, add
contents of B3 and D4 and return the sum.
FUNCTION
These are predefined or inbuilt formula
Example of function is =SUM (B3:D4) which add contents of cells B3 to D4
NAVIGATING THE WORKSHEET
The cell pointer in the worksheet shows the position of the current cell
The process of moving the cell pointer around the worksheet is called navigating the
worksheet and can be achieved in several ways:
i. Arrow keys let the user move one cell to the next direction of the arrow key
ii. Tab key moves the cell pointer on a cell to the right
iii. You can directly move a particular cell by clicking the desired cell.
iv. Ctrl + Home keys move the cell pointer to the cell A1
USING ARROW KEYS ON THE KEYBOARD
The up-arrow key moves the cell pointer one row up
The down arrow key moves the cell pointer one row down
The right arrow key moves the cell pointer one column to the right
The left arrow key moves the cell pointer one column to the left
Page 9 of 171
R. MALEMBA
COMPUTER STUDIES
ST. PATRICK’S SECONDARY SCHOOL
USING THE TAB KEY
Pressing the tab key moves the cell pointer one column to the right
Pressing shift + tab moves the cell pointer one column to the left
PAGE DOWN and PAGE UP keys move the worksheet one page down and one page up
respectively
BLOCK OPERATIONS
Performing calculations on a worksheet data involves block operations
A block of selected cells in a worksheet is referred to as a range
A range is specified by the address of its top left and bottom right cells or using a name.
CELL REFERENCING
Using cell addresses also called referencing enables Microsoft Excel calculations
accurate and automatically recalculates results of a formula in case the value in the cell
change. This is referred to as automatic recalculation.
There are three types of cell referencing used when creating formula and manipulating
cell contents and these are:
1. RELATIVE REFERENCING
A relative referencing is one that changes depending on its position of reference in the
worksheet.
When you copy the cell that contents relative reference says A3 the reference adjusts to
reflect the new location
For example, =A1+B1 is in cell C1 and is copied to C2, the formula reference change to
=A2+B2
Page 10 of 171
R. MALEMBA
COMPUTER STUDIES
ST. PATRICK’S SECONDARY SCHOOL
2. ABSOLUTE REFERENCING
In absolute referencing, the reference is made to a specific address and does not change
even if the formula is copied to another cell.
In excel, absolute referencing is made by placing dollar sign before reference ($A$2)
3. MIXED REFERENCE
This is a combination of relative and absolute referencing on a specific cell address to
make the row or column relative or absolute
For example, in A$3, the row is relative while the column is absolute
CREATING A WORKBOOK AND WORKSHEET
Creating a workbook involves starting the spreadsheet program and entering data in the
cells of the current worksheet.
However, the user can choose to create a worksheet either using the general format or
from a preformatted worksheet called a template.
USING A BLANK WORKSHEET
When a spreadsheet application is launched, it presents the user with a new blank
template.
If you wish to create another workbook while the application is still running:
i. Click the File tab, and select New from the drop-down menu
ii. In the New Workbook dialog box, double click Blank Workbook icon.
SAVING A WORKBOOK
The procedure for saving a workbook is similar to that of saving a Word document.
Page 11 of 171
R. MALEMBA
COMPUTER STUDIES
ST. PATRICK’S SECONDARY SCHOOL
i. Click the File tab the select Save As command. The Save As dialog box is displayed
ii. Select the location in which your workbook will be saved in the Save in box then type
a unique name for the workbook in the File name box. Make sure that the option
Microsoft Excel Workbook is selected under the save as type box. Excel saves the
workbook with .xlsx extension.
iii. Click Save button to save and close the dialog box.
RETRIEVING A WORKBOOK
To retrieve an existing workbook, use the procedure below:
i. On the File tab, click Open from the drop-down menu
ii. Select the location, drive or folder where the workbook was saved
iii. Double click the icon of the workbook you wish to open
CLOSING A WORKBOOK AND EXITING EXCEL
Closing a workbook is the process of closing the current spreadsheet workbook without
exiting the spreadsheet application
On the other hand, exiting Excel is the process of closing all open workbooks and exiting
the spreadsheet application.
To close a workbook and exit Excel, proceed as follows:
i. On the File tab, click Close. Alternatively press Ctrl + F4
ii. To exit from Excel,
iii. On the File menu, click Exit. Alternatively press Alt + F4 on the keyboard.
EDITING WORKSHEET AND WORKBOOK
Editing refers to making necessary modification to a worksheet that has already been
created.
It involves deleting entries, copying, moving, find and replace as well as spell checking
EDITING CELL ENTRIES
There are two methods of editing a cell entry:
1. Using the formula bar: click the cell to display its content and make the changes in
the formula bar.
2. Double clicking: this places the insertion pointer in the cell and then type or modify
the cell.
Page 12 of 171
R. MALEMBA
COMPUTER STUDIES
ST. PATRICK’S SECONDARY SCHOOL
i. Position the pointer where the new row or column will appear
i. On the Insert menu, click Worksheet. A new worksheet is added into your
workbook
To delete a worksheet:
Page 13 of 171
R. MALEMBA
COMPUTER STUDIES
ST. PATRICK’S SECONDARY SCHOOL
iii. In the Find What box, type the word or phrase to find
iv. Click the Replace tab and in the Replace With, type the word or phrase to replace the
found word or phrase
iii. On the spelling dialog box, replace or ignore the misspelt words
FORMATTING WORKSHEETS
Worksheet formatting refers to enhancing the appearance of the worksheet to make it
more attractive and appealing to the reader
It essentially consists of resizing column width and row height, changing text colour,
typeface (font), size, style and alignment
ii. Notice that the mouse pointer changes from a cross to a double arrow
iii. Click the mouse button and hold it down so that you can now resize the width of the
column by dragging it to the size you wish. After dragging to the required point release
the mouse button. The column will have a new size
ii. Type a width in the column width dialog box, and then click OK button to apply
Page 14 of 171
R. MALEMBA
COMPUTER STUDIES
ST. PATRICK’S SECONDARY SCHOOL
ii. Drag the line until the height of the row is as required, then stop and release the mouse
button
ii. In the format cells dialog box, make the formatting specifications that you wish, then click
OK button to apply.
iii. If it is a range of cells, they must be highlighted first before formatting them as a block of
cells
FORMATTING LABELS
i. Highlight the cells that have the text to be formatted
iv. Select the font type e.g. Times New Roman. Other font formatting features like style,
size, underline and colour are available and can be selected
NB: Alternatively, use the formatting toolbar to accomplish all your text formatting needs.
FORMATTING NUMBERS
i. Highlight the cells that have the numbers to be formatted
Page 15 of 171
R. MALEMBA
COMPUTER STUDIES
ST. PATRICK’S SECONDARY SCHOOL
iv. You can now choose number formats as explained below
NUMBER MEANING
General Cells have no specific number format
Number Used for general display of numbers
Currency For displaying monetary values e.g. $100, MK12
Accounting Lines up the currency symbols and decimal points
Date Displays date in specified format
Time Displays time in specified format
Percentage Multiply the value in the cell with 100 and display it as a percentage %
Text Format text to be treated as a text even when numbers are entered
Custom For number format not predefined in Microsoft Excel
FORMATTING BORDERS
You may need to put a printable border around the worksheet or range of cells to make it
more appealing.
To put a border, proceed as follows:
i. Highlight the range you wish to insert borders. Click Format Cell command to
display the dialog box
ii. Click the Borders tab to specify border option
iii. Click OK button
FORMATTING ROWS AND COLUMNS
Sometimes, data entered in a worksheet may not fit in a cell
Therefore, it becomes necessary to adjust the height of a row or the width of a column.
The default width of a column in Microsoft excel is 8.11 but can be adjusted to any size
between 0 and 255.
This can be done in two ways:
Page 16 of 171
R. MALEMBA
COMPUTER STUDIES
ST. PATRICK’S SECONDARY SCHOOL
i. Move the pointer to the top heading until the mouse pointer turns a cross, then click
and drag to the required size.
ii. Move the mouse pointer to the row headings of column headings and right click the
click row width or column height.
GLOBAL WORKSHEET FORMATTING
The word global in this context refers to the entire worksheet. To format the entire
worksheet, select the whole worksheet using these two methods:
i. Clicking the triangular symbol at the intersection of column A and row 1
ii. Pressing Ctrl + A on the keyboard
Once the entire worksheet is selected, use the Format Cells dialog box to format the
content
USING AUTOFORMAT
It allows the user to apply one of the 16 sets of formatting to a selected range on the
worksheet. This quickly creates tables that are easy to read and that are attractive to look
at.
Select a range to make it attractive.
ii. Click Format then select the Autoformat command on the menu that appears. Select
a format from the autoformat dialog box
Page 17 of 171
R. MALEMBA
COMPUTER STUDIES
ST. PATRICK’S SECONDARY SCHOOL
Notice that the format applied to the first worksheet are reflected on the entire workbook.
PROTECTING WORKBOOK AND WORKSHEETS
A worksheet containing sensitive or confidential information should be protected from
unauthorized access.
There are several techniques for protecting workbook in excel and these are
1. Making a workbook read only: These allows a user to just view the document but not
edit, copy or print the workbook
2. Encrypt using password
3. Restricting access by adding digital signature
To perform all these three:
i. Click File tab, then Info
ii. Click Protect Workbook
iii. Select Mark as read to make the workbook read only, click encrypt with password
to put a password or click Add digital signature to restrict access
Page 18 of 171
R. MALEMBA
COMPUTER STUDIES
ST. PATRICK’S SECONDARY SCHOOL
KEYBOARD SHORTCUT
Excel has keyboard shortcut for performing tasks. The following are some of the
keyboard shortcut
7 CTRL + B Bold
8 CTRL + I Italicize
9 CTRL + U Underline
10 CTRL + T Insert table
11 CTRL + F4 Close current file
12 ALT + F4 Close excel
13 CTRL + Z Undo
14 ALT + Y Redo
15 CTRL + P Print
16 F4 Repeat last action
17 F1 Open online help documentation
18 CRL + F1 Hide/unhide commands ribbon
19 Shift + Arrow Highlights cells
20 CTRL + Spacebar Select current column
Page 20 of 171
R. MALEMBA
COMPUTER STUDIES
ST. PATRICK’S SECONDARY SCHOOL
2. RELATIONAL OPERATORS
A relational operator returns either true of false depending on the absolute value of the
operand being evaluated
SYMBOL DESCRIPTION EXAMPLE
Page 22 of 171
R. MALEMBA
COMPUTER STUDIES
ST. PATRICK’S SECONDARY SCHOOL
= Equal to =A2=B2
> Greater than =A2>B2
< Less than =A2<B2
<> Not equal to =A2<>B2
<= Less than or equal to =A2<=B2
>= Greater than or equal to =A2>=B2
OPERATOR PRECEDENCE
If several operators are used in a formula, Microsoft Excel performs the operations in
order shown in the table below
If the formula has operators of the same precedence like multiplication and division, the
expression is evaluated from left to right.
Enclosing part of the parenthesis alters the order of operation by making that part to be
evaluated for.
OPERATORS NAME PRECEDENCE
1. – Negation as -1 1
2. % Percent 2
3. ˄ Exponential 3
4. * and / Multiplication and division 4
5. + and – Addition and subtraction 5
6. =,<>,>,<,<=,>= Relational 6
CREATING USER-DEFINED FORMULAE
A user defined formula is created by the user to manipulate numeric data in the
worksheet. First click the cell in which you wish to get the results of the formula then type
the formula.
Examples are:
1. =C2 + D4 add the contents of cells C2 and D2
2. =B4 * 0.2 displays 20% of the value in cell B4
3. =F5*1.2 Increases the value in cell F5 by 20%
4. =(G6/4)*5+6*(3-1) Will be evaluated using precedence rule
5. =C2-D2 Will subtract contents in D2 from contents in C2
Page 23 of 171
R. MALEMBA
COMPUTER STUDIES
ST. PATRICK’S SECONDARY SCHOOL
6. =C2/D2 Will divide contents in C2 by contents in D2
7. =C2*D2 Will multiply contents in C2 by contents in D2
FUNCTION
In Excel, a function must also start with = sign followed by function name and arguments.
Arguments are cell addresses, numeric, logical or text value enclosed in parenthesis
Therefore, three elements in function are:
1. An equal sign (=)
2. Function name
3. Cell range
In Excel functions are categorized according to the nature of calculations they perform.
The following are the categories:
1. Maths & Trig
2. Statistical
3. Logical
4. Date and Time
To use a function from any categories, proceed as follows:
i On the Insert menu, click Function. Alternatively, click the fx button on the standard
toolbar.
ii In the function dialog box displayed, select the category
iii In the function list box, select a function.
iv Specify the function argument then click OK.
Page 24 of 171
R. MALEMBA
COMPUTER STUDIES
ST. PATRICK’S SECONDARY SCHOOL
Page 25 of 171
R. MALEMBA
COMPUTER STUDIES
ST. PATRICK’S SECONDARY SCHOOL
2. STATISTICAL FUNCTIONS
The following are some of the commonly used statistical functions:
1. AVERAGE(): return the arithmetic mean of its arguments. For example
=AVERAGE(A1:C1) will return arithmetic mean of values in a cell from A1 to C1
2. COUNT(): counts the number of cells that contains numeric value within a range.
For example =COUNT(A2:F2) will return number of cell from A2 to F2 that
contains numeric value
3. MAX(): return the largest number from a range of cells
4. MIN(): return the smallest number from the range of cells
3. LOGICAL FUNCTIONS
Logical functions return true or false from an expression.
Examples of logical functions are IF, COUNTIF, AND, OR, and NOT
1. IF(): return a value or a label if a condition you specify evaluate to TRUE and another
if it evaluates to FALSE
e.g. If C5 holds mean score and display PASS if the mean is greater than 50
and FAIL if the mean is less than 50 or FAIL if otherwise then we can use
=IF(C5>50,”PASS”,IF(C5<50,”FAIL”)) OR IF(C5>50,”PASS”,”FAIL”)
The inner bracket on the right should be moved to be just before the comma in order
to match all the opening and closing parenthesis pairs as follows:
=ROUND(SUM(A1:C10),0)
ii. AVERAGE(G:H4)
G alone is not a cell reference. Make sure all the arguments of a formula are entered.
Also make sure you do not enter too many arguments. In this case, we need like
=AVERAGE(G2:H4)
iii. =MAX(D12;H25)
The semi-colon cannot specify a range. Always use a full colon like:
=MAX(D12:H25)
v. Enter numbers in formulas without formatting. For example, do not enter $30 but
rather 30 in the cell.
Page 27 of 171
R. MALEMBA
COMPUTER STUDIES
ST. PATRICK’S SECONDARY SCHOOL
IDENTIFYING A CELL WITH A FORMULA ERROR
A cell that has a formula error can be identified by a small triangle in its top left corner.
This occurs when a number is divided by zero (0). The formula may be referencing an
empty cell that does not contain a value or one that has a zero.
To correct this condition, click the cell that has the faulty formula. The ! Button
appears next to the cell.
Click it and select the Show Calculation Steps command in the content sensitive
menu that appears.
This will display the arguments of the formula and their values, allowing you to
correct.
ii. #N/A
This error occurs when a value is not available to a function or formula and #N/A or
N/A() has been entered in the cell as placeholder text.
To resolve this, click the cell that has the formula, click the ! icon and select the Show
Calculation Step option.
iii. #NAME?
It occurs when certain text in the formula cannot be recognised as being valid.
Mistakes may include referring to a named cell or range that does not exist,
misspelling a function name, omitting a colon in a range reference etc.
i. Click the cell or select the range referred to by the formula then,
ii. Click the Name box and type a name for the cell or range then press enter key
to effect the new name.
Page 28 of 171
R. MALEMBA
COMPUTER STUDIES
ST. PATRICK’S SECONDARY SCHOOL
iv. #NUM!
The error indicates that there are invalid numeric entries in a cell.
This may also be caused by using a function that returns a number that is too large or
too small to be represented in Excel.
v. #REF!
vi. #VALUE!
vii. #####
This means that the column width is not wide enough to display a value. The same
occurs when a negative time or date is entered in a cell
vii. Circular references
This occurs when the cell reference in which the formula is entered is also included as
part of the formula arguments. i.e. the formula refers back to its own cell either
directly or indirectly.
Remove circular references to solve this problem.
Page 29 of 171
R. MALEMBA
COMPUTER STUDIES
ST. PATRICK’S SECONDARY SCHOOL
To install a fresh copy of windows, the computer should be setup to boot from a DVD
then proceed as follows:
1. Insert the disk in optical drive and start the computer. After the Power On Self-Test
(POST) process, the computer initializes the boot process. After a few minutes,
Windows 7 installation screen shown in figure below is displayed. Set the language
and time zone and click Next. In our case, choose Central Africa Time (CAT) zone.
2. After clicking Install Now, read the Microsoft User-license agreement terms and click
the box against “I Accept the License Terms” as shown below.
Page 31 of 171
R. MALEMBA
COMPUTER STUDIES
ST. PATRICK’S SECONDARY SCHOOL
4. Next, partition the drive into two or more drives (volumes) using NTF file system and
then click Format.
Page 32 of 171
R. MALEMBA
COMPUTER STUDIES
ST. PATRICK’S SECONDARY SCHOOL
5. Windows 7 automatically format the first drive usually labelled Drive C as the
primary drive and copies the installation files onto the partition as shown below.
6. After the copy process is complete, it prompts you to enter username, password and
the license key. You must enter the license key that came with the product to install a
genuine copy of Windows 7.
Page 33 of 171
R. MALEMBA
COMPUTER STUDIES
ST. PATRICK’S SECONDARY SCHOOL
7. Follow the windows installation process and provide all the necessary information.
This process is generally wizard driven and only requires minimal interactions where
necessary.
8. Once installation is successfully done, connect to the Internet to install importance
updates or skip the update procedure and enter the password to login to the desktop as
shown below.
CONFIGURING WINDOWS
A part from working with files, folders and drivers, windows provide the user with tools
that can be used to customize the desktop.
Windows 7 lets the user change desktop appearance and display properties such as icons,
themes and wallpaper.
Such features include:
1. Arranging multiple application windows on the desktop
2. Changing the desktop appearance
3. Setting resolution
4. Hiding the taskbar
5. Setting screen saver e.t.c.
All these features can be set by Right-clicking the desktop then click Personalized.
The control panel shown in figure below is displayed:
Page 34 of 171
R. MALEMBA
COMPUTER STUDIES
ST. PATRICK’S SECONDARY SCHOOL
Page 35 of 171
R. MALEMBA
COMPUTER STUDIES
ST. PATRICK’S SECONDARY SCHOOL
To change mouse settings:
i. In the Personalization window, click Change mouse pointers.
ii. In the dialog box displayed below, click the tab for the settings you wish to change.
For example, to change the default mouse button from left to right, click the Buttons
tab.
iii. Click Apply to see the changes before you close the dialog box.
iv. Click OK to close the dialog box.
INSTALLING UBUNTU
The word Ubuntu comes from an ancient African word meaning ‘humanity to others’
Ubuntu is an open source operating system that brings the spirit of humanity to the world
of computing.
Page 37 of 171
R. MALEMBA
COMPUTER STUDIES
ST. PATRICK’S SECONDARY SCHOOL
It is linux-based distribution available freely and can be installed in computers and
phones.
Before installing Ubuntu, read the guide that comes with the software to see whether the
computer meets the specification e.g. processor type, memory capacity and hard disk
space
To install Ubuntu, proceed as follows:
1. Switch on your computer and insert the disk that contains Ubuntu installation files.
You will see a welcome screen prompting you to choose preferred language and the
option to install Ubuntu or try it from the CD as shown in the figure below.
NB: If the computer does not automatically display this screen, press F12 key to
display the boot menu, but be careful not to hold it down.
2. If the Internet is available, connect to the internet so that Ubuntu gets the latest
updates while installing. Figure below shows the installation screen from which you
can choose the type of internet connection such as wireless LAN. If you do not want
to setup internet connectivity, press the Continue button.
Page 38 of 171
R. MALEMBA
COMPUTER STUDIES
ST. PATRICK’S SECONDARY SCHOOL
3. On the displayed dialog box, select the type of installation i.e. Install Ubuntu
alongside Windows 7 or replace Windows 7 with Ubuntu operating system. This
means that Ubuntu will be installed as a duo-boot option in Windows.
Page 39 of 171
R. MALEMBA
COMPUTER STUDIES
ST. PATRICK’S SECONDARY SCHOOL
4. Depending on the type of installation selected, verify the type of installation chosen,
and then click Continue button.
5. Click Install Now and installation process will start automatically. Note that Ubuntu
14 requires about 4.8 GB to install, so add a few extra storage to allow extra files. The
rest of the process is automated.
6. Select the location so that Ubuntu set the correct date and time. For example, Malawi
uses Central Africa Time Zone that is (UTC +02:00). UTC stands for Universal Time
Zone that replaced the GMT (Greenwich Meridian Time). Click Continue to go to the
next screen.
Page 40 of 171
R. MALEMBA
COMPUTER STUDIES
ST. PATRICK’S SECONDARY SCHOOL
7. Then select preferred keyboard layout. In Malawi, the default layout is English UK
but you can also choose any other layout. Click Continue to proceed.
8. Then setup the login. Enter your names, preferred computer name, username and
password.
Page 41 of 171
R. MALEMBA
COMPUTER STUDIES
ST. PATRICK’S SECONDARY SCHOOL
10. Once the installation is complete, click Start Now to restart your computer. During
startup, a startup screen is displayed that lets a user boot from Windows or Ubuntu.
Page 42 of 171
R. MALEMBA
COMPUTER STUDIES
ST. PATRICK’S SECONDARY SCHOOL
Boot from Ubuntu to start enjoying Ubuntu-The True African Spirit of Humanity to
All!
INSTALLING DEVICE DRIVER
During installation of these software, a computer is tested whether it has required
hardware, operating system and device drivers.
INSTALLING DEVICE DRIVERS
Once you installed operating system, you can proceed by installing device drivers and
other utility programs like antivirus.
A device driver is a utility program that controls a device installed in a computer
For devices such as printer, a keyboard, a flash, a mouse and/or a scanner to work, its
drivers must be installed first
A device driver acts as a translator between a device and the program that use the device.
Common devices such as mouse, keyboard, monitor and flash disks are automatically
recognized by most operating system through a process called plug and play (PnP)
There are many ways of installing device drives but the most common is through
installation wizard.
For example, to install printer drivers, proceed as follows:
1. If the printer drivers are not in Windows, insert the disk that came with the device
printer. Figure below shows examples of printer drivers that are pre-loaded in
Windows 7.
Page 43 of 171
R. MALEMBA
COMPUTER STUDIES
ST. PATRICK’S SECONDARY SCHOOL
2. After verifying that the drivers are in windows device drivers profile, click Devices
and Printers from a Start menu
3. In the Devices and Printers window displayed, Click Add Printer and then choose
Add local printer. Click Next to proceed.
4. Under choose printer port, specify the port into which the printer will be connected to
e.g. USB as shown below. This is very important because specifying a wrong port e.g.
LPTI instead of USB means the printer will not work.
Page 44 of 171
R. MALEMBA
COMPUTER STUDIES
ST. PATRICK’S SECONDARY SCHOOL
5. Then specify the manufacturer and printer type, then click Next to proceed
6. In the dialog box that appears, type the name of the printer and click Next to start
installation process.
7. Once installation finishes, a test page print dialog box appears as shown below. It is
important to print a test page to be sure the drivers are successfully installed.
Page 45 of 171
R. MALEMBA
COMPUTER STUDIES
ST. PATRICK’S SECONDARY SCHOOL
8. Read and agree with the user license agreements and click Next
9. Follow the instructions as directed by the wizard
10. Click Restart if the installation requires computer to restart to finish the
configuration.
NB: For device driver installation process to be completed, you may be required to restart
the computer. Make sure you save any important task before you click the restart button
or alert.
INSTALLING APPLICATION SOFTWARE
Most application software available in the market include: word processor, spreadsheet,
database management system, desktop publishing software, education software etc.
In this section, we will learn how to select and install application software such as
Microsoft Office 2010.
Factors which determine kind of application software to install are:
1. Cost of the software
2. Authenticity
3. User documentation
4. Reliability
5. User-friendliness
6. Compatibility
7. System configuration
8. User need
9. Purpose
According to purpose, application software can be categorized into two:
1. General purpose application software: such as word, spreadsheet, database and
presentation that are packed and made available for general use.
2. Special purpose application software: these are application software designed
purposely to handle specialized tasks e.g. desktop publishing software (DTPs), graphic
editing software and anti-virus software.
Page 46 of 171
R. MALEMBA
COMPUTER STUDIES
ST. PATRICK’S SECONDARY SCHOOL
2. Once you agree to the terms, installation dialog box is displayed to choose whether to
Upgrade an existing version or fresh installation called Customize.
Page 47 of 171
R. MALEMBA
COMPUTER STUDIES
ST. PATRICK’S SECONDARY SCHOOL
3. Once you choose Customize, the Microsoft deletes the previous office
4. After choosing the installation option, click Upgrade or install Now to proceed. The
rest of the process is wizard driven.
5. Installation process starts and it takes several minutes depending on the options
selected and the computer hardware configuration. Once the installation is completed,
you may be required to check for updates. If connected to Internet, ensure that the
“check web for updates” check box is enabled otherwise click Close.
Page 48 of 171
R. MALEMBA
COMPUTER STUDIES
ST. PATRICK’S SECONDARY SCHOOL
6. To confirm that Office 2010 has been installed, display the Start menu and then point
to All Programs/Programs. The list of applications including newly installed is
displayed on the start menu.
After the installation completes the first time to open the software to use will ask you to
enter product key.
It is important for each software to have a product key because it helps you to install
original copy of the software not trial versions
NB: The steps outlined are specific to Microsoft Office 2010 and may vary depending on the
version of Microsoft Office and type of user license.
Page 49 of 171
R. MALEMBA
COMPUTER STUDIES
ST. PATRICK’S SECONDARY SCHOOL
TOPIC 3: PROGRAMING FUNDAMENTALS
INTRODUCTION
To process any type of data a computer flows a set of a well-defined instructions known
as program
Creating a program requires a programmer to provide design of the program called
algorithm
The process of designing the program is called algorithm design
Algorithm design is both a science and an art because scientific approach and creative
thinking is required to come-up with a good design.
DEFINITION OF TERMS USED IN PROGRAMMING
In programming, there are fundamental terms used in programming regardless of the
programming language used. The following are some of them
COMPUTER PROGRAM
A computer program or just a program refers to set of instructions written using
programming languages to instruct a computer to perform task.
A collection of computer programs and related data is referred to as the SOFTWARE.
PROGRAMMING LANGUAGES
Just like a formal language, programming language is a formal language that specify the
syntax and semantics rules for writing computer programs.
Some examples of programming languages are: BASIC, C, C++, Java, Pascal,
FORTRAIN and COBOL etc.
COMPUTER PROGRAMMING
Is a process of writing a computer program using a programming language.
The person who writes programs is referred to as a programmer or software developer
or software engineer.
SOURCE CODE
Source code refers to a set of instructions or statement written by a programmer that are
not yet translated into machine-readable form.
Source code is mostly a text file written using programming language like BASIC.
Page 50 of 171
R. MALEMBA
COMPUTER STUDIES
ST. PATRICK’S SECONDARY SCHOOL
OBJECT CODE
This is a source code that has been converted into machine readable form.
To convert source code to object code, language translator such as interpreter, assembler
and compiler are used.
ASSEMBLER
An assembler converts assembly language program into machine readable form that
computer can understand and execute.
INTERPRETER
An interpreter converts the source code into machine code statement-by-statement
allowing the CPU to execute one line at a time.
The interpreted line is not stored in the computer
This means that every time the program is needed for execution, each line has to be
interpreted.
This method of interpreting program was common in early computers that did not have
enough memory to store the object code.
COMPILER
A compiler converts the entire source code into object code.
The object code is made into an executable file by carrying out a process called linking
which combine object code with library files required for execution of the program.
After linking process, an executable file is generated and is stored in storage media with
file extension as .exe file in Windows operating system environment.
The figure below illustrates how a compiler converts source code to executable file.
preprocess
Compile
libraries Link(linker) Load to RAM
Page 51 of 171
R. MALEMBA
COMPUTER STUDIES
ST. PATRICK’S SECONDARY SCHOOL
DIFFERENCES BETWEEN A COMPILER AND AN INTERPRETER
INTERPRETER COMPILER
Translates the source Translates the entire source code at once before
program one statement at a execution.
time.
Translates the program each Compiled program (object code) can be saved on a
time it is run hence slower storage media and run as required, hence executes
than compiling. faster than interpreted programs
Interpreted object code takes Compiled programs require more memory as the object
less memory compared to files are larger.
compiled program
Page 52 of 171
R. MALEMBA
COMPUTER STUDIES
ST. PATRICK’S SECONDARY SCHOOL
Machine languages are hard for a person to understand what the program is all about
unless they have knowledge of machine level programming.
Furthermore, different CPU’s understand different machine language e.g. code for intel
Pentium processors may differ from Motorola processor.
Therefore, before writing the machine code, the programmer has to know for which
CPU the program is written.
Such programs are hard to write and debug from programmer’s point of view, but are
easy to execute from the computer’s perspective.
ADVANTAGES OF 1 GL
i. Fast and efficient as statements are directly written in binary code
ii. No translator is required
DISADVANTAGES OF 1 GL
i. Difficult to use and learn binary codes
ii. Difficult to understand -both programs and correcting errors
iii. Machine dependent-they are not portable from one computer to another
iv. Require highly trained programmers both to develop and maintain
ii. ASSEMBLY LANGUAGE (SECOND GENERATION LANGUAGES)
Assembly language was developed to overcome the difficulties of understanding and
using machine language.
Page 53 of 171
R. MALEMBA
COMPUTER STUDIES
ST. PATRICK’S SECONDARY SCHOOL
This language allows the programmer to write the programs as set of symbolic operation
codes called mnemonics.
Mnemonics are basically shortened two to three letter words.
A program written in assembly language may look like the one below:
Page 55 of 171
R. MALEMBA
COMPUTER STUDIES
ST. PATRICK’S SECONDARY SCHOOL
Page 57 of 171
R. MALEMBA
COMPUTER STUDIES
ST. PATRICK’S SECONDARY SCHOOL
ADVANTAGES OF 5GL
i. Machines can make decisions
ii. Programmer effort reduces to solve a problem
iii. Easier to learn and use than 3GL or 4GL
DISADVANTAGES OF 5GL
i. Complex and long code
ii. More resources are required and they are expensive too
OBJECT-ORIENTED PROGRAMMING (OOP)
Currently, there is shift from structured programming championed in 1970s using 3GLs to
object-oriented programming (OOP).
In OOP, program may consist of several objects that interact by sending messages to each
other.
This is similar to the way a person considered as an object sends a message to another
person requesting for something to be done.
Several objects are linked together through a method known as association to create a
complete program.
It is important to note that OOP is not classified as a separate generation because it is a
shift in program development methodology.
Most programming languages that supported structured programming like C are enhanced
to support Object-oriented programming.
Examples of OOP are: Java, Microsoft Visual Basic. Net, Objective-C, C++, C#, python,
Perl, Ruby, Delphi Pascal and Smalltalk.
WEB DEVELOPMENT AND SCRIPTING LANGUAGES
Web scripting languages are used to develop or add functionality on web pages.
Web pages are hypertext documents created using Hypertext Markup Language (HTML)
HTML contains tags that are interpreted by the web browser software to display contents
when the file is opened on the browser.
Page 58 of 171
R. MALEMBA
COMPUTER STUDIES
ST. PATRICK’S SECONDARY SCHOOL
A tag is a symbolic, word or character enclosed in angle bracket <> that a browser can
interpret it as a command.
Other languages such as Extended HTML (XML) works also like HTML only that XML
allows the users to define their on tags instead of using standard HTML tags.
HTML is not considered as programming language because it does not have declaration
part and control structures.
To add functionality to HTML, scripting languages are used such as JavaScript, VBScript
and Hypertext Preprocessor (PHP).
A script is a small program code written using scripting language then appended into
HTML program to add functionality like sliding calendar and form validation.
HTML has an opening tag <> and closing tag </>
EXAMPLES OF HTML TAGS
TAG MEANING
<html> </html> Marks the beginning and end of an HTML document. All other tags
and text fall between these two tags.
<head> </head> Marks the header part of the document.
<title> </title> Gives the title of the web page. Text between this tag appears in the
title bar when the page is browsed
<body> </body> Marks the content part of the web page.
Page 59 of 171
R. MALEMBA
COMPUTER STUDIES
ST. PATRICK’S SECONDARY SCHOOL
</html>
3. Save a file as helloworld.html, on a desktop
Whew! You have created a web page!
ADVANTAGES OF HIGH-LEVEL LANGUAGES
i. High-level languages are portable i.e. can be installed in more than one computer
ii. High-level languages are user friendly, and easy to learn and use
iii. High-level languages are more flexible. They enhance creativity and innovation of the
programmer and increase productivity in the workplace
iv. It is easier to correct errors
DISADVANTAGES OF HIGH-LEVEL LANGUAGES
i. Their nature encourages use of many instructions in a statement hence the size of these
instructions slowers program processing.
ii. These languages need more hardware and software resources because programs have to
be interpreted or compiled to machine form before execution.
iii. They require large computer memory to be executed
PROGRAM DEVELOPMENT PROCESS
There are five main phases of program development life-cycle (PDLC)
1. Problem definition
2. Algorithm design
3. Program coding
4. Program testing and debugging
5. Program review and maintenance
1. PROBLEM DEFINITION
Problem definition refers to one’s ability to identify a problem that need to be solved
using a computer program.
A creative programmer seeks to identify problems and opportunities in the society and
seeks to provide computer based solution.
A good example is the one who developed Microsoft Word software after seeing the
tedious work of writing using typewriter, he came up with software to be used for
typing.
Page 60 of 171
R. MALEMBA
COMPUTER STUDIES
ST. PATRICK’S SECONDARY SCHOOL
The following three situations may motivate a programmer to develop computer
program:
i. Problems or undesirable situations that prevent an individual or organization from
achieving their goal
ii. Opportunity to improve the current system
iii. New directive given by the management or government requiring change in the
status quo.
For example, consider a mathematical problem such as calculating the area of a circle.
In this case the problem is finding the area of a circle.
For such a problem, a programmer must conceptualize the solution by first
understanding the problem, then identify input, processing logic and the expected
output.
INPUT: 1. Pie π which is a constant
2. The radius of the circle
PROCESS: The formula for calculating area of a circle ( π × radius × radius )
OUTPUT: Area of the circle (A)
A problem definition stage ends with documenting hardware and software requirements
necessary for solving the problem.
It is this document that enable a programmer to develop an algorithm for implementing
the solution.
2. ALGORITHM DESIGN
After the programmer identifies a problem, the next step is to design the solution for
solving the problem called algorithm.
An algorithm is a well-defined step for performing a task or solving problem.
The algorithm is designed using the following:
i. Flowcharts
ii. Pseudocode
iii. Structured English statements
For example, to calculate area of a circle, a programmer may use the pseudocode below
to outline steps the programmer will follow to calculate the area
Page 61 of 171
R. MALEMBA
COMPUTER STUDIES
ST. PATRICK’S SECONDARY SCHOOL
Program: Calculate area of a circle.
BEGIN
SET as constant PI= 3.142
PRINT “enter radius”
READ radius
Area = PI × radius
PRINT area
END
The above algorithm starts with a declaration on the task to be performed by the
program.
The statement SET indicates that 3.142 is a constant represented using a symbolic name
PI.
The phrases within the BEGIN and END denotes the executed statements for input, i.e.
PRINT radius; process (area = PI × radius); and output, i.e., PRINT area.
Before coding, the algorithm should be tested for logical error
3. PROGRAM CODING
This is the stage of writing the program code using programming languages e.g. C, C++,
e.t.c.
The source code written by the programmer need to be converted to object code using
language translators like compiler, interpreter or assembler.
Most programming languages have common elements and the following are some of
them:
1. Reserved words: Also referred to as keywords have special meaning and can only
be used for intended purpose. Some examples are: for, if, else, while and do
2. Identifiers: Identifiers are programmer defined symbolic names used to identify
elements like variables and constants.
3. Operators: Are used to perform arithmetic operations e.g. +, *, /, =, and –
4. Variable: Is a named location in computer’s memory for holding data. The contents
in variables may change during execution unlike constants whose contents do not
change.
Page 62 of 171
R. MALEMBA
COMPUTER STUDIES
ST. PATRICK’S SECONDARY SCHOOL
Unlike other programming languages like Pascal, other programming languages are case
sensitive so when writing need to be careful with spellings and use of capital letters and
small letters. This means that the word “cout” is different from the word “COUT”.
4. PROGRAM TESTING AND DEBUGGING
Testing is the process of tracing or checking whether the program has errors (bugs)
while debugging is the process of correcting identified program errors.
Types of errors (bugs) that may be encountered when testing the program:
i. Syntax errors
ii. Logical errors (semantic errors)
i. SYNTAX ERRORS
These are errors that emanate from improper use of language rules e.g. grammatical
mistake, punctuation, improper naming of variables and misspelling of identifiers and
reserved words.
Syntax errors are detectable by the compiler or an interpreter and must be corrected
before the program runs.
ii. LOGICAL ERRORS
These errors are not detectable by the compiler or interpreter.
The program runs but gives wrong output or halts during execution.
DIFFERENCES BETWEEN SYNTAX AND LOGICAL ERRORS
1. Syntax error are detectable by the compiler or interpreter while logical errors are not
detectable by the compiler or interpreter
2. In syntax error the errors are detected before the program runs while logical errors are
detected after the program runs
3. Syntax errors result from improper use of language rules while logical errors result from
improper coding
TRACING PROGRAM ERRORS
Tracing program errors requires careful step-by-step trace of input, processing and output
statements.
The following is a three-step process of testing an algorithm or program for errors.
i. Dry-run (Desk check)
Page 63 of 171
R. MALEMBA
COMPUTER STUDIES
ST. PATRICK’S SECONDARY SCHOOL
ii. Debugging
iii. Test data
DRY-RUN (DESK CHECKING)
Involves using a trace table to check whether an algorithm or program has errors before
writing it in the program editor.
A good practice in using trace table is to go through an algorithm line by line exactly a
computer would.
This helps the programmer to identify syntax and logical errors.
DEBUGGING
Once a program is written in the program editor, the programmer debugs the code.
The programmer uses debugging utilities to detect and correct syntax errors before
compiling the source code into object code.
TEST DATA
After the program compiles successfully, the programmer carries out trial run using test
data to check for logical and run-time errors.
The programmer tries to enter valid and invalid data to check whether the program
produces desired output.
5. PROGRAM REVIEW AND MAINTENANCE
Review and maintenance refers to continuous update and fixing of program errors after
installation.
You may continue fixing and updating the program until it reaches a point where the
program has to be replaced.
At this point, maintenance stops and the program development life cycle starts all over
again.
CHARACTERISTICS OF A GOOD PROGRAM
1. Simplicity: a program should be kept as simple and easy to understand.
2. Integrity: this refers to reliability and accuracy of data. Therefore, mathematical
statements should be tested for the accuracy of output.
3. Efficiency: Good program design should aim at optimizing execution speed and memory
utilization to enhance performance.
Page 64 of 171
R. MALEMBA
COMPUTER STUDIES
ST. PATRICK’S SECONDARY SCHOOL
4. Clarity: The statements and comments should be clearly written for it to be readable.
5. Modularity: Complex programs should be broken down into components known as
modules or procedures or sub-programs.
PROGRAMMING IN VISUAL BASIC
BASIC is an acronym for Beginner’s All-purpose Symbolic Instruction Code.
BASIC has many dialects such as Microsoft Visual Basic (VB), GW-BASIC, Q-BASIC
and Turbo Basic.
Microsoft Visual Basic is a member of Microsoft software development suite known as
Microsoft Visual Studio.
MICROSOFT VISUAL BASIC .NET
Microsoft Visual Basic .Net, simply referred to as VB.NET is a GUI-based programming
language mainly for developing applications meant to run on Microsoft Windows
platforms (OS).
MAIN FEATURES OF VB.NET
i. It is an event driven programming language
An event is a response generated by the program when the user performs an action.
e.g. A mouse click is an action and its response may be a menu being displayed on the
screen.
ii. It is a collection of tools that are used by programmers
These tools are also called controls
The controls are easily accessed by clicking their icons on the toolbox
iii. It has objects called Forms that have a title bar at the top
The programmer can add controls such as Menu bar, Status bar and buttons onto the
form when creating an application
iv. It is an object oriented programming language implemented using a framework known as
.NET
This means that applications developed in VB.NET can also run on internet
BASIC SYNTAX OF VB.NET PROGRAM
VB.NET is an object-oriented programming language
Page 65 of 171
R. MALEMBA
COMPUTER STUDIES
ST. PATRICK’S SECONDARY SCHOOL
In OOP, program consists of various objects that interact with each other by means of
message passing
Objects of the same type belong to the same class just like human beings belong to class
called animals
The following are the basic concepts relative to VB.NET programming language
CLASS
A class is a template or collection of behaviours (methods) and state (variables) that
defines a set of objects.
For example, let’s consider the “Form3 students”. We can define a template called
“Exam” with columns student name, marks, and grade in which you can add or delete
students’ details. Such a blank template represents the concept “class” in OOP.
OBJECT
An object is an instance of a class that has state (data) and behaviour functions
For example, a particular student in Form 3 is an object who has state or data such as
surname, marks, and grade
The student object belongs to a class that has behaviour or functions such as walking and
speaking that is not in plants class
METHODS
A method defines the behaviour or function to be performed by an object to manipulate
data
For example, we can define a method to add, delete or modify student details in a class
The class must define methods that are common to all the objects that belong to the class
Therefore, it is in methods where the program statements that manipulate data are written
VARIABLES
Each object has its unique set of variables that are used to hold data
Data values received by methods are assigned to these variables
COMMENTS
These are set of statements used in the code to explain what a program or statement does
The comments are ignored by the compiler during execution
In Visual Basic, a comment starts with a single apostrophe (‘) followed by the statement
STRUCTURE OF VB PROGRAM
Page 66 of 171
R. MALEMBA
COMPUTER STUDIES
ST. PATRICK’S SECONDARY SCHOOL
VB program has:
i. Namespace declaration
ii. A class or module
iii. Variables
iv. Executable statements
v. Comments
GETTING STARTED WITH VB.NET 2010
You can start Visual Basic.Net from the programs menu by pointing to Microsoft Visual
Studio and then selecting Microsoft Visual Basic 2010 Professional or Express. Here we
are going to use Professional.
Depending on the way the application has been setup, you may see the New Project
window as shown below:
This window lets the programmer create a new project or open an existing Visual Basic
application.
Page 67 of 171
R. MALEMBA
COMPUTER STUDIES
ST. PATRICK’S SECONDARY SCHOOL
In VB, an application is referred to as a project because it comprises of several files.
CREATING A NEW PROJECT
1. Start Ms visual studio and then select Visual Basic.
2. On the Start page window, click New Project icon on the top left-hand side to display
several types of projects identified by different icons as shown below:
Note that, two environment components used to develop Visual Basic application are
the Windows Form and Console Applications.
While Form Application are GUI-based programs, Console Applications are
command line-based applications.
In this unit we will learn programming using Form Application.
3. Select the Windows Form Application and type the name at the bottom of the dialog box,
type the name of the application that will replace the default name “WindowsApplication
1” e.g. hello world.
Page 68 of 171
R. MALEMBA
COMPUTER STUDIES
ST. PATRICK’S SECONDARY SCHOOL
4. Then click OK button, the Visual Basic Integrated Development Environment (IDE) is
displayed.
The term IDE refers to programming environment that provides programmers with
several programming features such as source code editor, debugger and compiler.
Page 69 of 171
R. MALEMBA
COMPUTER STUDIES
ST. PATRICK’S SECONDARY SCHOOL
The toolbox shown on the right of the form has most of the tools required for programmer
to create the application.
The following is a list of tools that you can use to create a program by placing their
controls on the form.
In object-oriented programming, a control is an instance of an object that appears on the
form.
For example, Save button is an instance of command button.
i. Label
Label tool is used to place controls that explain the content of other controls on the form
For example, if a textbox contains surnames, a label against it indicates that surname
should be provided.
ii. TextBox
Textbox tool is one of those frequently used tools to draw text boxes in which the user
provide input
iii. Button
This tool is used to place command instances on the form.
Such commands include OK, SAVE, EXIT, CLOSE etc
This tool is used to interact with an application
iv. CheckBox
Checkbox control provides a way of choosing multiple values by clicking on the check
boxes
v. DateTimePicker
Page 70 of 171
R. MALEMBA
COMPUTER STUDIES
ST. PATRICK’S SECONDARY SCHOOL
This control is used to place a control on the form that a user can click to display a
dropdown calendar from which to choose DAY, MONTH or YEAR
vi. HScrolLBar
This tool is used to place horizontal scroll bar.
vii. ListBox
The listbox tool is used to draw controls that display list of items the user can select
from.
viii. ComboBox
A combobox is a type of list box that combines the capabilities of a text box and a list
box.
A combo box displays a list of items to select from during program execution.
Items can also be added into the combo box
SOLUTION EXPLORER
The solution explorer is shown on the top right of the IDE window
It displays a list of objects associated with the open project such as forms and modules
CODE WINDOW
The code window is displayed once you double click an object
This is where we write the source code that instructs the program what to do.
PROPERTIES
The properties window is used to define properties of each object in an application
After you place an instance of an object, you must define its properties such as name,
colour.
EXAMPLE
QUESTION: Create a program that calculates area of a circle given that PI = 22/7.
Page 71 of 171
R. MALEMBA
COMPUTER STUDIES
ST. PATRICK’S SECONDARY SCHOOL
SOLUTION
1. Start Visual Basic and choose New project on the Start Page. Then Visual Basic then
Windows Application Form
2. From the toolbox, use the label, textbox and button tools to design the form
3. Change the name and text (caption) properties of the control to look as shown below;
4. Double click the button and insert the code below between the Private Sub and End Sub
Dim Radius As Integer
Dim Area As Double
Const PI As Double = 22/7
Radius = Val(txtRadius.Text)
Area = PI*Radius*radius
txtCircleArea.Text = Str(Area)
5. Run the program, enter 7 into Radius textbox and then click the calculate button. The
result of the calculation is displayed in the Area text box as shown below;
Page 72 of 171
R. MALEMBA
COMPUTER STUDIES
ST. PATRICK’S SECONDARY SCHOOL
PROGRAM DESCRIPTION
DECLARATION
In programming, declaration is an instruction to the compiler to reserve memory enough
to store input or output from a computer program.
For a computer to reserve enough memory, you have to specify the type of data to be held
in specific memory address
e.g. Dim Radius As Integer
In this case the variable Radius has been declared to receive integer values.
VARIABLES
A variable is a name or identifier that is used to represent a memory location whose
content may change during program execution
When a variable is declared, the computer sets aside memory space to hold a value in the
variable.
From the example above, Area and Radius are variables.
In VB, a variable is declared using the reserved word DIM, a short form for dimension.
It is used to associate a variable with specific data type.
RULES FOLLOWED WHEN DECLARING VARIABLES IN VB
The variable name must not have more than 255 characters
The variable name must start with a letter
Page 73 of 171
R. MALEMBA
COMPUTER STUDIES
ST. PATRICK’S SECONDARY SCHOOL
The variable may be declared using mixed, lower or upper case because VB is not a case
sensitive.
A variable name must not be a reserved word. e.g. Case, Else, Dim
Variable names should not have spaces. If two or more words are to be used to create a
variable, use underscore or combine them with each word starting in upper case
In VB, a variable is declared using the reserved word Dim
Dim is short form of the word dimension
So, the first line instructs the compiler to reserve memory location named Radius that
stores an integer.
VB DATA TYPES
Integer A whole number with no fraction part. Integers range from -32768 to
32768
Long integer Numbers which are integers but have a bigger value and range. From -
2,147,483,648 to 2,147,483,647
Single Real constant that includes a fractional part. The largest value is
38
3.4 × 10
Double It includes a fractional part but has far much larger range than single real
numbers. However, it cannot be larger than 1.2 ×10308
Boolean Data types that have only two logical states i.e true or false
VARIANTS
In VB, if a variable type is not explicitly declared, the compiler uses variant as data type.
Page 74 of 171
R. MALEMBA
COMPUTER STUDIES
ST. PATRICK’S SECONDARY SCHOOL
A variant is a special type used if the programmer does not declare a variable data type to
be integer, string or the other types discussed above.
In this case, the actual data type is determined by the value held by the variable.
CONSTANTS
A constant is a value such as PI (3.14) that does not change during execution of a program
In VB the key word Const that comes before PI is used to declare the value as a constant
e.g. Const PI As Double = 22/7
STRING CONSTANTS
A string is a sequence of characters enclosed in double quotation marks.
Strings are used to write alphanumeric values that cannot be manipulated mathematically
such as phone numbers, addresses and names.
Examples include; “Holiday season”, “345678”, “MW7 200”
NUMERIC CONSTANTS
Numbers that can be manipulated mathematically are referred to as numeric constants.
Numeric constants do not include letters and should not be enclosed in quotation marks.
They can only be of integer, double or scientific type as shown bellow
e.g. 0, 3, +70, 1.4E+2, -0.70456
NAMED CONSTANTS
A named constant is a value given a symbolic name rather than its actual value.
22
For example, PI is a named constant used to represent the quotient of .
7
SCOPE DECLARATION
Scope refers to the portion of the program that a variable or a constant is accessible by the
program
The following terms are used to specify the scope of a variable or constant:
i. Local variables or constants
ii. Global variables or constants
LOCAL VARIABLES OR CONSTANTS
A variable or a constant that is declared within a function is said to be local
This means that the variable can only be accessed within that function
Page 75 of 171
R. MALEMBA
COMPUTER STUDIES
ST. PATRICK’S SECONDARY SCHOOL
GLOBAL VARIABLES OR CONSTANTS
A variable or constant that is declared outside the function or module but within the same
application is said to be global
Such variables can be accessed by other methods within the project
In visual basic, variables can also be declared as either private (local) or public (global)
e.g. Private Dim X As Integer
Public Dim Y As String
In the first declaration, the private variable X can only be accessed in the module within it
is declared.
In the second example, the variable Y is public hence it can be accessed by other methods
or modules in the application.
ASSIGNMENT
In VB, assignment is done using an assignment operator (=).
e.g Radius = Val(txtRadius.Text)
X=X+1
In the first example, whatever is in the right side is assigned to the left side as (Radius)
In the second example, X=X+1 does not make mathematical sense but this is the beauty of
assignment statement in programming.
The statement can be interpreted as: Add 1 to the original value of X and assign the new
value to X. in other words, increment the value of X by 1.
USER-DEFINED DATA TYPES
Sometimes, a programmer may want to have a single variable that can store several
variables of the same or different data type.
Such data type made up of multiple variable components are referred to as user-defined
data types.
Some examples of user defined data types are records, arrays, enumerated types and lists.
DECLARATION USING SUFFIXES
Suffixes are special symbols added at the end of a variable or constant in order to
associate it with a particular data type. This makes programming easier and faster.
Page 76 of 171
R. MALEMBA
COMPUTER STUDIES
ST. PATRICK’S SECONDARY SCHOOL
SOME COMMON SUFFIXES
SUFFIX DATA TYPE LONG DECLARATION SHORT DECLARATION
% Integer Dim A As Integer A%
! Single Dim X As Single X!
$ String Dim Q As String Q$
& Long integer Dim C As Long integer C&
# Double Dim P As Double P#
Page 77 of 171
R. MALEMBA
COMPUTER STUDIES
ST. PATRICK’S SECONDARY SCHOOL
OPENING EXISTING PROJECT
You can open a VB project when Visual Basic starts or from the file menu.
To open a project during startup, proceed as follows:
i. On the Project window, click Open Project button. A list of folders for each project
is displayed.
ii. Double click the folder that contains the project you want to open and then select the
file with extension .vbproj.
iii. Alternatively, if Visual Basic is open, close all other projects, and then click Open
Project on the File menu. Open Project dialog box appears from which you can select
the project you wish to open.
ADDING NEW FORMS
Visual Basic project may require the use of more than one form.
To add a form to a project, proceed as follows:
i. On the Project menu, click Add Windows Form. A dialog box is displayed
ii. In the dialog box, click Windows Form icon and then click the Add button to insert
the new form in design view and save it with your preferred file name.
iii. Save the new form with your preferred file name and VB extension.
iv. To make the new form executed after running the program, click Project Properties
on the Project menu.
v. Set the new form as the Startup form as shown in the figure below, and Close the
properties window.
Page 78 of 171
R. MALEMBA
COMPUTER STUDIES
ST. PATRICK’S SECONDARY SCHOOL
Page 79 of 171
R. MALEMBA
COMPUTER STUDIES
ST. PATRICK’S SECONDARY SCHOOL
* Asterisk Multiplication
/ Slash Division
NB: In an integer division using \ operator, each of the numbers being divided is first
rounded to become an integer then the quotient is truncated to an integer
2.4 2
e.g, will result in being evaluated
3.5 4
The MOD operator returns the remainder of an integer division
e.g. 4 MOD 3 returns 1 and 5 MOD 3 returns 2
PRECEDENCE OF ARITHMETIC OPERATORS
Just like in mathematics, it uses BODMAS
1 ^ Performed first
RELATIONAL OPERATORS
Page 80 of 171
R. MALEMBA
COMPUTER STUDIES
ST. PATRICK’S SECONDARY SCHOOL
A relation operator is used in an expression that returns a true or false value when
evaluated
The operators can compare numeric variables, constants or expressions
OPERATOR NAME
= Equal to
OPERATOR OPERATION
Xor Results in a condition that is true if one of the conditions is true and the
other is false
Page 81 of 171
R. MALEMBA
COMPUTER STUDIES
ST. PATRICK’S SECONDARY SCHOOL
The following are examples of compound expressions that demonstrates the use of logical
operators:
i. (X = 30) And (student = “John”): returns true only if value of X = 30 and student’s
name is John.
ii. (X = 20) And (Y = 30): returns true if value of X = 20 and Y is 30.
iii. (X=20) Or (Y<10): returns true if X is 20 and the value of Y is less than 10.
LIBRARY FUNCTIONS
Library functions also known as in-built functions are methods that have been pre-defined
and included in Visual Basic.
A library function performs a task such as calculating a mathematical expression and
returns a single value.
A function will usually have a name that can be called when needed to perform a
particular task.
A library function is accessed by its name followed by the information that must be
supplied to the function enclosed in parenthesis.
This process is called calling a function.
The variables held in the parenthesis are called arguments.
When the function is called, it uses the arguments to perform an operation and return a
value.
For example, to perform a mathematical operation, VB has library functions that starts
with Math, followed by the function name after the period. e.g. Math.Sqr ().
FUNCTION FUNCTION CALL DESCRIPTION
Round Z= Math.Round () Returns the current date
Exp Z= Math.Exp (w) Returns the exponential value of e w
Sqr Z= Math.Sqr (w) Returns the square root of w
Log Z= Math.Log(w) Returns the natural logarithm of w
Cos Z= Math.Cos(w) Returns the cosine of w
Abs Z= Math.Abs(w) Returns absolute value of w, e.g Abs(-8)=8
PI Z= Math.PI 22
Returns constant PI as =3.142…
7
Page 82 of 171
R. MALEMBA
COMPUTER STUDIES
ST. PATRICK’S SECONDARY SCHOOL
USING THE FORMAT FUNCTION
The format library function is used to display data in many different formats.
EXPRESSION SAMPLE FORMATTED OUTPUT
Print Format (16.778994, “##.##”) 16.78 (notice the rounding)
Print Format (Now, “mm-dd-yyyy”) 1-20-2005
Print Format(15678, “##,###.00”) 15,678.00
Label1.Caption = Format $ (price, “##,###.##”) 10,630.75
NB: The dollar sign may be used with the format function depending on the type of output
required. In the last low of the table above, the formatted output is displayed on a label.
CONVERTING NUMERIC STRING TO VALUE
If you enter a number in a text box it is treated as a string in VB.
The best way to convert it from string into numeric value is to use the val function.
The val function operates on the string and returns a numerical value.
For example, if the name property of a textbook is set to txtLength, then the input typed
in it can be read converted into a numeric value and assigned to variable X as follows:
X = Val(txtLength.Text)
CONVERTING NUMERIC VALUE TO STRING
To convert a number to a string (text) format, use Str(). If a particular variable has a
numeric value and you wish to display the value in a text box, you have to convert it to a
string first.
Suppose that the name of the textbox is txtArea and the numeric value is X as follows:
TxtArea.Text = Str(X) ‘convert X to string and display it in txtArea.
CONTROL STRUCTURES
In programming, control structures are constructs that determine the logical flow of
execution of program statements.
There are three types of control structures supported by most programming languages
such as VB, Pascal and C++.
i. Sequence
ii. Selection
Page 83 of 171
R. MALEMBA
COMPUTER STUDIES
ST. PATRICK’S SECONDARY SCHOOL
iii. Iteration (looping)
SEQUENCE
In sequence control structure, the computer reads instructions from a program file starting
from the first statement sequentially moving down to the last statement.
e.g.
Begin
Statement 1
Statement 2
.
.
.
Statement n
End
SELECTION
Most programs that solve real world problems gives a computer ability to make a decision
or execute statement(s) given a certain condition is satisfied.
In programming, making decision is referred to as selection. They use logical operators.
For example, consider a program to test if X is greater than 20, (X>20).
In this case, if a user enters a value of X, it is compared against 20 and the program
returns true or false depending on the outcome.
This is known as conditional evaluation where the output is a Boolean value (true or
false)
TYPES OF SELECTION STATEMENTS USED IN VB
i. IF … THEN
ii. IF … ELSE
iii. NESTED IF
iv. SELECT … CASE
Page 84 of 171
R. MALEMBA
COMPUTER STUDIES
ST. PATRICK’S SECONDARY SCHOOL
IF … THEN SELECTION
IF … THEN selection evaluates the statement within the selection body if the Boolean
value returned is true.
In this case, if the Boolean value is false, the statements are ignored.
For example, in school, the administration may decide to reward only those students who
attain a mean mark of 80% and above, he or she is rewarded while the rest are ignored.
The general structure of IF … THEN selection is:
IF <condition> THEN
<statements if true>
END IF
EXAMPLE
Write a program that prompts a user to enter a score in Computer Studies exam. If the score is
at least 50%, the program should display “PASS”.
SOLUTION
Dim Score As Integer
Score = Val(txtScore.Text)
Dim Comment As String
Comment = "PASS"
If Score >= 50 Then
txtRemarks.Text = Comment
End If
IF … ELSE SELECTION
IF … ELSE selection is suitable when there are two alternatives to choose from.
For example, in a football match, if a player does a mistake which is considered serious
by the rules of the game, he/she is given a red card. Otherwise, he/she is given a yellow
card.
The general structure of IF … ELSE selection is:
IF <condition> THEN
Page 85 of 171
R. MALEMBA
COMPUTER STUDIES
ST. PATRICK’S SECONDARY SCHOOL
<statements if true>
ELSE
<statements if false>
END IF
EXAMPLE
Write a program that prompts a user to enter a score in Computer Studies exam. If the score is
at least 50%, the program should display “PASS”, and if it is below 50% the program should
display “FAIL”.
SOLUTION
Dim Score As Integer
Score = Val(txtScore.Text)
Dim Comment As String
Comment = "PASS"
If Score >= 50 Then
txtRemarks.Text = Comment
Else
txtRemarks.Text = "FAIL“
End If
NESTED IF SELECTION
Nested IF or the IF … ELSE …IF selection is used where two or more options have to
be considered to make a selection.
The general structure is:
IF <condition> THEN
<statements>
ELSE IF <condition> THEN
<statements>
ELSE IF <condition> THEN
<statements>
ELSE <condition> THEN
Page 86 of 171
R. MALEMBA
COMPUTER STUDIES
ST. PATRICK’S SECONDARY SCHOOL
<statements>
END IF
EXAMPLE
Write a program that prompts a user to enter a score in Computer Studies exam. If the score is
at least 75%, the program should display “DISTINCTION”, if it is at least 60%, the program
should display “CREDIT”, if it is at least 50%, the program should display “PASS”, and if it is
below 50% the program should display “FAIL”.
SOLUTION
Dim Score As Integer
Score = Val(txtScore.Text)
If Score >= 101 Then
txtRemarks.Text = "INVALID INPUT"
ElseIf Score >= 75 Then
txtRemarks.Text = "DISTINCTION"
ElseIf Score >= 60 Then
txtRemarks.Text = "CREDIT"
ElseIf Score >= 50 Then
txtRemarks.Text = "PASS"
Else
txtRemarks.Text = "FAIL"
End If
SELECT … CASE
Similar to nested IF, the select case control is used in case there are several alternatives to
choose from.
However, unlike nested IF, select case uses ordinal values only
An ordinal value is one that has predecessor and successor such as integers and alphabetic
characters
For example, the predecessor of 3 is 2 and its successor is 4.
Page 87 of 171
R. MALEMBA
COMPUTER STUDIES
ST. PATRICK’S SECONDARY SCHOOL
The general structure of Select … Case is:
Page 88 of 171
R. MALEMBA
COMPUTER STUDIES
ST. PATRICK’S SECONDARY SCHOOL
Comment = “Fair” ‘assign comment Fair
Case “D”, “d”
Comment = “Poor” ‘assign comment Poor
Case Else
Comment = “Invalid grade”
End Select
‘displays the remark to pass or fail
txtRemark. Text = comment
LOOPING (ITERATION)
A loop is a control structure that causes program statement(s) to be executed several
times.
For example, assume you are writing a program that calculates cumulative sum of five
subjects for five students. To calculate the total score for each student, the program
repeatedly reads each student marks in five subjects and then calculates the total.
Visual Basic language has five types of looping control structures
TYPES OF LOOPING CONTROL STRUCTURE
i. Do While...... Loop
ii. While..... Wend
iii. Do..... Loop While
iv. Do Until....... Loop
v. For.... Next
Do While..... Loop
The Do While..... Loop is used if a condition has to be met before the statements within
the loop body are executed.
This type of loop uses a pre-test condition to determine if statements are to be executed
zero or more times.
For example, in banking, to repeatedly withdraw money on automated teller machine
(ATM) a customer must have sufficient balance in his/her account.
This can be represented as follows:
Page 89 of 171
R. MALEMBA
COMPUTER STUDIES
ST. PATRICK’S SECONDARY SCHOOL
Do WHILE balance > 0
Withdraw cash
Update balance
Loop
EXPLANATION
i. The condition balance > 0 is first tested.
ii. If it is true, the account holder is allowed to withdraw cash.
iii. The program exits the loop only when the balance falls to zero.
Do While.....Loop Syntax
Do While <condition>
<statements>
Loop
EXAMPLE
Write a VB program that displays the sum of the first 4 numbers.
SOLUTION
Dim ControlNum As Integer
Dim sum As Integer
ControlNum = 0
sum = 0
Do While ControlNum <= 4
sum = sum + ControlNum
ControlNum = ControlNum + 1
Loop
txtSum.text = Str(sum)
Page 90 of 171
R. MALEMBA
COMPUTER STUDIES
ST. PATRICK’S SECONDARY SCHOOL
While <condition>
<statements>
Wend
EXAMPLE
Dim ControlNum As Integer
Dim sum As Integer
ControlNum = 0
sum = 0
While ControlNum <= 4
sum = sum + ControlNum
ControlNum = ControlNum + 1
Wend
txtSum.text = Str(sum)
Do Until.... Loop
Just like the previous loops, Do Until.... Loop execute the statements in the body of the
loop if the condition is true.
EXAMPLE
Dim ControlNum As Integer
Dim sum As Integer
ControlNum = 0
sum = 0
Do Until ControlNum > 4
Page 91 of 171
R. MALEMBA
COMPUTER STUDIES
ST. PATRICK’S SECONDARY SCHOOL
sum = sum + ControlNum
ControlNum = ControlNum + 1
Loop
txtSum.text = Str(sum)
Do.... Loop While
Unlike the previous three loops, Do.... Loop While loop executes the statements within
the loop at least once.
This is because, this type of loop uses a post-test condition at the end of the loop block.
Do.... Loop While SYNTAX
Do
<statements>
Loop While <condition>
EXAMPLE
Dim ControlNum As Integer
Dim sum As Integer
ControlNum = 0
sum = 0
Do
sum = sum + ControlNum
ControlNum = ControlNum + 1
Loop While ControlNum <= 5
txtSum.text = Str(sum)
Page 92 of 171
R. MALEMBA
COMPUTER STUDIES
ST. PATRICK’S SECONDARY SCHOOL
The loop specifies the starting and ending values of counter variable.
The loop terminates when the counter variable reaches its ending value.
For example, to calculate the sum of 10 numbers, the For…Next loop is appropriate
because the number of looping is predefined as 10. The loop executes the statements
within the loop ten times before the total sum is displayed.
Page 93 of 171
R. MALEMBA
COMPUTER STUDIES
ST. PATRICK’S SECONDARY SCHOOL
COMMUNICATION
Communication is the process of using sound, words, symbols, signs, pictures or signals
to pass message or information from one person to another.
The message origin is called a sender or a source while the target recipient is a receiver.
The message is usually targeted for sending to the receiver.
DATA COMMUNICATION
Data communication refers to the process of transmitting data signals from one point to
another through communication channels.
TELECOMMUNICATION
This is the use of technology to enable exchange of messages in a form of data and
information over a wired or wireless communication media.
Telecommunication technology involves use of telegraph, telephone, radio television and
computer.
TELECOMMUNICATION NETWORK
A telecommunication network is an interconnection of telecommunication equipment
like telephone, mobile, radio, television and computers using transmission media or links.
The network enables flow of data or information from the source to destination.
COMPUTER NETWORK
A computer network is an interconnection of computers using transmission media and
networking devices to enable exchange of data and information.
INFORMATION AND COMMUNICATION TECHNOLOGY
Information and communication technology (ICT) refers to the convergence of computer
networks with telecommunication networks like telephone, mobile, radio, television to
provide communication platform through which people can share information.
Page 94 of 171
R. MALEMBA
COMPUTER STUDIES
ST. PATRICK’S SECONDARY SCHOOL
Today, ICT provide electronic communication such as mobile internet, electronic
commerce, instant messaging, email, internet radio and digital television broadcasts.
Page 95 of 171
R. MALEMBA
COMPUTER STUDIES
ST. PATRICK’S SECONDARY SCHOOL
MOBILE PHONES
HISTORY OF MOBILE PHONES
Mobile phone was first demonstrated by Dr. Cooper in 1973
Page 96 of 171
R. MALEMBA
COMPUTER STUDIES
ST. PATRICK’S SECONDARY SCHOOL
Mobile phones are portable i.e. they are small and light and therefore can fit in a pocket.
Mobile phones communicate using cellular wireless network that is set up by the
government or mobile service provider.
Each mobile phone has a special component called Subscriber Identification Module
(SIM) card which identifies each subscriber on the network.
FOUR MAIN CATEGORIES OF MOBILE PHONES
i. Basic/conventional mobile phones
ii. Touch screen feature phones
iii. Smartphones
iv. Tablets
Page 97 of 171
R. MALEMBA
COMPUTER STUDIES
ST. PATRICK’S SECONDARY SCHOOL
2. TOUCH SCREEN FEATURE PHONES
These phones have the following characteristics:
i. Wide touch screen
ii. Ability to process graphics in full
iii. Higher memory capacity
iv. Powerful processor than basic phone
v. High resolution camera
3. SMARTPHONE
They have advanced features that make them to operate as computer
They are characterized by:
• Powerful processor and touch screen
• Powerful operating system (Android, iOS, windows) which makes the phone operate
like a computer
• It has high memory capacity ad has ability to access high speed internet and stream
online video.
• High resolution camera with ability to make high definition pictures and videos
Page 98 of 171
R. MALEMBA
COMPUTER STUDIES
ST. PATRICK’S SECONDARY SCHOOL
4. TABLETS
These phones fall between smartphones and computers in terms of size and processing
power.
Tablet differs with computer because it has a slot where SIM card can be inserted in
order to support voice calls, text messaging and internet access over mobile networks.
Characteristics of tablets are:
i. A large touch screen, bigger than smartphone
ii. Large internal memory capacity
iii. Powerful processing, more powerful than that of smartphones
iv. Ability to run several applications and connect to high speed internet
v. High resolution screen and camera capable of taking high quality pictures and
videos.
Page 99 of 171
R. MALEMBA
COMPUTER STUDIES
ST. PATRICK’S SECONDARY SCHOOL
HISTORY OF INTERNET
The idea of the internet started in the 1960's among a few visionaries at the Massachusets
Institute of Technology (MIT) and University of California, Los Angeles (UCLA)
The first message was sent over the ARPANET (Advanced Research Project
Administration Network), which evolved into the internet from computer science
Professor Leonard Kleinrock's laboratory at UCLA.
USES OF NETWORKS
Computer networks support many services and applications in the modern society.
Some of the uses of networks include:
i. Electronic banking (e-banking)
ii. Internet access at homes and work
iii. E-commerce
iv. Point of Sale (POS) applications
v. Mobile communications
vi. Electronic government etc.
1. ELECTRONIC BANKING
This is the use of networked computers to offer banking services like cash withdraw,
deposits, transfers and electronic payments.
Electronic banking encompasses the following services and technologies.
i. Automated Teller Machines (ATM)
ATM machine enables people to withdraw and deposit money in their bank
accounts as long as they can positively be authenticated for true identity.
Nodes
Figure: Communication system
iii. HUBS
A hub also called concentrator is a component that connects computers on Local Area
Network and relay signals from one computer to another.
A hub usually connects networks that have common architecture i.e. one that has the
same set of communication software called PROTOCOLS.
Protocols refer to set of rules that govern communication between devices on a network.
A hub transmits signals by broadcasting them to all computers on the network.
After the signal is broadcasted, the computer whose address is on the message picks the
message from the network.
The increase in broadcast range can lead to what is called broadcast storm on the
network
Broadcast storms refers to a condition where network is overwhelmed with messages
making communication impossible.
Some hubs called INTELLIGENT HUBS are able to monitor the way computers are
communicating on the network and keep the information in a small database of their
own called Management Information Base (MIB).
Several hubs can be connected together one another to expand the network.
A
BRIDGE
v. REPEATERS
A repeater receives data from one segment of a network, cleans it to remove any
distortion, boosts it and then sends it to another segment.
Using repeaters is the simplest way to expand a network because they broadcast the
same message to other network segments.
Repeater broadcasts to all segments which may lead to broadcast storm.
Nevertheless, use of repeaters enable the network to eliminate the problem of
attenuation.
vi. ROUTER
A router interconnects different networks and directs the transfer of data packets from
one source to destination.
Routing depends on network address.
Each network has a unique identifier or address called the NETWORK ADDRESS.
All the computers from the same network have same network address but different host
number.
The router receives the packet from a computer on the network and checks the
destination’s network address and passes it to that network which then passes to the host
address.
Some routers combine the function of bridge and routers called BROUTER.
vii. GATEWAYS
A gateway is a device that is configured to provide access to devices on wide
area network (WAN) or internet.
One such device is the router in which gateway software is installed.
Because of this reason, most people confuse a gateway with a router but a
gateway may not be necessarily be a router.
viii. SWITCH
A switch is a device that forwards packets directly to addressed node without
broadcasting.
A node is an equipment on the network.
A switch transmit data by connecting two nodes point-to-point.
Because data is not broadcasted as hub, it reduces the problem of broadcast storm.
Note that some hubs are configured to function as switch and are called intelligent hubs
or switching hubs.
Switches are more expensive than hubs.
WAP
WIRELESS ANTENNAE
This is a device mounted indoors or outdoors to extend wireless network to the
surrounding buildings
It is used to propagate radiowave, microwave or infrared waves that carry data to be
received by access point in the surrounding.
PCMCIA CARD
A Personal Computer Memory Card International Association (PCMCIA) adapter is an
addon card inserted into a device such as PDA or laptops in order to enable wireless
communication between the device and the wired network server.
DATA SIGNAL
Data signal refers to as a voltage level in the circuit which represents the flow of data.
DATA SIGNAL TRANSMISSION
Some terms used in data communication include: data signal, signal modulation and
demodulation, multiplexing, bandwidth, baseband, broadcast transmission and
attenuation.
Data signals can either be ANALOG or DIGITAL.
ANALOG data is made up of continuous waveform while DIGITAL data is made up of
non-continuous discrete signal
Analog is made up of continuous wave form while digital data is made up of a non-
continuous discrete signal
From figure (a), digital signal rises suddenly to a peak amplitude of +1, holds for some
time then suddenly drops to -1 level.
On the other hand, an analog signal rises to +1 and falls to -1 in a continuous manner
Although the two graphs look different, they repeat themselves at equal time interval.
Electrical signals of this nature are said to be periodic. Generally, a periodic wave
representing a signal can be described using he following parameters:
1. Amplitude (A)
2. Frequency (f)
3. Periodic time (T)
Amplitude (A): Amplitude is the maximum displacement that the waveform of an
electrical signal can attain. For example, the amplitude of the electrical signals is 1.
Frequency (f): Frequency is the number of cycles made by signal in one second. It is
measured in units called hertz (Hz). 1 Hz is equivalent to 1 cycle/second.
Periodic time(T): The time taken by a signal to complete one cycle is called periodic time
(T). periodic time is given by T= 1/f, where f is frequency of the wave.
SIGNAL MODULATION AND DEMODULATION
This is the process of converting data signals to and from a form that is suitable for
transmission over a transmission medium.
A modem (Modulation-Demodulation) converts a digital signal to analog signal to be
transmitted over analog telephone line a process called modulation.
At the receive end, another modem converts back analog signal to digital form a process
known as demodulation.
A
MODEM
MULTIPLEXING
Multiplexing is the process of sending multiple data signal over the same medium.
A channel can be made to carry several data signals either simultaneously or at different
times.
Demultiplexing is the process of separating the multiplexed signal at the receiving end.
Imagine a situation where 100 computers in town A want to communicate with 100
computers in town B, if multiplexing is used, each of the computers in town A will need a
direct cable linking it to another in town B. however, with multiplexing, the computers
can be made to share a single cable lied between two towns hence save cost.
BANDWIDTH
Bandwidth is the maximum amount of data that a transmission channel can carry at any
one time.
For example, a certain cable transmitting 100mbps (megabits per second) is said to have
100 Mbps bandwidth.
BASEBAND SIGNAL
Baseband signal is a digital signal that is generated and fed into a transmission medium
without modulation.
The signal takes forms of voltage of different magnitudes applied to the medium.
A baseband signal ultilises the full capacity of the transmission medium, hence at any one
time, only one signal can be sent at a time.
BROADBAND TRANSMISSION
In broadband transmission, analog signals are transmitted over the transmission medium
using different frequencies (multiplexing).
This means that several data signals can simultaneously be sent through the same medium
at different frequencies.
Frequency bands between these data signals prevent them from overlapping.
ATTENUATION
This is decrease in magnitude and energy of a signal as it progressively moves along
transmission medium.
If the signal is not boosted, it is totally lost along the way and may never reach the
destination.
Page 118 of 171
R. MALEMBA
COMPUTER STUDIES
ST. PATRICK’S SECONDARY SCHOOL
Attenuation is minimized by placing a repeater station along the medium at appropriate
distance.
CLASSIFICATION OF COMMUNICATION NETWORKS
Communication networks can be classified as either:
i. Circuit switched
ii. Packet switched
iii. Message switched
Although the plastic insulator is meant to reduce interference called crosstalk, their linear
nature allows an electromagnetic field to build around them during heavy data
transmission which may cause interference to the signal.
The wire also captures environmental frequencies e.g. radiowave hence causing noise in
transmission channel.
In data communication, the word NOISE refers to unwanted signals picked up by the
channel.
TWISTED PAIR CABLES
A twisted pair cable is made up of two solid copper wire twisted around each other in a
double helix manner.
The winding of the wire is meant to reduce the build-up of electromagnetic field around
the two wires as they transmit data.
Twisted wire cables are used to transmit both voice and data signals.
The two common twisted pair cables are:
i. Unshielded twisted pair (UTP)
ii. Shielded twisted pair cable (STP)
Notice that unlike STP, UTP cables do not have a shield that prevents electromagnetic
interference (EMI) from the environment
The cable is therefore susceptible to noise and signal interference.
The noise may come from lightening sparks, radio frequencies or radiation from spark
plugs in motor vehicle.
Therefore, UTP is not suitable in the environment that are electrically “noisy”, the
alternative is to use STP that has cable pairs.
Shielded Twisted Pair (STP) is similar to Unshielded Twisted Pair (UTP) except that a
wrapped around the wires protect them from noise.
Twisted pair cables are categorized into groups according to the data transmitted and
maximum rate of transmission as shown in the table below:
Most organizations today use Cat 5 and Cat 6 twisted pair cables to set up Local Area
Networks (LAN).
Although twisted pair cables support high data rates of up to 200 Mbps, they suffer from
attenuation
For every cable length of 90 meters, a device for amplifying the signal called REPEATER
must be installed.
EXAMPLE
A student typed an e-mail to send over the internet at a speed of 100 Mbps. Calculate the
maximum number of characters that can be sent per second if each character consists of 8
bits.
SOLUTION
1 Mb = 1,000,000 bit
Therefore 100 Mb = 100,000,000 bits
If 8 bits = 1 character
Then 100,000,000 = (more characters)
(100,000,000 bits / 8 bits) * 1 character
=12, 500, 000 Characters per second
A COAXIAL
Together with the insulation and any foil shield, the shield protects the core from radio
frequency interference (RFI) and electromagnetic interference (EMI).
Although the cable has better protection against magnetic interference than twisted pair
cables, it has a moderate protection against magnetic interference.
The diameter of the centre core determine attenuation rate.
The thinner the core, the higher the attenuation rate. Data is carried on coax in a form of
direct current (D.C).
Coaxial cable has a bandwidth of up to 1 Gbps (Gigabits per second) hence it is used as a
network backbone.
A good example is a cable that is used to connect different networks between building and
routing trunk calls in telecommunication.
TWO TYPES OF COAXIAL CABLES
i. Thin coaxial cable also called thinnet: has one dielectric insulator
The new trend in microwaves uses Very Small Aperture Terminal (VSAT) technology
which uses a very small satellite dish used to transmit both data, radio and TV
communication.
The VSAT is mounted on a roof enables direct access to satellite communication instead
of having to go through a state owned by the gateways.
In VSAT setup, the satellite produces a strong signal that can be received by a satellite
dish antenna of only 2 meters in diameter.
The signals are decoded using a decoder which is plugged directly to television set or
computer.
RADIO COMMUNICATION
Radio waves travel just like surface water waves, i.e. they are OMNIDIRECTIONAL.
This means that radiowaves start from a central point and spread outwards in all
directions.
The waves are radiated into the atmosphere by a radio frequency antenna at constant
velocity
Radio waves are not visible by human eye.
Radio waves are used in radio and television broadcasts
Data can also be transmitted over radio waves communication channels
Figures below show how radio waves are propagated between transmitting station and the
receiving station.
INFRARED TRANSMISSION
Infrared waves are not visible to the human eye
Communication through infrared is achieved by having transmitters and receivers
(transceivers) within a line of sight because infrared rays do not penetrate obstacles like
walls
SIMPLEX TRANSMISSION
In this mode, there is one-way transmission of data.
The sender sends the data and the recipient receives it and cannot send the response back
to the sender over the link
Simplex
Transmitt Receiv
transmission
er er
Full Duplex
Transceive Transceiver
ii. If the problem is related to operating system, follow the following procedure:
a) Press combination of keys (Ctr+Alt+Del) to restart the computer
b) During the reboot process, and before Windows is loaded, press F8 to display the
Safe mode start-up screen as shown in the figure bellow:
c) Choose safe mode to load Windows with minimal settings. Scan the drives or
check for any hardware or software related problem in device manager
iii. If the problem persists, the OS may be corrupted by a malware. In such a case, you
may need to use up-to-date antivirus software to scan the boot sector for viruses
iv. If all above fails, you have to re-install or repair the operating system using the
recovery disk created during installation or installing OS afresh
REMOVABLE MEDIA READ ERROR
One of the symptoms of a floppy drive problem is a message stating that there is an error
reading from or writing to a disk, an error message “Error writing to disk”.
This type of a message indicates that storage media may be corrupted or malfunctioning
tape or disk drive.
HOW TO SOLVE THE PROBLEM
i. Open the disk in different computers to rule out disk failure as cause of the problem
CREATING PUBLICATIONS
Once Publisher starts, the Startup screen is displayed.
It is on this startup window that you can select the type of publication you wish to create
such as Thank you Cards shown in the figure below:
SAVING A PUBLICATION
i. From File tab, click Save As
ii. In the Save as dialog box, select the drive or folder to save in, enter the file name and
select the file type
iii. Click the OK button
CLOSING A PUBLICATION
Click Close window button at the top-right corner of the window
Alternatively, click the Office button, then select the Close command.
OPENING A PUBLICATION
To open a saved publication, proceed as follows:
i. From File tab, click Open
ii. In the Open dialog box, select the drive or folder where the publication was saved
iii. Click the OK button
INSERTING TEXT INTO PUBLICATION
To add text using text or frame tool in PageMaker or Publisher, proceed as follows:
i. Click Text toll from the tool box
ii. On the empty area on the pasteboard or printable area, drag to define the text box
Once you insert the shape, you can Right click it and select Format Autoshape and
make the formatting.
On the Format Autoshape dialog box, you can apply the following formats:
INSERTING PICTURES
i. On the Insert tab, click Picture button to display insert picture box
ii. In the dialog box, select the drive or folder where the picture file is located
iii. Double Click the file or click the File then Insert
OBJECT LINKING
In desktop publishing, Object Linking and Embedding (OLE) refers to importing an
object or existing file into a publication.
An OLE can be manipulated as part of the publication or as a shared image between the
source and current document
If an object is linked to the source publication, ay change applied to the source object are
reflected in lined image within a publication. This is because the destination file stores an
image or a copy of the source file
On the other hand, if the object is embedded, no direct ink exists. The embedded object
becomes part of the publications and updates on the source file do not affect the
embedded object
To embed or link a file:
i. On the Insert tab, click Object in the text group
ii. In the Insert object dialog box that appears, click Create from file option
iii. Click the Browse button to select the file you want to link or embed
iv. To create link, make sure the checkbox labelled link, is checked as shown in the
diagram below. For embedding, leave the checkbox unchecked
v. Click ok to insert the object.
INSERTING TABLES
A table is used to organize text into rows and columns. When dealing with a table, the
following terms are used:
1. Row: a horizontal arrangement of a cell
2. Column: a vertical arrangement of a cell
3. Cell: the intersection between a row and a column
Rows and columns belonging to one table behave like one even when the table overflows
to other pages.
To insert table in publication,
i. On the Insert tab, click Table button in the table group
ii. On the dropdown menu that appear, drag the mouse pointer to select the number of
rows and columns
iii. To draw table larger than 10 × 8, click Insert table in the create table dialog box and
specify number of rows and columns
EDITING PUBLICATION
Editing a publication involves making changes to text and graphical objects.
ROTATING OBJECTS
To rotate object in publisher:
i. Select the object
ii. Hold down the Ctrl key and drag the rotational handle that appear above the object
iii. Rotate the handle in clockwise or anticlockwise
To arrange objects in publisher
i. Select the object while pressing Shift + Tab
ii. On the Format ribbon, click Bring forward or Send Backward to select arrange option
from the list
PRINTING PUBLICATIONS
Unlike other application programs discussed earlier e.g. word processing, printing in
DTPs is a much more technical. This is because you may prefer to prefer to print a
picture in a separate colours referred to as colour separation.
You can also insert crop marks and other details required for commercial printing
To print publication, proceed as follows:
i. On the File tab, click Print
ii. Under printer option, click Printer properties hyperlink to set print option in the
dialog box
iii. To specify advanced print properties such as inserting crop marks, click the arrow on
the right of the printer, then click Advanced option settings
iv. In the dialog box that appear, use tabs such as Marks and breeds to specify advance
option.
THE END !
Page 171 of 171
R. MALEMBA