Professional Documents
Culture Documents
Year 10
Computer Studies
Workbook
2011-12
Topic Objective Outcome
Generic • To have a broad overview of generic • All should be able to give a brief
software software packages including import description of generic software
and export of data or files. packages. They should also be able to
identify GUI from CLI. They will also
• To introduce use of programming, have a clear understanding of the
desktop publishing, word-processing communication softwares. They should
packages, spreadsheets, databases, also be able to identify off-the-shelf
graphics packages and information and bespoke software.
retrieval packages
• Most will be able to clearly list the uses
• To create an understanding of the use of various generic packages. They
of graphical user interfaces and should be able to understand the
command line interface advantages and disadvantages of
generic software and compare bespoke
Section 4 : Generic software and the organisation of data
4
Section 4
DATA
Data – is information coded and structured for subsequent processing by a computer system.
Database: is a collection of logically related files, organized in a manner to satisfy the needs of an
organization and it has its own structure.
Character -Is one of the symbols that makes up a data. Character can be Alphabetic, numeric and/or special
character.
This is a computer print out of a section of an Employees file for a large company.
Keyfield- The key field or primary key is a single item of data used to locate or identify a record uniquely.
The key field may be numeric or alphanumeric and will uniquely identify each record. It can be used for
locating records in the file and arranging the records in the file in sequence (alphabetically or descending,
ascending) .
Fixed length fields – If the fields are of fixed length then each field has a maximum number of character
positions.
Variable length fields- If the fields are of variable length the number of characters in each is not
predetermined.
5
Eg. NAME, ADDRESS etc
Advantages of Fixed length field over Variable length fields.
1. Searching is quicker
2. Allocating storage space is easier.
3. Updating of files is simpler.
Disadvantages
Destination
Awayday 20 24 28
Midweek 24 30 33
Ordinary 33 43 58
Arrays- Arrays are a special form of table in which the data is stored by position.
Types of files
1.Master file – this is the main file which contains permanent data against which transactions are processed.
Master file contains
1. Reference data – which tends to be relatively permanent and which is processed by amending(making
changes like inserting new records, deleting the records, making changes in the existing records.)
2. Dynamic data- It changes frequently and processed by updating (ie changing the values of the
various fields)
6
2. Transaction file – The transaction files include input and output files for holding incoming and
outgoing data. Transaction file is used to update the dynamic data on master file.
Organisation of Files
1. Serial Organisation- A serial access file has to be read in the order in which it is stored on the
medium.(Magnetic tape). This data is not in any order.
EMPLOYEE . DBF
RECNO EMPNO EMPNAME SEX AGE DEPT
1 1011 JOHN M 25 ACCOUNTS
2 1012 AMIR M 45 PERSONAL
3 1013 DOWN F 40 COMPUTING
4 1014 HANA F 47 PRODUCTION
2. Sequential file – The data records are placed on files in a particular order(alphabetical, descending etc)
according to a Sort Key . This is known as sequential file.
CLICK
ST.DBF (Sorted file)
3. Direct organisation - In Direct access file any record can be retrieved directly without having to process
other records. Record can be stored in any order , ie. at a particular address on a direct access storage
device (DASD). Another name for Direct access is Random Access.
On-Line processing – is carried out under the direct control of the computer while the user remains in
communication with the computer.
1. Amendments and updates can be made to individual records quickly and on demand.
2. Selected records can be accessed far more quickly in any order.
3. Records do not have to be sorted in any particular order.
4. Several files can be processed or updated at same time.
Relational database - In a relational database the data is held in a number of interrelated files. or relations.
A database or database management system that stores information in tables-rows and columns of data ,
and conducts searches by using data in specified columns of one table to find additional data in another
table. In relational database rows of the files represent records and columns represent fields.
Distributed database- is a database where several computers on a network each store part of the
data which can be accessed by any of the computer.
Hierarchical database - A database in which records are grouped in such a way that their relationships
are held in a tree structure. This type of database for large computers is well suited for organizing
information that breaks down logically into successively greater levels of detail.
SCHOOL
STAFF STUDENT
Directory – is the list of file names, together with information enabling the files to be retrieved
from backing store by the operating system.
Sub directory
Mail merge – is the process of combining a document (often a letter) and a data file (often a list of names and
addresses), in such a way that copies of the document for different people are suitably different. This is
merely ensuring that letters have the correct style and title for the addressee and that the address is inserted
into the appropriate place.
Merging - Merging is when two or more files are combined by interleaving their records to form one ordered
file. Before merging, each data file is in order. After merging the data is again in order.
Generation of files – Grandfather, father, son files – are the three most recent versions of a file that is
periodically updated. They are retained for security purposes.
1. Accidentally overwritten
2. Accessed by unauthorized people
3. Fraudulently changed, damaged or stolen
4. Corrupted by hardware failure
5. Updated by incorrect data.
6. Destroyed by fire or other environmental causes.
File maintenance is important. Updating of files usually involves amending, inserting and deleting data.
Example A bank would amend data if a customer changed their personal details (e.g. telephone number,
address or their name through marriage). Data would need to be inserted if a new customer joined the bank
and deletion of data would occur if a customer left the country or died (in both cases their accounts would be
closed).
Macros
A macro is a name or key that represents a series of commands or key strokes. Many applications allow
single word or single nominated key on a keyboard to perform a whole series of actions. Macros can be
either written as required and then stored or stored in a library for future use.
For example, suppose you want some data to be input into a spreadsheet if the result of a calculation in cell
K40 is negative:
Macros can be very sophisticated and save the operator a lot of time. For example, the name and address in a
word processor could be set up by pressing key F1 and the system brings information from a related
database.
Databases are used to collect and organise information. Most database have all of the following properties:
Tables
Data is stored in rows and columns (much like a spreadsheet – the main difference is how the data is
organised). Each row in a table is called a record which is made up of a number of fields (columns in the
table). The data type in the fields is usually either text, numeric or date/time. Most databases contain a
number of tables which are usually linked together in some way.
Forms
Forms are commonly called data entry screens since they are the user interface which allows data in the
tables to be viewed, entered or edited. Forms permit the control of how other users interact with the
information in the database e.g. only allow certain fields to be seen or only allow certain operations to be
carried out. This subsequently helps the protection of the information and also ensures it is entered correctly.
Reports
Reports are produced as a result of questions such as “how many times has a type of car broken down” or
“which cities have the highest house prices”. Reports can be printed out, viewed on the screen or exported
(e.g. to a word processor, an email message, etc.).
10
Queries
Queries most commonly allow information to be retrieved from tables. Since the information is often spread
across several tables, queries allow it to be viewed as one single datasheet. They also allow filtering so only
the records required are seen. Queries can be either results seen directly on the screen or the output to another
form or report. Example of a query: (house > 200 000) OR (no_of_rooms < 4).
Points to note: (1) there are 10 records in this section of the database
(2) each record has 4 fields
(3) sample queries:
The query should match up with the field titles to ensure a correct search is carried out.
Search engines on the Internet work in a similar way; the clever part is how the information is stored on the
databases so that the time to do the search (based on key words) and the effectiveness of the search itself
results in a very powerful and very useful tool.
11
Worksheet No: 1 Term I Date: ……………....
Topic: System flowchart used to update the Master file using the Transaction file.
Level 1: 1, 3,7 Level 2:4,5,6 Level 3: 8,9
12
2. System flowchart to update the master file using the transaction file
Stages of Data processing – Application : Payroll
Data input
Transaction file
Data Validation
Valid
transaction file Sorted transaction Old
file master
file
Sort
UPDATE New
Master
file
Summary
reports 13 Payslips
OUTPUT
3. The flowchart shows how a payroll transaction file is used to produce payslips. Some of the
symbols are labeled A,B,C,D,E and F
Payroll
Transaction
file
Validated
B
Transaction
file
Sorted Payroll
transaction master file
file
Calculate pay
Update master file
Produce reports
D Managem E F
ent
14
reports
4. The following systems flowchart shows the update of a payroll system and the production of
payslips. Using the following statements, label the diagram below.
15
5. A company uses the following systems flowchart for on-line processing and invoicing.
Write the terms from the list below into the correct symbols in the flowchart.
VALIDATION PROCESS
ORDER ENTRY
16
6. Select words from the list below to complete the systems flowchart for electricity bill
payments.
payments
sort
17
7. Place the files in the correct space in the above diagram.
SORT
UPDATE
18
8. The four modules below are used when a file is updated by batch processing. Rewrite
modules in the order in which they would be carried out.
MODULES
19
9. Employees use cards to show the time they start work and the time they are used to
input data to the computer system which produces the payslips. The systems
flowchart for the operation contains seven items:
Master file clock cards data input pay calculation payslips data validation error
report
20
Worksheet No: 2 Term I Date: ……………....
Topic: Database
Level 1: 3, 5 Level 2: 1, 4, 6, 8 Level 3: 2, 7
1. Explain , using examples where appropriate , the meaning of these computer terms.
1. Character-
…………………………………………………………………………………………………………..
…………………………………………………………………………………………………………..
………………………………………………………………………………………………………….
2. Field –
…………………………………………………………………………………………………………..
…………………………………………………………………………………………………………..
………………………………………………………………………………………………………….
3. Record-
…………………………………………………………………………………………………………..
…………………………………………………………………………………………………………..
………………………………………………………………………………………………………….
4. File-
…………………………………………………………………………………………………………..
…………………………………………………………………………………………………………..
………………………………………………………………………………………………………….
5. Keyfield –
…………………………………………………………………………………………………………..
…………………………………………………………………………………………………………..
………………………………………………………………………………………………………….
21
6. Serial access file –
…………………………………………………………………………………………………………..
…………………………………………………………………………………………………………..
…………………………………………………………………………………………………………
…………………………………………………………………………………………………………..
…………………………………………………………………………………………………………..
………………………………………………………………………………………………………….
8. On-line processing –
…………………………………………………………………………………………………………..
…………………………………………………………………………………………………………..
………………………………………………………………………………………………………….
9. Relational database –
…………………………………………………………………………………………………………..
…………………………………………………………………………………………………………..
………………………………………………………………………………………………………….
…………………………………………………………………………………………………………..
…………………………………………………………………………………………………………..
…………………………………………………………………………………………………………..
………………………………………………………………………………………………………….
…………………………………………………………………………………………………………..
…………………………………………………………………………………………………………..
………………………………………………………………………………………………………….
22
12. Macro –
…………………………………………………………………………………………………………..
…………………………………………………………………………………………………………..
…………………………………………………………………………………………………………..
…………………………………………………………………………………………………………..
…………………………………………………………………………………………………………..
………………………………………………………………………………………………………….
14. Verification-
…………………………………………………………………………………………………………..
…………………………………………………………………………………………………………..
………………………………………………………………………………………………………….
…………………………………………………………………………………………………………..
15. Validation -
…………………………………………………………………………………………………………..
…………………………………………………………………………………………………………..
…………………………………………………………………………………….…………………….
(a) State two precautions that the hospital should take to prevent unauthorized access to these data.
1………………………………………………………………………………………………………….
………………………………………………………………………………………………………….
2………………………………………………………………………………………………………….
…………………………………………………………………………………………………………..
23
3. (a) On the diagram, circle and label
………………………………………………………………………………………………………….
………………………………………………………………………………………………………….
4. A school uses a microcomputer for keeping pupil records. A file is stored in which each record contains
the following fields:
Pupil number;
Name;
Address;
Telephone number.
(a) Explain why it is necessary for each pupil to have a pupil number.
…………………………………………………………………………………………………………..
…………………………………………………………………………………………………………...
(b) Write down three additional fields which could be included in each record .
…………………………………………………………………………………………………………..
…………………………………………………………………………………………………………..
………………………………………………………………………………………………………….
24
(c) The file is used to contain various output , Eg. A list of every pupil in the school in alphabetical order.
Describe two other examples of useful output that could be obtained.
…………………………………………………………………………………………………………..
…………………………………………………………………………………………………………..
(d) Describe two precautions that should be taken to ensure that data held on the computer are secure.
…………………………………………………………………………………………………………..
…………………………………………………………………………………………………………..
(e) The school intends to use the computer for additional tasks in the school office in due course. Briefly
describe three other possible applications.
…………………………………………………………………………………………………………..
…………………………………………………………………………………………………………..
………………………………………………………………………………………………………….
(f) Describe the hardware the school use and name three software packages that could be useful.
…………………………………………………………………………………………………………..
…………………………………………………………………………………………………………..
5. A database stores details about cars in a showroom. The format of the first three field is shown below.
(a) State two more fields, one numeric and one text and for each give the field description and field
length
Field name(numeric)……………………………………………………………………………………
25
Field description………………………………………………………………………………………..
Field length…………………………………………………………………………………………….
Field name(text)………………………………………………………………………………………..
Field description……………………………………………………………………………………….
Field length…………………………………………………………………………………………….
(b) Give a situation, in each case, where the data about these cars would need to be amended, deleted and
inserted.
Amended: ………………………………………………………………………………………………
Deleted: …………………………………………………………………………………………………
Inserted: ………………………………………………………………………………………………...
6 (a) State one reason why hospitals have changed from a manual system to a computerized based system for
storing patient records.
………………………………………………………………………………………………………………
……………………………………………………………………………………………………………….
(b) State the type of access that is used to retrieve a patient record.
……………………………………………………………………………………………………………..
(c) Give one situation when a patient record would be inserted and one situation when a patient record is
amended.
Inserted :…………………………………………………………………………………………………..
……………………………………………………………………………………………………………..
Amended:………………………………………………………………………………………………….
……………………………………………………………………………………………………………..
Deleted:……………………………………………………………………………………………………
……………………………………………………………………………………………………………..
(d) Describe how the patient database could be restored after a system failure
……………………………………………………………………………………………………………..
…………………………………………………………………………………………………………….
26
(e) State two tasks, other than storing patient records, that the hospital could use the computer system for.
1……………………………………………………………………………………………………………
……………………………………………………………………………………………………………..
2……………………………………………………………………………………………………………
……………………………………………………………………………………………………………...
7. A company wishes to keep details of all its employees who work in Europe. The record format for each
employee is
NAME 15 characters
SEX 1 character
DEPARTMENT 1 character
COUNTRY 10 characters
SEX F – Female
M – Male
DEPARTMENT A- Administration
P- Personnel
M-Management
F-Finance
H A M M E R T O N W F M S P A I N 0 3
O N S L O W J M F G E R M A N Y 1 2
…………………………………………………………………………………………………………
27
(b) Show how the record for Miss F Virdee, who is in the Administration Department in France, would
be stored. She has worked for the company for 6 years.
8. Pupil records include a four –digit admission number, a surname, one initial and a date of
birth in that order.
a. If the date is to be held in a fixed- length record of 26 characters, state the number of
characters you would use
Surname –
Initial –
Date of birth -
b. Insert in the diagram the data for MARY LEE. She was born on 4th JULY 1988 and her
admission number is 0436 .
28
Automatic Data Capture
There are many techniques available to collect data automatically without the need for manual entry. Manual
entry is slower, more expensive (need to employ people to key in data) and also prone to error (e.g. typing in
4.1 instead of 1.4).
The following is a list of available automatic data capture techniques:
Data logging this technique involves collecting data automatically using sensors; often used when doing
scientific experiments or monitoring a system (examples of sensors is learnt in Year 9).
Barcode readers these take data from printed barcodes and allow automatic stock control in, for example,
supermarkets. A barcode is a set of parallel lines of different thickness (usually alternately black and white)
which represents a number of ten digits. The number represented by the bars is also printed above or below
the barcode.
Note : The price is not included in the data on a barcode, because price changes so often. Instead the price is
stored in the database in the computer and when a price is needed it is retrieved from the database.
Disadvantages of Barcodes:
1. Barcodes are not suitable for recording prices.
2. Barcode scanners have reliability problems.
3. Barcodes cannot be read by people.
4. Only numbers can be coded.
Uses of Barcode;
1. Printed on goods. These are then used to make the bills.
2. used to identify library books.
3. On labels or shelves. These are the used during stock-taking.
To the customer :
a) Customers get a quicker and more accurate service.
b) No time wasted or mistakes made entering prices.
c) Customers are getting an itemized receipt.
29
To the supermarket :
Supermarket get instant, or continuous, stock checks and adjust orders Precisely to the flow of goods, thus
improving efficiency.
Radio Frequency this method involves using small electronic devices containing a Identification microchip
and antenna; they work in a similar way to bar codes (RFID) but can be read from a distance of 5 metres;
often used to track livestock, vehicles, library books and goods sold in shops.
Biometrics this involves obtaining data and identifying characteristics automatically in security systems e.g.
use of finger prints, palm prints, facial images and iris prints.
Magnetic stripes these contain information/data stored on magnetic material often on the back of a
credit/debit card; the information is automatically read by swiping the magnetic stripe past a reading head. A
magnetic stripe (or strip) is a short length of magnetic coating printed onto the surface of a ticket or card.
The stripe usually contains information to identify the ticket or card or its uses.
Examples :
1. Credit cards and bank cards.
2. Phone cards(Smart cards).
3. Laser cards.
Optical character information on paper is automatically read by a scanner and is recognition (OCR) then
analysed/processed by OCR software and stored in an electronic format. The character shapes are recognized
by sensing light reflected from the paper and from the ink and converts the characters to electric signals. The
reader has a memory and processing capability in order to work out what the characters are. Practically all
OCR document readers recognize either OCR-A or OCR-B fonts. Some can cope with typed or printed fonts
in addition to hand-printed characters.
Application of OCR :-
OCR is used in billing (gas and electricity bills, insurance premium renewals) etc.
Voice recognition these systems recognize spoken words e.g. for disabled people who can’t use keyboards
where they speak commands instead of having to type. A special system can now recognize a limited,
standard vocabulary of spoken words through a microphone linked into a small computer system. The system
processes the sounds and converts them into binary patterns.
30
Disadvantages.
Recognition is slow and limited to some words.
The error rate is relatively high.
Speaker has to be very clear.
Limited vocabulary.
Smart cards these contain embedded microchips and receive power from the card readers; the microchip is
made up of RAM, ROM and 16- bit processor and the stored data is automatically read by the card reader;
used in credit cards, security cards, loyalty cards, etc.
Optical mark OMR technology scans a printed form and reads pre-defined recognition (OMR) positions
(where specific fields have been filled in e.g. ●─● or ▄); the system records where marks have been made so
can automatically determine responses to, for example, a questionnaire. A beam of light is directed onto the
surface of the card or document. The beam is reflected from the surface to a light sensor. When a mark
passes under the beam less light is reflected back and the presence of the mark is registered.
Application of OMR
Multiple choice question papers.
For market research questionnaires.
In supermarket for recording stock.
For data collected ‘in the field’ by research workers.
Advantages of OMR
1. Data can be prepared without any special equipment.
2. Data can be prepared where it is collected.
Disadvantages of OMR:
1. Documents for mark readers are complicated to design.
2. Input of data to the computer is slow.
Data Collection
Data collection can be either automatic (see previous page) or manual. Manual techniques can involve:
- keyboards/keypads to type in data
- touch screens to select data/options
The overall aim of any method of data collection is to translate information created by people into a form
usable by a computer. An effective data-entry system must be fast, accurate, versatile, efficient, secure and
cost effective.
31
Problems of data collection
a) The preparation of source documents is slow, hard work and prone to mistakes.
b) Typing speeds are very slow compared with computer speeds. This is known as the ‘keyboard
bottleneck’.
c) Mistakes can be easily made when copying from one medium to another. Such mistakes are known as
‘transcription errors’.
d) Transmission delays or losses can occur.
a) On-line data entry: data is entered directly into the computer one transaction at a time. The main types
of online data entry device are: VDUs, light pens, voice input and shop floor data collection devices.
b) Source document conversation: this is where source documents (order forms and time sheets) are batched
and converted into a computer acceptable medium. The data is entered, verified and validated by
computer and then transferred to backing store for later processing.
c) Direct Data Capture: Data is captured directly without a conversion stage. Specially marked or printed
documents (questionnaires, bank cheques),can be read by special input devices. Tags attached to
clothing and collected at the point of sale terminal are another example of direct input media. This
method eliminates the key board, automates transcription and increases speed.
Codes
A code is a character or a group of characters used to replace a particular item of data. If large amounts of
data are being processed, some items of data are often replaced by codes. This happens particularly to an
item which has to be keyed in many times.
Advantages
Adv 1:- Codes make the data shorter so that it takes less time to key in.
Adv 2: - Encoded data takes up less storage space.
Disadvantages
The person keying in the data has to be familiar with the codes or they will have to keep referring to a list of
codes.
Validation Techniques
Validation is a process of checking if data satisfies certain criteria when input i.e. falls within accepted
boundaries.
32
Examples of validation techniques include:
Range check this checks whether data is within given/acceptable values e.g. checks if a person’s age
is > 0 but is also < 140.
Length check this checks if the input data contains the required number of characters e.g. if a field
needs 6 digits, then inputting 5 digits or 7 digits, for example, should be rejected.
Character check this checks that the input data doesn’t contain invalid (type check) characters; e.g. a
person’s name shouldn’t contain numbers.
Format check this checks that data is in a specified format (template) e.g. (picture check) date
should be in the form dd/mm/yyyy.
Limit check this is similar to a range check except only ONE of the limits (boundaries) is checked
e.g. input data must be > 10.
Presence check check that data is actually present and not missed out e.g. in an electronic form,
somebody’s telephone number may be a required field.
Consistency check this checks if fields correspond (tie up) with each other e.g. if Cross field check Mr.
has been typed into a field called “Title” then the “Gender” field must contain M or
Male.
Check digit this is an extra digit added to a number which is calculated from the digits; the
computer re-calculates and validates the check digit following input of the number
(see next page).
(NOTE: check digits can identify 3 types of error:
(1) if 2 digits have been inverted e.g. 23459 instead of 23549
(2) an incorrect digit entered e.g. 23559 instead of 23549
(3) a digit missed out all together e.g. 2359 instead of 23549)
The ISBN-10 (used on books) has been chosen as the example; this uses a modulo 11 system which includes
the letter X to represent the number 10.
Example 1
(ii) each digit is then multiplied by its digit position and the totals added together
0 x 10 + 2 x 9 + 0 x 8 + 1 x 7 + 5 x 6 + 3 x 5 + 0 x 4 +8 x 3 + 2 x 2
= 0 + 18 + 0 + 7 + 30 + 15 + 0 + 24 + 4
= 98
(iii) the total is then divided by 11 (modulo – 11) and the remainder, if any, is subtracted from 11 to give the
check digit.
98 ÷ 11 = 8 remainder 10
11 – 10 = 1
this gives a check digit of 1
final ISBN becomes 0 -2 0 1 - 5 3 0 8 2 - 1
33
Example 2
(ii) each digit is then multiplied by its digit position and the totals added together
0 x 10 + 1 x 9 + 3 x 8 + 1 x 7 + 5 x 6 + 2 x 5 + 4 x 4 + 4 x 3 + 7 x 2 + X x 1
= 0 + 9 + 24 + 7 + 30 + 10 + 16 + 12 + 14 + 10 (recall that X = 10)
= 132
(iii) the total is then divided by 11; if there is no remainder then the check digit is correct:
132 ÷ 11 = 12 remainder 0
hence the check digit is correct
Verification
Verification is a way of preventing errors when data is copied from one medium to another (e.g. from paper
to disk/CD, from memory to DVD, etc.).
Double entry in this method, data is entered twice (using two different people); the data is only
accepted if both versions match up. Often used to verify passwords by asking them to
be typed in again by the same person.
Visual check this is checking for errors by comparing entered data with the original document
(NOTE: this is not the same as proof reading!!).
Parity check this is used to check data following potential transmission errors; an extra bit is added
to each binary number before transmission
e.g. EVEN parity makes sure each number has an even number of 1 – bits
Software
Software consists of the programs and data which drive the machine.The two types of software are System
Software and Application Software.
34
System Software : System software affects the control and performance of a computer system.
System software is divided into
1. Operating System
2. Translators
3. Utilities
4. Operating environment
Translators
Source program (Source code): A source program is a program in the form originally written by a
programmer.
Object program(Object code) : An Object program is the machine code program which results when a source
program is translated.
High level language : ( HLL ) The language which the user use to write the program. It is a problem-oriented
language.
Assembly level language (ALL) (Low level language): An assembly level language is a low level language
which allows the programmer to use Mnemonic and symbolic addresses.
Machine level Language :A machine level language is a computer language which based on the machine
code ( 0’s & 1’s) binary digits.
Translators are system programs which convert source program to object program .
Translators are divided into three
1. Assembler
2. Compiler
3. Interpreters.
Assembler : Assembler is a translator which converts Assembly level language to machine level
language.
35
Interpreter : Interpreter is a translator which converts high level language to machine level
language . It translates the source program one instruction at a time.
Compiler : Compiler is a translator which converts high level language to machine level
language. It translates the whole source program at once before it can run.
Utilities Utilities are system software programs which provide a useful service by performing common
task and house keeping routines.
Eg. Directory – to list file names, size and space remaining on disk.
Disk format – divides the disk into tracks and sectors.
Delete , rename, copy etc.(file maintenance)
SORT organize data in sequence.
COPY : copy a file from hard disk to floppy disk.
low level language(assembly level language) is useful for writing operating system, games programs and it
may be used for security reasons.
Graphical User Interface enables the user to interact with the computer using the help of pointing devices.
The user can interact with the Menus, pull down menus, icons etc.
Disadvantages
It is not useful when handling errors in the operating system or troubleshooting.
Advantages
It is useful when handling errors in the operating system or troubleshooting.
36
Disadvantages
The user needs to learn a lot of commands
Less use of mouse or pointing device
Lot of typing when compared to GUI
Less user friendly
Software Packages
Some of the key features of software are considered in this section.
Word processors
Word processors now have many features over and above the original task of generating a typed document.
As word processors develop increasingly more sophisticated features, the differences with desk top
publishing (DTP) packages becomes more and more blurred.
Essentially in DTP, a user creates a page layout with text, graphics, photos and other elements.
- most word processors force users to work on a document in a linear fashion (i.e. paragraph by paragraph
and page by page); with DTP it is possible to place elements on the page and then move them around as you
wish to create the desired product.
- elements repeated throughout a document (e.g. a company logo) can be placed in master pages rather than
setting up each page individually as would be the case with a word processor.
- text is usually imported from a word processor or is typed into the document directly using a frame. This
allows you to create the layout first, link the frames together and add the text into the frames later (e.g. in
newsletters and magazines where layouts are created before any of the actual text becomes available).
Spreadsheets
- it is made up of columns and rows; each row is identified by a number and each column is identified with a
letter (or letters)
38
- each cell is identified by its column id and row id e.g. A4, ET300 etc.
- a cell may contain a label (text entry such as MEAN VALUE) or a value (which can be a number, a date, a
formula, result of a calculation, or currency)
- the cursor identifies the current cell selected; it is possible to click on to a cell and a “+” sign appears in the
bottom right hand corner; by dragging the formula down it is possible to replicate it in other cells
Example:
By selecting cell C1 and dragging the formula down to C5 the following formulae will be replicated in C2 to
C5: (A2*B2), (A3*B3), (A4*B4) and (A5*B5)
- it is also possible to create charts and graphs from spreadsheets (e.g. using a chart wizard).
For example:
39
Formula
replicating this formula (by highlighting then drag down to D7) gives all the formulas needed in cells D3 to
D7
- capacity (i.e. maximum number of rows and columns) can be limiting when dealing with large data sets
- security issues in some spreadsheets (i.e. if you can open a spreadsheet you can also change any part of it;
this can lead to fraud
- lack of concurrency; usually only one person can work on a spreadsheet at any given time (databases are
better in this aspect since they can usually be opened by more than one user at a time)
- because of their structure it is easy to enter an error (whether on purpose or by mistake) by entering data in
the wrong cells or dependencies among cells incorrectly applied
40
Import & Export data or files
Each software allows data from other software to be used by it this is called import. If data in a particular
software is to be used by another software then this is called exporting of data to that software
Authoring Software
Also known as authorware; this is a program that helps in the writing of hypertext or multimedia
applications. Authoring tools usually allow the creation of the actual required application by linking together
objects which can be text, graphics, music file, etc. By defining the relationship between objects it is possible
to produce very useful and eye catching applications.
Many authoring packages support a scripting language to allow for even more sophisticated applications to
be produced. Scripting languages have pre-built functionality (such as menu styles, graphic displays, etc.)
that is embedded within HTML. These pre-built functions allow users to engage with a web-site in real time.
The distinction between authoring tools and programming tools is not at first obvious. However, authoring
tools require less technical knowledge to master and are usually used for applications that present a mixture
of text, graphics, and audio/music files.
Usually software packages are bought off-the-shelf. However, certain applications (usually for commercial
businesses, industrial companies, etc.) require specially written software which is unique to that customer
and is known as bespoke software.
Off-the-shelf – advantages
- tends to be less expensive since development costs can be spread over the many users
- can be more sophisticated since large sales bring in considerable revenue which can be used to enable a lot
of development to be done.
- there will be considerable support from other user groups
- sharing of files with other packages is usually easier since they are likely to be compatible (e.g. Excel and
Word)
- the package is available immediately – no need to wait for development period
- tried and trusted software since usually highly developed due to considerable user feedback
Off-the-shelf – disadvantages
- can be over-complex as it tries to cover as many aspects as possible (e.g. most users of Word only utilise
about 10% of its features)
- the software is often a compromise since it is intended for many users all with different requirements
- may be very complex to learn because of the complexity caused through having unwanted features
- may not fit exactly into the company requirements causing a compromise in the way it has to be used
within the organisation
- if there are major concerns with a software problem it is unlikely that it will be fixed immediately (since it
may cause problems with other users and/or cause software instability)
41
Bespoke Software – advantages
- specifically designed for the application and therefore more efficient and will only contain the features
wanted; since it will be devoid of unwanted features the software can take its specific requirements to new
levels which will make it very powerful
- can be customised to interface with all other software within the company thus preventing software clashes
- easier to use since very specific and the writers of the software can also be involved in the training of staff
which will be geared towards their requirements
- can be modified/updated as the company’s requirements change
- much better customer support since they will be in direct contact with the software designers
- very dependent on the suppliers of the software; if they go out of business there will be little or no support
if problems occur
- less likely to be as well developed/tested as off-the-shelf software
- much more expensive since all the development costs need to be met by the company (but efficiency
savings may compensate for this and it may prove to be less expensive in the long run)
- the development time can be very long which may cause problems
- difficult to tell how good the final software package will be (could be a real problem if the company have
waited 2 to 3 years to receive their new software only to find it doesn’t meet their needs!!)
42
Worksheet No: 3 Term I Date: ……………....
Topic: Sec 4 (Practice questions)
Level 1:2, 6, 7 Level 2:1, 3, 5, Level 3:4
(1) Describe four methods used for automatic data capture and give a different application for each.
(3) A system uses the ISBN-10 (modulo 11) method to generate and validate bar codes:
- each digit in the number is multiplied by its digit position
- the result of each multiplication is added to a total
- the total is then divided by 11
- the remainder is subtracted from 11 to give the check digit (if the remainder is 10, the letter “X” is
used as the check digit)
(a) Which of the following numbers have the correct check digit?
(i) 0 – 5 5 5 – 2 1 6 2 2 – 5
(ii) 0 – 1 2 1 – 9 0 0 2 1 – X
(c) Discuss the types of errors that check digits can identify.
(5) A company is using a word processor to produce a page advertising their products. Unfortunately, the
information wouldn’t fit onto one single page.
Which five features of a word processor could be used to ensure that the advert fits onto one page
only.
(6) A college has invested in a computer system to help carry out the following tasks:
- advertise their college (both on the Internet and by paper leaflets)
- keep a track of student and staff information/contact details
- keep a track of payments and fees
- produce on line courses for the students
Describe four software packages the college could use to carry out the above tasks and explain why
each software package has been chosen.
(7) Describe three fundamental differences between word processors and desk top publishing packages.
43
Worksheet No: 4 Term I Date: ……………....
Topic: Database software: MSACCESS WORKSHEETS (PRACTICAL)
Level 1: identify elements Level 2: search condition output Level 3: condition writing
(a) Complete the table below to show the data type and field size for each field.
BOOKING NO
MEALS
NIGHTS
HOTEL
Reason-
(MEALS=”RO”) OR (PRICE($)>350)
Write down the output using the BOOKING NO only.
…………………………………………………………………………………………………………
44
(f) Write a similar search condition which will display the holidays which are more than 7 nights and
cost $450 or more.
…………………………………………………………………………………………………………
2. A mail order company selling hi-fi equipment keeps details of its stock on a database. Part of the
database is shown below.
…………………………………………………………………………………………………………..
(b) Which Code_Num data will be listed if the following search condition is input ?
…………………………………………………………………………………………………………
…………………………………………………………………………………………………………...
(c) Write down a search condition to find the equipment which is silver coloured or has a power rating
over 70 W.
………………………………………………………………………………………………………...…
(d) Write down the order of the Code_Num after the Price($) field has been sorted in ascending order.
………………………………………………………………………………………………………
………………………………………………………………………………………………….........
45
3. A garage uses a database to keep details of the cars in stock. Part of the database is shown below.
(b) Suggest two additional fields that could usefully be added to this database.
1.………………………………………………………………………………………………………
2……………………………………………………………………………………………………….
……………………………………………………………………………………………………………….
(d) The records need to be sorted into the key field order. Sate which field would be used as the key field
and give a reason why.
Key ……………………………………………………………………………………………………..
Reason………………………………………………………………………………………………….
………………………………………………………………………………………….. ……………..
(e) The database is sorted into descending order on the YEAR field. Write down the output using only
the REF field.
…………………………………………………………………………………………………………….
46
4. A database has been set up by a car dealer to maintain information on cars currently available
for sale. The section of the database is shown below.
(a) How many records are shown in the section of the database above?
…………………………………………………………………………………………………………
(Top Speed(kph) >250) OR (Doors=2) Using Ref No only, which items would be output ?
…………………………………………………………………………………………………………
( c ) Write down a query which outputs cars which cost more than $60 000 and have a 0 -100 kph
…………………………………………………………………………………………………………
5. A company stores a stock list of jeans in a computer file. Several records are shown in the diagram.
…………………………………………………………………………………………………………………
47
b) Which field would be used as a keyfield?
………………………………………………………………………………………………………………….
c) State two reasons why the COLOUR field has been coded.
………………………………………………………………………………………………………………….
…………………………………………………………………………………………………………………..
d) Describe one validation check that would be made on the LOCATION CODEs as they are entered into the
file.
…………………………………………………………………………………………………………………..
e) Which ITEM CODE(s) will be listed if the following search condition is input ?
(SELL($)>300)AND(COLOUR=”B”)
…………………………………………………………………………………………………………………..
…………………………………………………………………………………………………………………...
f) Write down a search condition to list all the jeans which are not white that sell at less than $400.
………………………………………………………………………………………………………………….
…………………………………………………………………………………………………………………..
6. A mail order company selling computers keeps details of its stock in a database. Part of the database is
shown below.
………………………………………………………………………………………………………………….
48
b) Which COMPUTERs will be listed if the following search condition is input:
(RAM=32) AND (CD>4)
………………………………………………………………………………………………………………….
c) Write down the order of the COMPUTERs after PRICE($) field has been sorted in ascending order.
………………………………………………………………………………………………………………….
d) Explain how a macro could help if a particular search has to be done frequently.
………………………………………………………………………………………………………………….
…………………………………………………………………………………………………………………..
7. A school office sells stationery items to pupils. A database is used to keep details of the stationery stock.
Part of the database is shown below.
………………………………………………………………………………………………………………..
………………………………………………………………………………………………………………….
………………………………………………………………………………………………………………….
c) Describe how you would sort the records into alphabetical order of ITEM field.
………………………………………………………………………………………………………………….
…………………………………………………………………………………………………………………..
49
8. A hardware supplier keeps a file of people who have problems with their purchases and have telephoned
for advice. Several records are shown in the diagram.
…………………………………………………………………………………………………………………..
c) Describe two validation checks that should be made on the dates as they are entered into the file.
…………………………………………………………………………………………………………………..
…………………………………………………………………………………………………………………..
d) Which of the CUSTOMER’s will be listed if the following search condition is input ?
(REFNO=3127) OR (STAFF=”MB”)
………………………………………………………………………………………………………………….
e) (i) Write down a search condition to find all the records where more than six minutes were taken to advise
a customer.
…………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………
ii) A printed report of this search is needed. The report must only contain the last three fields. Describe the
steps taken to achieve this.
………………………………………………………………………………………………………………….
…………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………
50
9.A music club keeps a file of members on a computer system. Part of the file is shown in the following
diagram:
………………………………………………………………………………………………………………….
b) State the data type that should be used for the CODE data.
………………………………………………………………………………………………………………….
c) State two reasons why the data in the SEX field has been coded.
1…………………………………………………………………………………………………………………
2…………………………………………………………………………………………………………………
d) Which CODE data will be listed if the following search condition is input ?
…………………………………………………………………………………………………………………..
…………………………………………………………………………………………………………………...
…………………………………………………………………………………………………………………...
…………………………………………………………………………………………………………………..
51
10. A radio station keeps a database of all its music CDs. Here is part of this database:
1111 Afternoon 12 N 55 1
Glory
1112 Stone Tulips 10 N 42 3
1113 Aftermath 8 N 33 0
1114 Major Peppers 15 Y 72 5
1115 Seaside 9 N 40 2
1116 Lookout 12 N 62 2
1117 Future Dreams 11 N 60 3
1118 Moonlight 14 Y 70 2
…………………………………………………………………………………………………………………
(CD length (mins) < 60) AND (number of hit tracks > 1)
using Reference Number only, write down which data items would be output.
…………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………
c) Write down a query to select which CDs are special edition or have more than 10 tracks.
…………………………………………………………………………………………………………………
………………………………………………………………………………………………………………….
d) The database is sorted in descending order on CD length (mins). Using Reference Number only, write
down the order of the records following this sort.
………………………………………………………………………………………………………………….
e) The radio station has a phone-in service where a listener texts the title of the CD on their mobile phone.
The popularity of each CD is then known and which CDs the radio station should play.
(i) How would this information be stored and how would it be linked to the database?
………………………………………………………………………………………………………………
52
Worksheet No: 5 Term I Date: ……………....
Topic: Spreadsheet software: MSExcel WORKSHEETS (PRACTICE)
Level 1: write cell reference Level 2: formulae Level 3: charts, cell manipulation
A B C D E F
i) a label ______________
b) Write a formula that should be inserted into F2 to calculate the total expenditure on travel for these
four weeks.
………………………………………………………………………………………………………
c) Describe how the formula in F2 can be copied to calculate the total expenditure for each item .
……………………………………………………….……………………………………….…………
………………………….………………………………………………………………………………….
d) Write a formula that should be inserted into F8 to calculate the total expenditure for all items.
………………………………………………………………………………………………………………
53
2. The following spreadsheet shows the results of two tests. The cell D2:D6 each contain a formula.
A B C D E
1 TEST 1 TEST 2 AVERAGE PASS
Out of 100 Out of 100 MARK
2 M JOHN 82 68 75 YES
3 J GRIFF 48 72 NO
4 C HARRY 98 98 YES
5 M MOHD 88 62 YES
6 I PATEL 70 80 YES
i) a label –…………………………………………………………………………………………….
…………………………………………………………………………………………………………….
c) Describe how the formula in D2 can be copied into the range of cells D3:D6
………………………………………………………….……………………………………….…………
………………………….………………………………………………………………………………….
………………………………………………………………………………………….……………………
d) A bar chart is needed to compare the average marks for each student. Write down the range
of cells needed to produce the chart.
………………………………………………………………………………………………………………
54
3. A customer went to the same shop everyday for a week. The spreadsheet shows the time in minutes
which the customer spent at the checkout. Some of the time was spent waiting and some was spent being
served. The average times spent waiting and being served are calculated in B10 and C10.
A B C D
2 Monday 1 3
3 Tuesday 2 4
4 Wednesday 1 4
5 Thursday 3 6
6 Friday 4 9
7 Saturday 2 5
8 Sunday 1 4
10 Average time 2 5
11
(ii) a label
(b) Write a formula in cell D2 to calculate the total time spent at the checkout on Monday.
………………………………………………………………………………………………………………
(c) Describe how a user can copy a formula in cell D2 into cells D3 to D8.
………………………………………………………….……………………………………….……
………………………….……………………………………………………………………………..
(d) A mistake was made on Friday. The serving time on Friday is corrected to 2 minutes. Which two
cells would change automatically?
………………………………………………………………………………………………………..
55
4. The following spreadsheet shows the number of mice, keyboards and trackerballs ordered by five
customers. The value of each item is:
Mouse $5
Keyboard $10
Trackerball $20
A B C D E F
1 Customer Number of Number of Number of Value of Free
Number Mice Keyboards Trackerballs Order($) Delivery
2 1234 10 15 11 420
3 5678 9 20 15 545
4 9012 8 11 7 290
5 3456 6 20 15 530
6 7890 5 4 15 365
…………………………………………………………………………………………………………..
…………………………………………………………………………………………………………..
b) What formula must be placed in cell E2 to calculate the value of the order for customer 1234 ?
…………………………………………………………………………………………………………….
………………………………………………………….……………………………………….…………
………………………….………………………………………………………………………………….
……………………………………………………………………………………………………………….
e) If the formula IF(E4>400 THEN “Y” ELSE “N”) was placed in cell F4, what output would be produced
in that cell ?
………………………………………………………………………………………………………………..
56
5. A shop uses a spreadsheet to keep a record of daily sales in the electrical department. A section of the
spreadsheet is shown below. The number in stock is updated at the start of each day.
A B C D E F
1 Item No.in stock No.sold Price($) Stock value ($) Re-order
level
2 camera 32 3 150.00 15
3 iron 80 14 82.50 20
4 kettle 151 10 49.25 30
5 fan 144 15 37.15 30
Write down a formula that could be inserted in cell E2 to calculate the Stock value ($) of cameras.
……………………………………………………………………………………………………………
……………………………………………………………………………………………………………
……………………………………………………………………………………………………………
…………………………………………………………………………………………………………….
……………………………………………………………………………………………………………..
c) Describe how the spreadsheet could be used to predict the number of days before irons reach their
Re-order level.
……………………………………………………………………………………………………………
…………………………………………………………………………………………………………….
……………………………………………………………………………………………………………..
57
6. The following spreadsheet shows the profit or loss on sales at an ice-cream stall during a four week period.
A B C D E F
1 Ice-Cream Stall
2
Cost Price
($)
3 Ice -Cream 3
4 Orange Juice 2
5
6 Ice – Cream Orange Juice
Sales Sales Income($) Expenses($) Profit/Loss
7 Week 1 300 40 980 900 Profit
8 Week 2 250 10 770 900 Loss
9 Week 3 450 10 1370 900 Profit
10 Week 4 300 20 940 900 Profit
……………………………………………………………………………………………………………..
b) Write down a formula that could be in cell D7 to calculate the income for week 1.
………………………………………………………………………………………………………………
c) Describe how the formula in D7 can be copied into the cells D8,D9 and D10.
……………………………………………………………………………………………………………
…………………………………………………………………………………………………………….
……………………………………………………………………………………………………………..
=IF(D7>E7,Profit,Loss)
and is copied into cells F8,F9 and F10. Write down the function that will be in cell F10.
………………………………………………………………………………………………………………
e) State the cells that are needed to create a line graph to show the Income and Expenses for Week1
toWeek4.
………………………………………………………………………………………………………………
…………………………………………………………………………………………………………….
58
Sec 3 - Algorithm and their Method of Representation
1. Define Program
The set of instructions given to the computer to solve a problem. The task of preparing such instructions
is called programming.
Steps in Programming
2. Define System
• System is an organized set of related components, consisting of inputs, process, files and outputs and
is designed to fulfill some useful purpose.
• System specification is a system design in the term of hardware and software requirements. System
specifications includes system flowcharts and structure charts.
• System documentation is a carefully written system specification that can aid programming by
including processing procedures and sample input and output layouts.
5. Define Algorithm
59
Eg:- Write an algorithm to find the product of two numbers.
1. Start
4. Output P
5. Stop.
6. Define Flowchart
Flowchart is a diagram representing the operations involved in the process. They are made up of boxes of
standard shapes linked to show the order of processing. Each box contains a brief note stating what the
operation is. The flowchart is divided into two : 1. System Flowchart 2. Program Flowchart .
• A Flowchart used to describe complete data processing system with the flow of data through clerical
operations. System Flowcharts include inputs, process and files and outputs.
Input/ Output
Document
Magnetic Disk
Screen Display
60
Magnetic tape
Online storage
Manual Input
Process
Communication Link
61
PROGRAM FLOWCHART SYMBOLS
Start/ Stop
Connector
Input/Output
Process
NO
62
9. Define Top down Design
It is an orderly approach to programming which emphasis breaking large and complex tasks into
successively smaller section.
It is one aspect of structured programming in which individual tasks are programmed as sections or
modules. One advantage is that individual sections can be modified without reference to other sections.
2. The program will be easier to maintain as the individual program modules can be added, deleted or
edited without affecting the rest of the program.
Syntax:
Function A
Function B
2. Selection: Program execution can be branch in either of two directions, depending on the result of
testing a condition.
Syntax : YES NO
TEST
Function A Function B
63
3. Repetition: The program continues to loop through one or more functions until a new condition is
satisfied.
Syntax:
LOOP
Action
TEST
Yes
No
A part of the program which can be run repeatedly until a condition is satisfied.
REPEAT……..UNTIL LOOP
WHILE……DO….ENDWHILE LOOP
A subroutine is a group of instructions which can be used several times at different event points in a
program.
A collection of routines written by several users can be stored together so that they can be used by
anyone who has access to it. This is a library of subroutines or library of procedures. Instead of books
in this library we have subroutines or procedures.
64
15. Define Program Documentation
Program documentation is a complete description of the program. It should include the purpose of the
program, input data format, and other restrictions, helpful notes, system flowchart, program listing
and test data with expected results.
1. Normal data.
2. Abnormal data.
3. Extreme data.
1. Syntax error
2. Logical error
65
Questions to Solve
1. Zeenat is a programmer working for a large company. She was told to design an application package.
Her design is flexible, robust and easy to maintain.
(d) Give two items of documentation that Zeenat should leave to help John.
(e) John will complete the testing of the program and write the documentation. Give two items of
documentation that john should put in the user documentation.
(f) Define high level language and low level language and give their uses.
66
Worksheet No: 6 Term II Date: ……………....
Topic: Sec 3 Programming practice questions
Level 1: 1, 5, 8, 9, 10 Level 2: 3, 6, 7 Level 3: 2, 4
a. Program documentation-
…………………………………………………………………………………………………………..
…………………………………………………………………………………………………………..
………………………………………………………………………………………………………….
…………………………………………………………………………………………………………..
…………………………………………………………………………………………………………..
………………………………………………………………………………………………………….
b. User documentation –
…………………………………………………………………………………………………………..
…………………………………………………………………………………………………………..
………………………………………………………………………………………………………….
…………………………………………………………………………………………………………..
…………………………………………………………………………………………………………..
………………………………………………………………………………………………………….
c. Technical documentation –
…………………………………………………………………………………………………………..
…………………………………………………………………………………………………………..
………………………………………………………………………………………………………….
…………………………………………………………………………………………………………..
…………………………………………………………………………………………………………..
………………………………………………………………………………………………………….
67
d. Top-Down design –
…………………………………………………………………………………………………………..
…………………………………………………………………………………………………………..
………………………………………………………………………………………………………….
…………………………………………………………………………………………………………..
…………………………………………………………………………………………………………..
………………………………………………………………………………………………………….
e. Test data-
…………………………………………………………………………………………………………..
…………………………………………………………………………………………………………..
…………………………………………………………………………………………………………..
………………………………………………………………………………………………………….
f. Bug –
…………………………………………………………………………………………………………..
…………………………………………………………………………………………………………..
………………………………………………………………………………………………………….
g. Debugging –
…………………………………………………………………………………………………………..
…………………………………………………………………………………………………………..
………………………………………………………………………………………………………….
h. Dry run –
…………………………………………………………………………………………………………..
…………………………………………………………………………………………………………..
………………………………………………………………………………………………………….
68
i. System Flowchart –
…………………………………………………………………………………………………………..
…………………………………………………………………………………………………………..
………………………………………………………………………………………………………….
j. Program flowchart –
…………………………………………………………………………………………………………..
…………………………………………………………………………………………………………..
………………………………………………………………………………………………………….
2. a. Define Subroutine .
…………………………………………………………………………………………………………..
…………………………………………………………………………………………………………..
………………………………………………………………………………………………………….
…………………………………………………………………………………………………………..
…………………………………………………………………………………………………………..
………………………………………………………………………………………………………….
Advantage 1 –
…………………………………………………………………………………………………………..
…………………………………………………………………………………………………………..
………………………………………………………………………………………………………….
Advantage 2 –
…………………………………………………………………………………………………………..
…………………………………………………………………………………………………………..
69
3. Give two reasons for technical documentation.
Reason 1 –
…………………………………………………………………………………………………………..
…………………………………………………………………………………………………………..
………………………………………………………………………………………………………….
Reason 2 –
…………………………………………………………………………………………………………..
…………………………………………………………………………………………………………..
………………………………………………………………………………………………………….
4.A program validates a four-digit password in at a terminal. Describe three types of test data that ensure
that the program will handle any input correctly.
1………………………………………………………………………………………………………….
2…………………………………………………………………………………………………………
3………………………………………………………………………………………………………….
…………………………………………………………………………………………………………..
…………………………………………………………………………………………………………..
………………………………………………………………………………………………………….
Advantage 1 –…………………………………………………………………………………………..
…………………………………………………………………………………………………………..
Advantage 2 –………………………………………………………………………………………….
………………………………………………………………………………………………………….
70
6.a. State two ways in which procedures can help a programmer.
Way 1 –………………………………………………………………………………………………...
…………………………………………………………………………………………………………
Way 2-…………………………………………………………………………………………………
………………………………………………………………………………………………………..
1…………………………………………………………………………………………………………...
2………………………………………………………………………………………………………
7.a. A program has been written for recording the number of hours of sunshine each day and to
calculate the average hours of sunshine per day for each month of the year. Three types of data,
standard, extreme and abnormal are used to test this program.
Standard –……………………………………………………………………………………………….
Extreme –………………………………………………………………………………………………..
Abnormal –………………………………………………………………………………………………
1…………………………………………………………………………………………………………..
…………………………………………………………………………………………………………...
2…………………………………………………………………………………………………………..
……………………………………………………………………………………………………………
c. Describe three features of the documentation that would be needed for modifying the program in the
future.
1………………………………………………………………………………………………………...
2………………………………………………………………………………………………………..
3………………………………………………………………………………………………………
71
8. Sate two items of user documentation that should be provided.
1.…………………………………………………………………………………………………………..
……………………………………………………………………………………………………………
2. …………………………………………………………………………………………………………
…………………………………………………………………………………………………………..
1……………………………………………………………………………………………………………..
………………………………………………………………………………………………………………
2…………………………………………………………………………………………………………..
…………………………………………………………………………………………………………….
1…………………………………………………………………………………………………………..
……………………………………………………………………………………………………………
2…………………………………………………………………………………………………………..
……………………………………………………………………………………………………………..
72
Sec 3 - Algorithm and the Method of Representation -2
1. Define BASIC
Beginners All Purpose Symbolic Instruction Code.
2. Define Statement
Each instruction in a program is called statement.
3. Define Variable
It is an item which the values changes at the time of execution. There are Numeric variables and
String variables. Eg: A, B, B$, A$
4. Define Constant
Constant is an item of data that’s value does not change at the time of execution.
Eg: 10 C=0
20 C=C+1
40 GOTO 20
1. Input Statement:- allows the user to enter data as the program is running .
20 PRINT A$, N
RUN
? “COMPUTER” , 75
COMPUTER 75
Eg. 10 INPUT X, N$
20 PRINT X,N$
73
RUN
? 40, “ENGLISH”
40 ENGLISH
6. Define Branches
A Branch breaks the normal sequence of the program. The two types of branches are:
1. GO TO Statement
2. IF THEN Statement
Eg: 40 GO TO 20
2. IF… THEN Statement: It is a conditional statement. IF condition THEN action, where the action is
taken, IF the condition is true otherwise the program carries on its sequence to the next statement.
Eg: Write a program to find the greatest no: from the given two no:’s
10 INPUT A, B
20 IF A>B THEN 50
40 GO TO 60
60 END
74
7. LOOP : A part of the program which can run repeatedly until a condition is satisfied is called a loop.
1. REPEAT…. UNTIL LOOP : It is a loop statement which helps you to repeat the actions until the
condition is satisfied. In Repeat…..Until statement first Action then check the condition , if the
condition is No the action will take place until the condition is satisfied. A REPEAT statement is
always followed by the UNTIL statement with condition is equal to.
Syntax:
ACTION
TEST Yes
No
- Eg: REPEAT
PRINT FAR
UNTIL DATA= -1
75
2. WHILE…. DO…. ENDWHILE LOOP:
Syntax :
YES
ACTION
TEST
NO
NO
In WHILE statement, first the condition is checked. If the condition is yes, the action takes place otherwise it
will come out from the loop. A WHILE statement with Condition not equal to followed by Do ……… and
Eg : TOTAL =0
ENDWHILE
PRINT TOTAL
Dry Run
0 -
50 0+50=50 -
75 50+75=125 -
33 125+53=158 -
0 158
76
3. FOR… NEXT LOOP : A FOR statement is always followed by a NEXT statement.
10 FOR N= 1 TO 5
20 PRINT “COMPUTER”
30 NEXT N
40 END
Dry Run
N OUTPUT
1 COMPUTER
2 COMPUTER
3 COMPUTER
4 COMPUTER
5 COMPUTER
1. Routine operations can be carried out several times in different parts of the program without having
to repeat all of the instructions.
1. Using the trace table, dry run the following algorithm, Show the output at each stage.
0 -1 0 -
b) What is the output if the loop terminates when the count equals 5
78
2. Below is a short algorithm. Dry run the algorithm and Redo using While ..Do……..Endwhile
statement
Repeat
Input a number
Calculate the number multiplied by itself
Print the result of this calculation
Until the number is 0
Output is _____________________
______________________
79
3. Read this algorithm
_____________________________________________________________________________
80
4. Read this algorithm
Set positive to 0
Set negative to 0
Set count to 0
Read a number
WHILE number is not 0 Do
Add 1 to count
IF number greater than 0
THEN add 1 to positive
ELSE add 1 to negative
ENDIF
Read next number
ENDWHILE
Set proportion 1 to positive divided by count
Set proportion 2 to negative divided by count
Output positive, negative, proportion 1, proportion 2
81
5. Read this algorithm.
Set neg=0
Set pos=0
Read number
WHILE number is not 0 Do
IF number is less than 0 THEN add 1 to neg
ELSE add 1 to pos
ENDIF
Read number
ENDWHILE
Print neg, pos
82
6. Read this algorithm
Make Count-one = 0
Make Count-two = 0
Read character
WHILE character is NOT a full stop Do
IF character= a space or a punctuation mark
Make Count-one =Count-one+1
ELSE
Make Count-two = Count-two+1
ENDIF
Read character
ENDWHILE
Make Count-one= Count-one+1
Make answer = Count-two/Count-one
Output answer
END
Count-one :_________________________________
Count-two :_________________________________
answer:____________________________________
83
7. Read this algorithm
5,6,7,8,9,10
84
d) Rewrite the algorithm using Repeat …………………….Until statement
1. Set total to 0
2. Set counter to 0
3. Input First rainfall
4. Repeat
5. Add Rainfall to total
6. Add one to counter
7. Input next Rainfall
8. Until Rainfall is less than Zero
9. Divide total by counter
10. Output result
85
b) What is the purpose of line 8 ?
86
c) Rewrite the algorithm using WHILE…………………DO…………….ENDWHILE loop
87
11. Read this algorithm.
Input A,B
If A>B then
T=A
A=B
B=T
Endif
Output A, B
a. Write down the output if the following two numbers are input:
45, 38
88
Worksheet No: 8 TermII Date:……………
Topic : WRITING ALGORITHM / PSEUDOCODE
Level 1: 2, 3, 4, 5 Level 2:1, 6, 7, 10, 11 Level 3: 8, 9, 12
1. A credit card company keeps its’ customers account details in a master file. When a customer wants
to purchase an item in a shop the customer card is swiped through a card reader. The company’s
computer first checks to see if the card is stolen. If it is not stolen the computer then checks to see if
the amount of the purchase is less than or equal to the amount of money that the customer is allowed
to spend. If so an authorization code is sent to the shop and the purchase is completed, otherwise the
request is cancelled. Design an algorithm to show this data processing.
89
2. Write an algorithm to find the smallest number from the given 20 numbers.
3. Write an algorithm to find the largest number from the given 15 numbers.
90
4. Write an algorithm to input the height of 15 students and print the height of tallest student.
5. Write an algorithm to find the smallest and greatest no from the given 30 numbers.
91
6. Mr John grades his students examination mark. To do this he needs to know the lowest and the
highest mark, the range of marks (highest-lowest) and the average mark (total no.of marks/
no:of students) . There are 30 students in the class and the mark is out of 100. Write an
algorithm to read the mark to print the smallest mark, largest mark, range of mark and the
average mark.
92
7. Read this algorithm.
Value = 0
Next-value = 0
Input value
Input Next-value
endif
Input Next-Value
Endwhile
Output Value
5,4,8,3,0,23
93
b) Write a modified algorithm to solve the same problem but always end after four numbers have been
input.
Distinction 70 – 100
Merit 55 – 69
Pass 40- 54
Fail 0- 39
Any other mark display an error message. Write an algorithm to input the mark of 20 pupils and for
each pupil output either a grade or an error message.
94
9. Pupils are graded in a test based on the following marks.
Distinction 70 – 100
Merit 55 – 69
Pass 40- 54
Fail 0- 39
Any other mark display an error message. Write an algorithm to input the mark of 20 pupils and for
each pupil output No:of Distinction , No:of Merit, No: of Pass and No: of fail
95
10. Customers can withdraw cash from an Automatic Teller Machine(ATM)
Write an algorithm which inputs a request for a sum of money, decides if a withdrawal can be made and
calculates any charges. Appropriate output messages should be included.
96
11. A company has 5000 CDs, DVDs, videos and books in stock. Each item has a unique 5-digit code with
the first digit identifying the type of item, i.e.
1 = CD
2 = DVD
3 = VIDEO
4 = BOOK
For example, for the code 15642 the 1 identifies that it is a CD, and for the code 30055 the 3 identifies that it
is a video.
Write an algorithm, using pseudocode or otherwise, that
97
12. A small airport handles 400 flights per day from three airlines:
Each flight is identified by the airline code and 3 digits. For example FA 156.
Write an algorithm, using pseudocode or otherwise, which monitors the 400 flights into and
out of the airport each day. The following inputs, processing and outputs are all part of the
monitoring process:
98
Worksheet No: 9 Term II Date: ……………....
Topic: Sec 3 Practice questions (to be done in the notebook)
Level 1: 5, 6, Level 2:4,7,9 Level 3: 1-3, 8, 10
Questions 1 to 3 contain sections of pseudocode which contain errors. Locate the errors and suggest the
correct coding. Questions 4 to 10 are problems which require an algorithm to be written in pseudocode –
there is “no right answer” here; as long as the pseudocode works then the solution is acceptable.
(1) The following section of pseudocode inputs 1000 numbers and then outputs how many were negative,
how many were positive and how many were zero.
Locate the 3 errors and suggest a corrected piece of code.
1 negative = 1: positive = 1
2 for x = 0 to 1000
3 input number
4 if number < 0 then negative = negative + 1
5 if number > 0 then positive = positive + 1
6 endif
7 endif
8 next
9 print negative, positive
(2) The following section of pseudocode inputs rainfall (in cm) for 500 days and outputs the average
rainfall and the highest rainfall input.
Locate the 3 errors and suggest a corrected piece of code.
1 highest = 1000
2 days = 1
3 while days > 0
4 input rainfall
5 if rainfall > highest then highest = rainfall
6 endif
7 total = total + rainfall
8 days = days + 1
9 average = total/500
10 endwhile
11 print average, highest
(3) The following section of pseudocode inputs a number, n, multiplies together 1 x 2 x 3 x ……. x n,
calculates input number/sum and outputs result of the calculation.
Locate the 3 errors and suggest a corrected piece of code.
1 input n
2 for mult = 1 to n
3 sum = 0
4 sum = sum * mult
5 result = n/sum
6 next
7 print result
99
(4) Regis lives in Brazil and often travels to USA, Europe and Japan. He wants to be able to convert
Brazilian Reais into US dollars, European euros and Japanese yen. The conversion formula is:
currency value = number of Reais X conversion rate
For example, if Regis is going to USA and wants to take 1000 Reais (and the exchange rate is 0.48)
then he would input USA, 1000 and 0.48 and the output would be: 480 US dollars.
Write an algorithm, using pseudocode, which inputs the country he is visiting, the exchange rate and
the amount in Brazilian Reais he is taking. The output will be value in foreign currency and the name
of the currency.
(5) As part of an experiment, a school measured the heights (in metres) of all its 500 students.
Write an algorithm, using pseudocode, which inputs the heights of all 500 students and outputs the
height of the tallest person and the shortest person in the school.
(6) A geography class decide to measure daily temperatures and hours of sunshine per day over a 12
month period (365 days)
Write an algorithm, using pseudocode, which inputs the temperatures and hours of sunshine for all
365 days, and finally outputs the average (mean) temperature for the year and the average (mean)
number of hours per day over the year.
(7) A small shop sells 280 different items. Each item is identified by a 3 – digit code. All items that start
with a zero (0) are cards, all items that start with a one (1) are sweets, all items that start with a two
(2) are stationery and all items that start with a three (3) are toys.
Write an algorithm, using pseudocode, which inputs the 3 – digit code for all 280 items and outputs
the number of cards, sweets, stationery and toys.
(8) A company are carrying out a survey by observing traffic at a road junction. Each time a car, bus,
lorry or other vehicle passed by the road junction it was noted down.
10 000 vehicles were counted during the survey.
(9) Speed cameras read the time a vehicle passes a point (A) on the road and then reads the time it passes
a second point (B) on the same road (points A and B are 100 metres apart). The speed of the vehicle
is calculated using:
100
Speed = ------------------------------------------ (metres/sec)
(time at point B – time at point A)
The maximum allowed speed is 100 kilometres per hour. 500 vehicles were monitored using these
cameras over a 1 hour period.
101
Introduction to Logic
Many electronic circuits operate using binary logic gates. Logic gates basically process signals which
represent true or false or the equivalent i.e. ON or OFF, 1 or 0
Whilst there are a number of logic gates, only the five simplest are covered in this booklet: NOT gate, AND
gate, OR gate, NAND gate and NOR gate.
The following notes describe the function of all five gates, how to produce truth tables, how to design
networks using logic gates, and how to determine the output from a logic network.
Truth tables are used to show logic gate functions (refer to next section). The NOT gate has only one input
(and one output) but the other four gates have two inputs (but still only one output).
NOT gate
The output (called X) is true (i.e. 1 or ON) when the INPUT A is NOT TRUE (i.e. 0 or OFF).
102
AND gate
The output (called X) is only true (i.e. 1 or ON) if the (INPUT A AND INPUT B) are both true (i.e. 1 or
ON).
OR gate
The output (called X) is true (i.e. 1 or ON) if the (INPUT A OR INPUT B) are true (i.e. 1 or ON).
NAND gate
NOR gate
103
This is basically an OR gate with the output X inverted.
The output (called X) is true (i.e. 1 or ON) if NOT (INPUT A OR INPUT B) are true (i.e. 1 or ON).
The tables above containing 1s and 0s are known as truth tables and are an integral part of logic gates
functionality.
It is possible to combine logic gates together to produce more complex logic networks.
Consider the following logic network which contains three inputs and three logic gates:
If we now look at the output in two stages. First let us consider the outputs being produced at stages S and T.
To do this we need to draw a truth table. There are three inputs (A, B and C) which gives 23 (i.e. 8) possible
combinations of 1s and 0s. To work out the outputs at S and T we need to refer to the truth tables for the
NOR gate and for the AND gate. For example, when A = 1 and B = 1 then we have 1 NOR 1 which gives the
value of S = 0. Continuing doing the same thing for all 8 possible inputs we get the following interim truth
table:
104
Designing logic networks to solve a specific problem and testing using truth tables
“If button A or button B are on and button C is off then the alarm X goes on”
We can convert this onto logic gate terminology (ON = 1 and OFF = 0):
If (A = 1 OR B = 1) AND (C = NOT 1) then (X = 1)
(Notice: rather than write 0 we use NOT 1)
To draw the logic network, we do each part in brackets first i.e. A = 1 OR B = 1 is one gate then C = NOT 1
is the second gate. These are then joined together by the AND gate. Once the logic network is drawn we can
then test it using a truth table. Remember the original problem – we are looking for the output to be 1 when
A or B is 1 and when C is 0. Thus we get the following logic network and truth table from the network.
Looking at the values in the truth table, we will be able to clearly see that it matches up with the original
problem which then gives us confidence that the logic network is correct.
105
2. A steel rolling mill is to be controlled by a logic network made up of AND, OR and NOT gates only.
The mill receives a stop signal (i.e. S = 1) depending on the following input bits:
The first thing to do is to try and turn the question into a series of logic gates and then the problem
becomes much simplified.
• The first statement can be re-written as: (L = 1 AND V = NOT 1) since Length > 100 metres
corresponds to a binary value of 1 and Velocity < 10 m/s corresponds to a binary value of 0 (i.e. NOT
1).
• The second statement can be re-written as (T = NOT 1 AND V = 1) since Temperature <
1000C corresponds to a binary value of 0 (i.e. NOT 1) and Velocity > 10 m/s corresponds to a binary
value of 1
• Both these statements are joined together by OR which gives us the logic statement: if (L = 1
AND V = NOT 1) OR (T = NOT 1 AND V = 1) then S = 1
106
Workheet No : 10 TermII Date:……………
Topic: Logic Gates (Practice)
Level 1: Level 2:1 Level 3:2
a)
b)
2. The following require both the logic network to be created and also the truth table. The truth table can be
derived from the logic network, but also from the problem. This is a check that the logic network actually
represents the original problem.
a) A computer will only operate if three switches P, S and T are correctly set. An output signal (X = 1)
will occur if R and S are both ON or if R is OFF and S and T are ON. Design a logic network and
draw the truth table for this network.
b) A chemical plant gives out a warning signal (W = 1) when the process goes wrong. A logic network
is used to provide input and to decide whether or not W = 1.
108