You are on page 1of 108

THE WESTMINSTER SCHOOL, DUBAI

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

• To understand communications Vs off-the-shelf software. They will


software (including email), web also be able to explain use of data
browsers, search engines and authoring logging tools
packages
• Some will be able to understand macros
• To appreciate the advantages and and how they are used to customize
disadvantages of generic packages software.
compared with specially written
bespoke software

• To know how packages may be


customised by the use of macros.

• To be able to explain the use of tools


associated with data-logging.
data • To create an awareness of the standard • All should be able to identify devices of
methods of data collection, automatic automatic data capture. They should be
data capture, verification and able to understand the need for
validation, and where it is appropriate validation and verification. They should
to use particular methods. be able to identify data, field, record
and file in a DBMS. They should be
• To understand that data, particularly aware of the need for different data
data held in files, requires access in types and data structures.
different ways depending on the
particular application. The medium on • Most will be able to understand the
which the data is stored, and different verification and validation
particularly the way in which it is techniques including check digit
organised, depend on the requirements generation method. They will also
for access. understand the importance of file
maintenance and processing and
• To familiarize file ordering (sort / querying.
merge). Students should have
experience of sequential file • Some will be able to handle querying
2
processing and of processing for specific problems
individual records by means of record
keys.
Algorithm • To define the scope of modular
design and programming. To design algorithms
testing which relate clearly to the
requirements of the system. • All should be able to define modular
programming, top down design. They
• To explain algorithms and how they should be able to fill empty structure
relate to the system. How hardware diagrams. They should be able to do
needs arise from the output required dry runs on basic programs.
from the system
• Most will be able to apply suitable test
• To introduce algorithm tools like top- data to work out the purpose of an
down design, structure diagrams, algorithm. They will also understand
flowcharts, menus, libraries of procedures and subroutines.
procedures and subroutines.
• Some will be able to identify errors in
• To work out the purpose of an an algorithm and correct them.
algorithm using dry runs with trace
tables, and to suggest and apply
suitable test data.

• To be able to identify errors in a given


algorithms and suggest ways of
removing these errors.
Programs, • To represent algorithms as structure
representation diagrams, flowcharts, step sequences
of algorithms and description, and more formally in • All should be able to fill structure
and pseudocode. diagrams or flowcharts given a choice
documentation of processes. They should know the
• To understand the main requirements function of a translator.
of a programming language, to allow
manipulation of data of various types • Most will be able to represent basic
and structures, including control of algorithm in the form of flowcharts or
input and output, and to provide for pseudocode. They will know the use of
selection, repetition and subprogram the different documentations. They will
intercommunication. know the syntax of the different
programing constructs.
• To understand the basic functions of
interpreters, compilers and assemblers, • Some will know how to use logic to
and an appreciation of the benefits write pseudocode correctly for any type
offered by the existence of a range of of problem.
languages, both high- and low-level.

• To know need for user documentation


and technical documentation and
program maintenance.
3
Logic gates • To understand and define the function • All will be able to identify the basic
and circuits of NOT, AND, OR, NAND and NOR gates along with their truth tables. They
logic gates. Truth Tables will know the two methods of
• To produce truth tables for given logic representing the gates.
circuits. • Most will be able to produce the truth
• To produce a simple logic circuit from table for a logic circuit
a given written statement (e.g. if A • Some will be able to draw a logic
AND B are on AND if C is on then the network when given a written statement
lights will be on).

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.

File – Is an organized collection of related records.

Record – Is a collection of related data items.

Field – Is a single item of data.

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.

EMPNO EMPNAME SEX AGE DEPT


1011 JOHN M 25 ACCOUNTS
1012 AMIR M 45 PERSONAL
1013 DOWN F 40 COMPUTING
1014 HANA F 47 PRODUCTION

EMPNO, EMPNAME, SEX, AGE, DEPT are the fields.(5 fields)

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) .

EMPNO EMPNAME SEX AGE DEPT


1011 JOHN M 25 ACCOUNTS
1012 AMIR M 45 PERSONAL
1013 DOWN F 40 COMPUTING
1014 HANA F 47 PRODUCTION

EMPNO is the keyfield.

Fixed length fields – If the fields are of fixed length then each field has a maximum number of character
positions.

Eg. DATE, CODES etc

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

Wastage of storage space for the short items in a given field.

Advantages of variable length field over fixed length field

1. Maximum no :of character position is not predetermined.


2. No wastage of storage space.
3. A variable length can store an item however long it is.

Tables and Arrays

There are two special data structures used in computing.

Tables- The simplest table is asset of paired entries.

British Rail : return fares from London

Destination

Ticket Type Bristol Hull Newcastle

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.

Eg. 1 Basicpay 1000


2 T.A 200
3 H.R.A 500

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

DBF – Database file. Here EMPLOYEE.DBF is a Serial Access file.

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.

SELECT THE FIELD EMPNAME

CLICK
ST.DBF (Sorted file)

RECNO EMPNO EMPNAME SEX AGE DEPT


1 1012 AMIR M 45 PERSONAL
2 1013 DOWN F 40 COMPUTING
3 1014 HANA F 47 PRODUCTION
4 1011 JOHN M 25 ACCOUNTS

SORT – command is used to sort the database file.


Here ST.DBF is the Sequential 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.

Advantages of Sequential access over Direct Access

1. Low – cost media (Magnetic Tape) can be used


2. Most records need updating.
3. Automatic back-up files (Old master file on separate tape).
4. It is easier to write programs which handle sequential files.
7
Advantages of Direct Access over Sequential

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

TEACHER 1 TEACHER 2 CLASS 1 CLASS 2

Directory – is the list of file names, together with information enabling the files to be retrieved
from backing store by the operating system.

The main directory on a disc is called the Root directory.


A Sub directory is a part of the root directory which can be accessed separately.
8
Root directory

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.

How data can be lost on computer.

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.

Guidelines for system security

1. Restrict the number of users.


2. Check the security features of the software.
3. Educate and train people to accept the importance of security.
4. Use user ID and Password.
5. Lock the room/Lock the system.

File(data) security methods:


1. Back-up copies of files on disk or tape.
2. Physical safeguards. (Only authorized personnel are allowed into the computer area. Locks to
room and machines to restrict access).
3. Giving passwords.
4. Generation of files.
5. Data encryption- changing the data into coded form.
9
File Maintenance

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:

move to cell K40


is result of calculation < 0
if < 0 then load file “error report”
if >= 0 then output value

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 (Database Management Systems – DBMS)

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:

(Smallest size (microns) < 1) OR (Toxic = “yes”)


would output records 4, 7, 8 and 9

(Largest size (microns) > 99) AND (Toxic = “no”)


Would output records 1, 2, 3, 6 and 10

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

1. Identify the System flowchart Symbols given.

12
2. System flowchart to update the master file using the transaction file
Stages of Data processing – Application : Payroll

Payroll – Preparing Payslips for the employees.

Data Capture Clock cards collected each week

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.

Calculate pay Sorted transaction file


Error report Update
Printed payslips Updated master file
Payroll transaction file Validation
Sort

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.

CUSTOMER ORDERS INVALID ORDERS

INVOICES ORDER ENTRY

ORDER FILE STOCK FILE UPDATE PROCESS

VALIDATION PROCESS

ORDER ENTRY

16
6. Select words from the list below to complete the systems flowchart for electricity bill
payments.

Errors master file Sorted transaction file


Update validate validated transaction file

payments

sort

New master file

17
7. Place the files in the correct space in the above diagram.

Master file Sorted Transaction file Unsorted transaction file

Updated master file.

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

Backup new Validate Input Update


master file data data master file

The correct order is:

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

Write these names once in the correct flowchart symbol.

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 –

…………………………………………………………………………………………………………..

…………………………………………………………………………………………………………..

…………………………………………………………………………………………………………

7. Sequential access file-

…………………………………………………………………………………………………………..

…………………………………………………………………………………………………………..

………………………………………………………………………………………………………….

8. On-line processing –

…………………………………………………………………………………………………………..

…………………………………………………………………………………………………………..

………………………………………………………………………………………………………….

9. Relational database –

…………………………………………………………………………………………………………..

…………………………………………………………………………………………………………..

………………………………………………………………………………………………………….

…………………………………………………………………………………………………………..

10. Hierarchical database –

…………………………………………………………………………………………………………..

…………………………………………………………………………………………………………..

………………………………………………………………………………………………………….

11. Distributed database –

…………………………………………………………………………………………………………..

…………………………………………………………………………………………………………..

………………………………………………………………………………………………………….
22
12. Macro –

…………………………………………………………………………………………………………..

…………………………………………………………………………………………………………..

…………………………………………………………………………………………………………..

13. File generation-

…………………………………………………………………………………………………………..

…………………………………………………………………………………………………………..

………………………………………………………………………………………………………….

14. Verification-

…………………………………………………………………………………………………………..

…………………………………………………………………………………………………………..

………………………………………………………………………………………………………….

…………………………………………………………………………………………………………..

15. Validation -

…………………………………………………………………………………………………………..

…………………………………………………………………………………………………………..

…………………………………………………………………………………….…………………….

2. A hospital database holds confidential personal data.

(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

(i) A directory that includes sub- directories


(ii) A sub- directory
(iii) A file.

(b) Give one benefit of using sub- directories.

………………………………………………………………………………………………………….

………………………………………………………………………………………………………….

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.

Field Name Field description Data Type Field length

MAKE Name of manufacture Text 30

NUMPLATE Car registration no: Alphanumeric 8

REG Date car registered Date 6

(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

YEARS WITH THE COMPANY 2 digits

The following codes are used.

SEX F – Female

M – Male

DEPARTMENT A- Administration

P- Personnel

M-Management

F-Finance

Two typical records are

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

(a) In which Department does J Onslow work ?

…………………………………………………………………………………………………………

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.

Types of Barcode Readers :


1. A laser scanning device
2. A light pen or hand held wand

Advantages of Bar codes:


1. Bar codes can be printed by normal printing methods.
2. Staff do not have to write down or key in the name of the items or its price.

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.

Point –of- Sale (POS) system


In the point of sale / cash transaction, a cashier passes the bar-coded product over a scanner or hand-held
‘wand’. The terminal is connected to a central computer which reads and looks up the price of the product
from the database and displays the price on a lighted panel. It also computes the amount and prints an
itemized bill or receipt.
This method of data input is beneficial

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.

Advantages of a magnetic stripe:


1. It is simple to produce.
2. It is not easily damaged (Except by magnetic fields)
3. It stores a fairly a large number of characters.

Disadvantages of magnetic stripe:


1. The data can be changed or erased by magnetic field.

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.

Advantage:- No keyboard is necessary


Can be used for remote locations through the telephone.
Useful in situations where the people are busy in handling documents and products.

30
Disadvantages.
Recognition is slow and limited to some words.
The error rate is relatively high.
Speaker has to be very clear.
Limited vocabulary.

Applications of speech input .

1. Security and access control.


2. Date entry in banks.
3. Quality control and automation in factories.
4. Computer aided design (CAD)
5. Voice- activated appliance.

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.

Data entry methods

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.

Eg. MALE --------------- M


FEMALE----------- F
YES--------------- Y
NO---------------- N
DATE/MONTH/YEAR------- DD/MM/YY

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)

How check digits are calculated.

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

To calculate the check digit for the ISBN 0 - 2 0 1 - 5 3 0 8 2 - ?

(i) the position of each digit is considered:


10 9 8 7 6 5 4 3 2 1 ← digit position
0 - 2 0 1 - 5 3 0 8 2 - ? ← number

(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

To check the correctness of a check digit the computer re-calculates it as follows:

The ISBN to check is: 0 - 1 3 1 5 - 2 4 4 7 - X

(i) the position of each digit is considered:


10 9 8 7 6 5 4 3 2 1 ← digit position
0 - 1 3 1 - 5 2 4 4 7 - X ← number

(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.).

There are a number of ways in which verification can be done:

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

Example: if 11000110 is sent (four 1’s)


and 11100110 is received (five 1’s)
then the system will know an error has occurred.

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

Application Software is divided into

1. User application programs.


2. Application Packages.

User Application Programs written by the user to perform a specific job


Application Packages are prewritten programs purchased ‘off the shelf’ by the user.

Advantages of Application Packages.

1. Saves time, effort and expense of programming


2. Tried and tested.
3. User friendly and easy to run.
4. Quick results for busy managers.
5. Relatively cheap.

Disadvantages of application packages.

1. May not meet special needs.


2. Poor or unclear documentation.

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.

Source program translator Object program

Low level language Assembler Machine level language


(Assembly level language)

High level language Interpreter or compiler Machine level language

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.

Operating environment - An operating environment combines an operating system with integrated


applications software
Eg. WIMP (Windows, Icons, Menu, Pointer)

Graphical User Interface (GUI)

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.

Advantages of Graphical User Interface


1. No need to learn DOS commands.
2. Limits the amount of typing required.
3. Allows multitasking ie different jobs in different windows.

Disadvantages
It is not useful when handling errors in the operating system or troubleshooting.

Command Line Interface (CLI)

In this environment all instructions need to be entered at the command prompt.

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.

Word processing features.

Main features available in all word processors:

- ability to set the page size and page orientation


- ability to change font style and font size (e.g. arial, courier, times new roman, etc.)
- ability to change margins (top, bottom and sides)
- page format (e.g. paragraphs, columns, etc.)
- importing text, graphics and pictures into the document body
- inserting and deleting text
- cut and paste/copy and paste (to prevent the need to re-type sections of text or to move/remove text)
- search and replace based on key words
- word wrap (e.g. auto adjust a line to fit into paragraph alignment such as straight margins on left and right,
etc.)
- file management (create/delete/move/search for files)
37
- headers and footers and the automatic numbering of pages
- graphics (embed drawings and graphs into the document)
- macros
- merge (merge text files from one file into another e.g. mail merge)
- ability to send documents to a printer
- carry out a word count on the document
- add and manipulate tables in the main body of the document
- windows (edit 2 or more documents at the same time)
- WYSIWYG (what you see is what you get) – preview document to see how it will look when printed
- spell checkers, language check and thesaurus
- simple translation from one language to another; for example:
This is an example of a document translated from English to French
C'est un exemple d'un document traduit d'anglais-français

Desk Top Publishing (DTP)

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.

The following is a list of key differences to word processors:

- 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

The following is a brief summary of the common features found in 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)

- formulas are used to represent a mathematical function


e.g. = (C5 * D5) * 100
= A5 + B5 + C5+ D5

- functions allow computations to take place


e.g. SUM, AVERAGE, MAX, MIN
e.g. the second formula above could be written as = SUM(A5:D5)

- it is also possible to use mathematical/logical expressions within cells


e.g. IF G5 > 100 THEN “Y” ELSE “N”

- it is also possible to create charts and graphs from spreadsheets (e.g. using a chart wizard).
For example:

39
Formula

formula in cell D2 is = (B2/C2)

replicating this formula (by highlighting then drag down to D7) gives all the formulas needed in cells D3 to
D7

formula in D8 (to find average) can be done in 3 ways:


= AVERAGE(C2:C7) or
= SUM(C2:C7)/6 or
=(C2+C3+C4+C5+C6+C7)/6

formula in D9 to find maximum value in column is = MAX(C2:C7)


Problems associated with spreadsheets:

- 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.

Bespoke versus off-the-shelf software

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.

There are many advantages and disadvantages of both systems.

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

Bespoke Software – disadvantages

- 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.

(2) A record contains the following fields:


- Title (Mr/Mrs/Miss) and Sex (Male or Female)
- Date of birth (written in the form dd/mm/yyyy)
- Pay Number (which is made up of 8 digits)
- Telephone Number
- Pay
Give a different validation check for each of the above fields and explain why it is used.

(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

(b) Calculate the check digit for the following number:


0 – 1 5 0 – 2 4 6 2 2 – ………

(c) Discuss the types of errors that check digits can identify.

(4) (a) Describe three ways of carrying out verification checks.


(b) Give two examples where verification checks would be made.

(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

. 1. Part of a holiday file is shown below.

BOOKING MEALS NIGHTS HOTEL PRICE($)


NO

BK0042 RO 7 REGENT 250

BK0043 FB 5 SAVOY 400

BK0044 HB 6 BROWNS 380

BK0046 FB 7 SEAVIEW 375

BK0048 BB 10 HILLTOP 295

(a) Complete the table below to show the data type and field size for each field.

FIELD NAME DATA TYPE FIELD SIZE

BOOKING NO

MEALS

NIGHTS

HOTEL

(b) How many fields are there in the given file .

( c )How many records are there in the file.

(d) Name the key field .

Reason-

(e) The following search condition is input

(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.

Code_Num Colour Speakers Power(W) Num-of-CDs Price($)

13416 Black 4 50 4 650

13425 Silver 2 60 1 500

13504 Silver 4 80 5 750

14001 Black 4 100 3 1100

14005 Black 4 100 10 1200

14010 Silver 2 40 1 350

(a) Which field should be used as the key field ?

…………………………………………………………………………………………………………..

(b) Which Code_Num data will be listed if the following search condition is input ?

(Speakers=4) AND (Num-of-CDs>4)

…………………………………………………………………………………………………………

…………………………………………………………………………………………………………...

(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.

REF MAKE DOORS YEAR

F214 FORD 3 1998

R317 RENAULT 4 1995

F219 FORD 5 1997

M412 MAZDA 5 1994

T517 TOYOTA 3 1996

C615 CITROEN 4 1995

(a) State the name of a field that contains

(i) numeric data………………………………………………………………………………………

(ii) alphabetic data ……………………………………………………………………………...

(b) Suggest two additional fields that could usefully be added to this database.

1.………………………………………………………………………………………………………

2……………………………………………………………………………………………………….

(c) The following search condition is Input.


(REF contains “M”) OR (YEAR>1996)
Write down the output using only the REF field.

……………………………………………………………………………………………………………….

(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.

Ref No Manufacturer Model Doors 0-100kph Top Speed(kph) Price($)


time(sec)
1015 Bentley Arnage 4 6.0 250 300 000
1023 Porsche Boxster 2 5.5 266 55 000
1158 Fiat Stilo 5 12.4 170 14 000
1911 Maserati GT 2 4.8 288 105 000
2051 Lexus GS 4 6.3 250 95 000
2081 Renault Laguna 5 8.4 220 25 000
2516 Porsche Cayenne 5 5.6 260 130000
3331 VW Golf 3 9.3 200 27 500
3456 Lotus Elise 2 5.7 205 42 500

(a) How many records are shown in the section of the database above?

…………………………………………………………………………………………………………

(b) If the following query was input

(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

time(sec) of less than 7.0.

…………………………………………………………………………………………………………

5. A company stores a stock list of jeans in a computer file. Several records are shown in the diagram.

Item code colour Location code quantity Cost($) Sell($)


12134 B L24 100 180 270
16572 W C58 42 150 225
15462 B R39 28 280 420
23156 G L27 72 320 480
43287 W C48 94 60 90
54387 B R27 8 420 630

a) Write down an item of string data that is stored.

…………………………………………………………………………………………………………………

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.

COMPUTER PROCESSOR RAM HARD DISK CD PRICE($)


CA200 P200 16 2Gb 4 6405
CA201 P200 16 2.5Gb 0 3397
CA233 P233 32 3Gb 6 6589
CA266 P266 32 4Gb 8 10679
CA267 P266 32 4Gb 10 12895
CA166 P166 16 1.5Gb 0 3019

a) Write down an item of string data.

………………………………………………………………………………………………………………….

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.

CODE ITEM INSTOCK SOLD ONORDER PRICE($)


C301 Floppy disk 24 16 20 1.5
G101 Rubber 16 14 10 1
G102 Pen 18 22 20 2
G103 Pencil 5 25 30 1
M101 Protractor 8 12 20 1.5
M202 Compass 8 10 20 2

a) Suggest two more fields that could be used in this database.

………………………………………………………………………………………………………………..

………………………………………………………………………………………………………………….

b) List the ITEMs output if the following search condition is used.

(CODE contains “M”) OR (INSTOCK<15)

………………………………………………………………………………………………………………….

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.

REFNO CUSTOMER DATE PROBLEM MINUTES STAFF


3123 SMITH 991121 MODEM 4 MB
3124 PATEL 991121 CDROM 8 JG1
3125 HUDSON 991121 SCANNER 7 JG2
3126 HUANG 991122 SCANNER 4 MB
3127 PATEL 991122 PRINTER 15 JG1
3128 JONES 991122 ZIP DRIVE 5 SH

a) Circle on item of alphanumeric data.

b) Which field in the file should be as a keyfield ?

…………………………………………………………………………………………………………………..

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:

CODE SURNAME INITIAL SEX PHONE NO DATE OF BIRTH


M1001 Philips R F 3294625 11/12/86
M1011 Patel P M 2453674 04/01/88
M1025 Brown A F 2756484 15/05/86
M1037 Khan S.L M 2759815 18/02/87
M1057 Lee B.R M 2456785 21/07/86
M1073 Smith L F 3297684 09/02/88
M1096 Chong M.A M 2765492 03/09/87
M1102 Schon G M 2451843 22/04/88
M1124 Shah J.A M 3298746 14/04/86
M1139 Davies S.L F 2768798 09/01/88

a) State how many fields there are in each record.

………………………………………………………………………………………………………………….

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 ?

(DATE OF BIRTH<01/01/87) AND (SEX=”M”)

…………………………………………………………………………………………………………………..

e) Describe how the file can be sorted in ascending order of SURNAME.

…………………………………………………………………………………………………………………...

…………………………………………………………………………………………………………………...

…………………………………………………………………………………………………………………..

51
10. A radio station keeps a database of all its music CDs. Here is part of this database:

Reference CD title number of special CD length number of


Number tracks edition (mins) hit tracks

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

a) How many records are there in the database section?

…………………………………………………………………………………………………………………

b) If the following query was input:

(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

1. The following spreadsheet show a student’s expenses for four weeks.

A B C D E F

1 ITEMS WEEK 1 WEEK 2 WEEK 3 WEEK 4 TOTAL

2 TRAVEL 4.50 3.60 1.80 6.30

3 FOOD 29.00 32.00 25.00 33.00

4 CLOTHES 5.00 3.50 9.00 15.00

5 STATINARY 5.20 12.00 18.00 20.00

6 LEISURE 9.00 42.00 26.00 35.00

7 TELEPHONE 2.20 2.50 2.50 2.50

a) Write down a cell reference which contains

i) a label ______________

ii) a value ______________

iii) a string data ______________

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

a) Write down a cell which should contain

i) a label –…………………………………………………………………………………………….

ii) a number -………………………………………………………………………………………..

b). Suggest a formula that could be in D2 to calculate the average mark.

…………………………………………………………………………………………………………….

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

1 Waiting time Serving time Total time

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

(a) Circle and label on the diagram a cell which contains

(i) Numeric data

(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

7 Total Order Value($):

a) (i) Name a cell which contains a numerical value:

…………………………………………………………………………………………………………..

(ii) Name a cell which contains text only.

…………………………………………………………………………………………………………..

b) What formula must be placed in cell E2 to calculate the value of the order for customer 1234 ?

…………………………………………………………………………………………………………….

c) How could the formula in Question 10 (b) be replicated in cells E3 to E6 ?

………………………………………………………….……………………………………….…………

………………………….………………………………………………………………………………….

d) What formula should be placed in cell E7 to add up the totals in Column E ?

……………………………………………………………………………………………………………….

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

a) The Stock value ($) of each item sold is given by

(No.in stock – No.sold) x Price ($)

Write down a formula that could be inserted in cell E2 to calculate the Stock value ($) of cameras.

……………………………………………………………………………………………………………

……………………………………………………………………………………………………………

b) Describe how the formula in E2 could be copied into cells E3 to E5.

……………………………………………………………………………………………………………

…………………………………………………………………………………………………………….

……………………………………………………………………………………………………………..

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

a) State the format of the data in cell B6.

……………………………………………………………………………………………………………..

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.

……………………………………………………………………………………………………………

…………………………………………………………………………………………………………….

……………………………………………………………………………………………………………..

d) Cell F7 contains the function :

=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

Objectives (from system specifications)

Program planning and design

Writing the instructions in a programming language.

Testing and debugging

Writing up the program documentation

Implementation(putting the program in action)

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.

3. Define System Specification

• System specification is a system design in the term of hardware and software requirements. System
specifications includes system flowcharts and structure charts.

4. Define System Documentation

• 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

• An Algorithm is a series or sequence of action design to solve a particular problem.

59
Eg:- Write an algorithm to find the product of two numbers.

1. Start

2. Input two numbers X, Y

3. Find the product P=X*Y

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 .

7. Define System 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.

SYMBOLS OF SYSTEM FLOWCHART

Input/ Output

Document

Magnetic Disk

Screen Display

60
Magnetic tape

Online storage

Manual Input

Process

Communication Link

8. Define Program flowcharts

Program flowchart is used to describe the sequence of operation within a program.

61
PROGRAM FLOWCHART SYMBOLS

Start/ Stop

Connector

Input/Output

Process

YES Decision Box

NO

Predefined Box(used for several purposes)

62
9. Define Top down Design

It is an orderly approach to programming which emphasis breaking large and complex tasks into
successively smaller section.

10. Define Modular Programming

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.

11. Give two benefits of modular programming methods

1. The program can be tested in sections(modules) so that it is easier to find mistakes.

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.

STRUCTURED PROGRAMMING PROCEDURE

1. Sequence: One program instruction follows another.

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

13. Define Loop

A part of the program which can be run repeatedly until a condition is satisfied.

E g: FOR…… NEXT LOOP

REPEAT……..UNTIL LOOP

WHILE……DO….ENDWHILE LOOP

14. Define Subroutine

A subroutine is a group of instructions which can be used several times at different event points in a
program.

Eg: GOSUB……………. RETURN

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.

16. Define User Documentation


User Documentation is the part of the program documentation relating to the program, that gives the
user information necessary for the successful operation of the program.

17. Define Technical Documentation


It contains the configuration of the system, system documentation and program documentation. It is
written for a computer professional than the user.

18. Define Bug


An error in the program is called bug.

19. Define Debug


Correction of errors in the program called Debug.

20. Define Test Data


Test data is the data used to test the program or flowchart for the expected result. The three types of
data’s are:

1. Normal data.

2. Abnormal data.

3. Extreme data.

21. Define Dry Run


It is a use of test data to check the paths of, through a program without the use of a computer.

22. Define Trace Table


Trace table is a tabulator method of data recording the values expected to be taken by the variables as
test data processed by a program.

23. What are the three types of errors ?

The three types of errors are:

1. Syntax error

2. Logical error

3. Execution / Run time 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.

(a) Explain why an application package needs to be flexible.

(b) What is meant by robust?

(c) What is program maintenance ?

(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

1. Explain the terms.

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 .

…………………………………………………………………………………………………………..

…………………………………………………………………………………………………………..

………………………………………………………………………………………………………….

b. Describe a subroutine which could be used by more than one program.

…………………………………………………………………………………………………………..

…………………………………………………………………………………………………………..

………………………………………………………………………………………………………….

c. Give two advantages of Subroutine (Procedures).

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………………………………………………………………………………………………………….

5.a. Define Modular programming.

…………………………………………………………………………………………………………..

…………………………………………………………………………………………………………..

………………………………………………………………………………………………………….

b. Give two advantages of modular programming. (top – down design) (modules)

Advantage 1 –…………………………………………………………………………………………..

…………………………………………………………………………………………………………..

Advantage 2 –………………………………………………………………………………………….

………………………………………………………………………………………………………….

70
6.a. State two ways in which procedures can help a programmer.

Way 1 –………………………………………………………………………………………………...

…………………………………………………………………………………………………………

Way 2-…………………………………………………………………………………………………

………………………………………………………………………………………………………..

b. State two reasons why program documentation is provided.

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 –………………………………………………………………………………………………

b. State two benefits of writing this program using top-down design.

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. …………………………………………………………………………………………………………

…………………………………………………………………………………………………………..

9. State two items that included in the program’s documentation.

1……………………………………………………………………………………………………………..

………………………………………………………………………………………………………………

2…………………………………………………………………………………………………………..

…………………………………………………………………………………………………………….

10. State two items included in the technical documentation.

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$

30, 50, “COMPUTER”, “ENGLISH”

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

30 IF C=10 THEN END

40 GOTO 20

50 END Here C is a Variable and 1 is a Constant.

5. Define Reserved Words


A reserved word is an identifier which the programmer cannot use because it is a part of vocabulary
of the programming language and has a special meaning to the translator. Eg: INPUT, PRINT

Identifier is a name chosen by the programmer.

1. Input Statement:- allows the user to enter data as the program is running .

Eg: 10 INPUT A$, N

20 PRINT A$, N

RUN

? “COMPUTER” , 75

COMPUTER 75

2. Print Statement: is used to output information onto the screen or printer.

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

1. GO TO Statement: It is an unconditional statement.

Eg: 40 GO TO 20

The control jumps back to the 20th line no without checking .

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

30 PRINT B; “is the greatest”

40 GO TO 60

50 PRINT A; “is the greatest”

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

FAR= (CENT* 9/5) + 32

PRINT FAR

UNTIL DATA= -1

DATA 25, 20, 10, -1

The execution is taken place until the data is -1(Rogue value)

8. Define Rogue value


A Rogue value is a specified value at the end of the list of data items, which is used to terminate
further input.

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

closed by ENDWHILE statement.

Eg : TOTAL =0

WHILE SLAES< > 0

DO TOTAL = TOTAL + SALES

ENDWHILE

PRINT TOTAL

DATA 50, 75, 33, 0 Rogue value

Dry Run

Sales Total Output

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.

Eg: Write a program to print COMPUTER 5 times

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

Advantages of SUBROUTINE or SUBPROGRAM

1. Routine operations can be carried out several times in different parts of the program without having
to repeat all of the instructions.

2. Different program can use the same program segment.

9. What are the items included in the technical documentation?


1. The purpose of the system.
2. The requirements of the system.
3. The input and output formats.
4. System flowcharts.
5. Method of solution.

10. Define Array


An Array is a set of storage locations referenced by a single identifier. The limits of an array are
declared in a DIMENSION statement in BASIC.
Eg: 10 DIM X(5) is declared as one dimensional array with five elements.
10 DIM X(15,25) declares as two dimensional array with 15 rows and 25 columns.
77
Worksheet No:7 Date:……………………..

Topic: DRYRUN THE ALGORITHMS USING TRACE TABLE


Level 1: trace table Level 2: predict output Level 3: conversion of loop

1. Using the trace table, dry run the following algorithm, Show the output at each stage.

Set the count equal to zero


Set number equal to negative one
Set the total equal to zero
Repeat
Count equals the count plus one
Number equals the number plus one
Total equals the total plus number
Print the total
Until the count equals four
count number total output

0 -1 0 -

b) What is the output if the loop terminates when the count equals 5

c)Redo the algorithm using While …….Do………….Endwhile.

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

Write down the output using the data 3,1,0,2,6

Output is _____________________

______________________

79
3. Read this algorithm

Set the word-count to 0


Set the char-count to 0
Read the next-word
Repeat
Set length to number of characters in the word
Increase the char-count by length
Increase word-count by 1
Read the next word
Until the word is SENT
Set the average to char-count divide by word-count
Output the average

a) Using the data I LIKE COMPUTER STUDIES SENT


dry run the algorithm by completing this table.
Word-count Char-count word length Is word=”SENT”? Output

b) What is the purpose of each of the variables word-count and char-count ?

Word Count ___________________________________________________

Char Count ____________________________________________________


c) What is the purpose of the algorithm ?

_____________________________________________________________________________

d) What is the purpose of the word “SENT”?

e) What problem will occur if this data is used ?

THE COMPUTER WAS SENT FOR REPAIR SENT

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

a) Using the data 2,-3,4,-,6,0 in the algorithm , Complete this table.

Positive Negative Count number Is number Proportion 1 Proportion 2


equal to 0?

b) What does the output represent ?

c) What is the purpose of the 0 value in the data.

d) Redo the algorithm using Repeat…………………Until statement.

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

Using the data 3, -2,- 4, 5, 6, 0 Complete this table.

neg pos number output

Redo the algorithm using Repeat …………………………Until statement.

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

a) If the input is MY NAME IS BILL.


What is the output
Output :____________________________________

b) What do the variable Count-one, Count-two and answer represent?

Count-one :_________________________________

Count-two :_________________________________

answer:____________________________________

83
7. Read this algorithm

1. Set total to Zero


2. Input Number
3. For count is one to Number
4. Input Mark
5. Add Mark to Total
6. Next count
7. Output Total/Number

a) Dry run the algorithm for the following data.

5,6,7,8,9,10

b) Write down the final value of total .

c) Write down the value output .

84
d) Rewrite the algorithm using Repeat …………………….Until statement

8. Read this algorithm

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

a. Determine the results when the following data are input.

20, 21, 25, 23,21,-1

85
b) What is the purpose of line 8 ?

c) Rewrite the algorithm using WHILE…………..DO………..ENDWHILE

9. Read this algorithm

11. Set total to Zero


12. Set counter to Zero
13. Input number
14. Repeat
15. Add number to total
16. Add one to counter
17. Input Next number
18. Until number is less than Zero
19. Divide Total by counter
20. Output result

a) State the purpose of line 8

b) Determine the result when the data are input 10,11,15,13,11,-2

86
c) Rewrite the algorithm using WHILE…………………DO…………….ENDWHILE loop

10.Read this algorithm

Set vowels, Consonants and other to Zero


Read character
WHILE character is not @ Do
IF character is A, E, I,O or U add 1 to vowels
ELSE IF character is B,C,D,F,G,H,J,K,L,M,N,P,Q,R,S,T,V,W,X,Y, or Z add 1 to consonants
ELSE add 1 to other
ENDIF
ENDIF
Read Character
ENDWHILE
Output vowels, consonants, other
END

a) Using the data “HELLO,JANE “@


Dry run the algorithm spaces are ignored.

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

b. Explain the purpose of the variable T.

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

While Next-value is not equal to Zero do

If Next-value is greater than Value then

Value is equal to Next-value

endif

Input Next-Value

Endwhile

Output Value

a) What is the output if the following numbers are input.

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.

8.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 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)

• Withdrawal is refused if amount entered > current balance


• Withdrawal is refused if amount entered > daily limit
• If current balance < $100, then a charge of 2% is made
• If current balance ≥ $100, no charge is made

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

• Inputs the codes for all 5000 items


• Validates the input code
• Calculates how many CDs, DVDs, videos and books are in stock
• Outputs the four totals.

97
12. A small airport handles 400 flights per day from three airlines:

FASTAIR (code FA)


SWIFTJET (code SJ)
KNIGHTAIR (code KA)

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:

• input flight identification


• calculate number of flights per day for each of the three airlines
• output the percentage of the total flights per day by each airline
• any validation checks must be included

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.

Write an algorithm, using pseudocode, which:


• inputs all 10000 responses
• outputs the number of cars, buses and lorries that passed by the junction during the survey
• outputs the number of vehicles that weren’t cars, buses or lorries 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.

Write an algorithm, using pseudocode, which:


100
• inputs the start time and end time for the 500 vehicles that were monitored
• calculate the speed for each vehicle using the formula above
• outputs the speed for each vehicle and also a message if the speed exceeded 100 km/hour
• output the highest speed of all the 500 vehicles monitored

(10) There are ten stations on a railway line:


1 ------ 2 ------ 3 ------ 4 ------ 5 ------ 6 ------ 7 ------ 8 ------ 9 ------ 10
The train travels in both directions (i.e. from 1 to 10 and then from 10 to 1). The fare between each
station is $2.
A passenger inputs the number of the station at the start of his journey and the number of the
destination station and the fare is calculated (e.g if a passenger gets on a station 3 and his destination
is station 9 his fare will be $12). The calculation must take into account the direction of the train (e.g.
a passenger getting on at station 7 and getting off at station 1 will also pay $12 and not a negative
value!!).
A discount of 10% is given if 3 or more passengers are travelling together.

Write an algorithm, using pseudocode, which:


• inputs the number of passengers travelling
• inputs the station number of the starting point and the station number of the destination
• calculates the total fare taking into account the direction of travel
• calculates any discount due
• outputs the cost of the tickets and prints the tickets

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.

The five main logic gates


The most common symbols used to represent logic gates are shown below. To avoid confusion the graphical
representations will be used in exam questions but candidates may use either set of symbols when answering
questions.

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).

Description of the function of the five logic gates

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

This is basically an AND gate with the output X inverted.


The output (called X) is true (i.e. 1 or ON) if (INPUT A AND INPUT B) are NOT both true (i.e. 1 or ON).

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.

Combinations of logic gates

It is possible to combine logic gates together to produce more complex logic networks.

Producing the truth table from a given logic network

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:

The final stage involves S OR T.

104
Designing logic networks to solve a specific problem and testing using truth tables

Consider the following problem:

“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:

A stop signal (S = 1) occurs when:


either Length, L > 100 metres and Velocity, V < 10 m/s
or Temperature, T < 1000 C and Velocity, V > 10 m/s
Draw a logic network and truth table to show all the possible situations when the stop signal could be
received.

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

1. produce truth tables from the given logic networks.

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.

A warning signal (W = 1) will be generated if


3
either (a) Chemical Rate < 10 m /s
or (b) Temperature > 87 C and Concentration > 2 moles
3
or (c) Chemical rate = 10 m /s and Temperature > 87 C
107
Draw a logic network and truth table to show all the possible situations when the warning signal
could be received.

108

You might also like