GNS - Handbook
GNS - Handbook
What is a Computer?..................................................................................................................................... 5
3. CLASSIFICATION OF COMPUTER................................................................................................................ 9
CLASSIFICATION BY PURPOSE........................................................................................................................ 9
Analogue Computer................................................................................................................................... 9
Digital Computer........................................................................................................................................ 9
Minicomputers ........................................................................................................................................ 10
Microcomputers ...................................................................................................................................... 10
THE SOFTWARE............................................................................................................................................ 12
6. USES OF COMPUTER................................................................................................................................ 15
Preliminary study..................................................................................................................................... 19
System analysis........................................................................................................................................ 20
System Design.......................................................................................................................................... 20
Coding...................................................................................................................................................... 21
Testing ..................................................................................................................................................... 22
Implementation....................................................................................................................................... 22
Documentation........................................................................................................................................ 23
Maintenance............................................................................................................................................ 23
BASIC Keywords........................................................................................................................................... 25
Symbolic Declaration............................................................................................................................... 27
I/O Statement.......................................................................................................................................... 28
Assignment Statements........................................................................................................................... 28
Conditional Statement............................................................................................................................. 28
Control Statements.................................................................................................................................. 28
1. HISTORY & DEVELOPMENT OF COMPUTER
TECHNOLOGY
What is a Computer?
A computer is an electronic machine, which executes software programs for the purpose of generating
information. This implies that, computer accepts data as input, processes it based on pre-defined
instructions (program) and gives out information as output. It consists of two parts, namely, hardware and
software. Computers have become indispensable in today’s world. Computers are made use of in virtually
all areas of human endeavour.
The technologies behind the following devices and the contributions of these scientists played significant
roles in the invention of the computer machine:
The Abacus
The name Abacus derives from the Greek word ABAX meaning table or board covered with dust. The
abacus is a manual calculating device, which uses beads instead of fingers to represent decimal numbers.
The beads are strung in rows. The position of row represents the decimal values of beads in it. Making
calculations on abacus is a manual operation. Beads are moved left to right to represent values.
Napier’s “Bones”
Napier’s bones was developed by John Napier in 1614. His invention was a method for performing
arithmetic operations by the manipulation of rods, called “bones” because they were often constituted
from bones and printed with digits. Napier’s rods essential rendered the complex process of multiplication
and division into the comparatively simple tasks of addition and subtraction.
Blaise Pascal
In 1642, Blaise Pascal, a French Mathematician built “Pascaline Machine” for the purpose of performing
addition, subtraction, division and multiplication. This machine was acclaimed to be the first true
calculating machine.
The first Slide Rule appeared in 1650 and was the result of a joint effort of two Englishmen Edmund Gunter
and the Reverend William Oughtred. This slide rule based on Napier’s Algorithms was to become the first
analog computer (of the modern age) since multiplication and subtractions were figured out by physical
distance. This invention was dormant until 1850 when a French artillery officer Amedee Mannheim added
the moveable double sided cursor, which gave it its appearance as we know it today.
Charles P. Babbage
It is generally agreed that the first major step in the development of computers can be attributed to Charles
P. Babbage, a professor of mathematics at Trinity College, Cambridge England.
Babbage became interested in computing extensive mathematical table, which would make the metric
system easier to use. So, in 1812, he developed the “Difference Engine”, which was capable of computing
mathematical table automatically.
Vacuum tubes were used to provide temporary data storage (memory) in early digital computers. Pins on
the tube’s base were connected via wires to internal elements arranged in grids on cathode, collector,
insulator, and read-write sheets. Multiple miniature electrical circuits formed logical gates that held bits of
data (1 or 0). A 16x16 arrangement could store and read back 256 bits of data. Some tubes with multiple
stacked sheets could store 4096 (4 kilobits) of data. The data in memory was erased when the tube was
powered off.
Punched Cards
Early digital computers used punched cards for data transfer and storage. In 1801, an event occurred which
was to have far-reaching effects on the later development of automatic equipment. During this year, Dr.
Herman Hollerith, a statistician, was engaged by the United States of America Census Bureau as a special
agent to speed up the processing of census data which hitherto was done for almost eight years!
The first transistors were developed at AT&T’s Bell Laboratories by Walter Brattain, John Bardeen, and
Robert Gibney in 1947. The initial semiconductor devices, point contact electronic amplifiers, were made of
germanium, plastic and gold.
ENIAC was the first general-purpose electronic computer built around 1946. It derived its speed advantage
over previous electromechanical computers from using digital electronics with no moving parts. ENIAC was
capable of being reprogrammed to solve a full range of computing problems.
In the early 1950’s, An Wang, working at Harvard University, and Jay Forrester, at MIT, contributed to the
development of a practical magnetic core computer memory. With no moving parts, it was highly reliable.
This form of solid state memory was used to provide main memory storage for a computer’s central
processing unit.
Magnetic tape began to be used to store data in the 1950’s. A powerful electromagnet was used to write
data on a layer of ferromagnetic material on an acetate or polyester film. Once written, the data record
remained readable for a long time (in excess of ten years). The data could be read, erased, or rewritten
electromagnetically, so that a tape could be reused many times
In 1959, Jack Kilby, at Texas Instruments, and Robert Noyce, at Fairchild Semiconductor, independently
developed ways of building entire circuits, that could incorporate transistors, resistors, capacitors and
internal connectors, in a single silicon chip. The miniature integrated circuits were made by building up
etched layers of silicon semiconductor crystals.
2. GENERATIONS OF COMPUTER
Each generation of computers is characterized by major technological development that fundamentally
changed the way computers operate, resulting in increasingly smaller, cheaper, more powerful and more
efficient and reliable devices. Read about each generation and the developments that led to the current
devices that we use today.
First generation computers were characterized by the fact that operating instructions were made-to-order
for the specific task for which the computer was to be used. Each computer had a different binary-coded
program called a machine language that told it how to operate. This made the computer difficult to
program and limited its versatility and speed. Other distinctive features of first generation computers were
the use of vacuum tubes (responsible for their breathtaking size) and magnetic drums for data storage.
Another third-generation development included the use of an operating system that allowed machines to
run many different programs at once with a central program that monitored and coordinated the
computer's memory. Examples are ICL 1900 series and IBM 360 series.
Artificial Intelligence is the branch of computer science concerned with making computers behave like
humans. The term was coined in 1956 by John McCarthy at the Massachusetts Institute of Technology.
3. CLASSIFICATION OF COMPUTER
CLASSIFICATION BY PURPOSE
Analogue Computer
They perform operations on data presented in continuous form. They are suitable for representing data as
physical quantities and operate on the data by manipulating the quantities. They are use in scientific and
engineering fields because quantity is very constantly e.g. car speedometer
Digital Computer
Digital computers, on the other hand, controls events that are discrete or finite e.g. process in automobile,
control fuel braking system. The numbers operated on by a digital computer are expressed in binary
system. Digital computer makes use of raw data for process unlike analog computer, can store the result of
its process for later use .It is mostly a general –purpose device.
Hybrid Computer
Hybrid Computer combines the feature of both analog and digital computers. It consists of an analog and
digital computer incorporated together in a single system. It accepts varying inputs and converts them to
digital values for processing. They are mostly used in scientific and technical operations e.g. ECG machines,
analog machine measure patient temperature then they are converted to numbers and supply digital
computer.
CLASSIFICATION BY SIZE
It can be categorized into four types are as follows:
Super Computer
They are the fastest and powerful types of computer .They are also known as monster computers. They
contain number of CPU, which operate parallel to make it faster. They are expensive. Its speed is between
600million to 900millon instructions per seconds .It is used for weather forecasting and oil exploration by
scientists for complex calculations .examples are CRAYX- MP and CRAY2, PARAM 10000.
Mainframe Computers
These computers are very powerful, large general purpose computer .They are faster and more powerful
than minicomputer. Earliest computers to be developed in the 1940s were the mainframe computer. It can
be used by many people at the same time, and can handle very complex problems or large volume jobs
.They are used mostly in large establishment (e.g universities ,banks, commercial houses etc ).They have
capacity for storage and process information fast.
Minicomputers
They are powerful than microcomputer and supports several uses. However, they are physically smaller
computers compared with mainframe computer .Thus, they are easier to install and operate .It is best
suited for dedicated purpose .Example is PDP VAX 7500
Microcomputers
They are the most popular of computers. Microcomputer are very small and easy to use, otherwise known
as Personal Computer(PCs).A typical microcomputer memory unit stores between 32 and 1,000 million
characters of data .Since these computers are slower than their mainframe and minicomputer
counterparts, processing speeds are measured in megahertz(MHZ) or Gigahertz(GHZ) .These powerful, easy
to operate machines have been called home computers ,laptop computer, notepad, palmtop, Generally
,the larger the processing speed, the faster the computer
4. COMPONENTS OF COMPUTER
Primarily, the computer components consist of The Hardware and The Software.
Lately however, the Humanware component has just been added. The Humanware consists of the
computer operators, programmers, engineers, dbase administrators etc and all those who use the
computer machine.
THE HARDWARE
The computer hardware components constitute all those physical or tangible components of the computer.
They can be touched directly, seen or held. The computer hardware could be grouped into:
Commonly called the ‘CPU’ or Central Processing Unit. It has three logical units found within the computer
casing. These include:
i. The control unit – which receives typed instructions and any other given electrical signals,
interpret them and ensure their properly monitored execution. The operating system is
directly involved here.
ii. The arithmetic and logic unit (ALU) – this unit is primarily concerned with the arithmetic,
logical, statistical or mathematical computations the computer will have to carry out. The
processor directly is involved here.
iii. The storage unit – Computer storage/memory units are needed for holding both currently-
in-use programs and applications as well as data and instruction files intended for keeping,
i.e. saved files.
a. The Primary Memory: This is also called main memory. It comprises the volatile
Random Access Memory (RAM), used to hold currently running program applications
and data (note that its content is lost once the user shuts down the computer system
or as a result of electric power fluctuations) and the Read Only Memory (ROM), used
to hold the firmware. The firmware are manufacturer generated software
instructions such as BIOS (Basic Input Output System), CMOS(Computer Metallic
Oxide Semiconductor), Start-up Instructions etc needed for the booting and proper
functioning of the computer system. The content of the ROM is not altered by the
computer user. There are various makes of ROM:
b. The Secondary Memory: this is also called the auxiliary memory or backing storage.
There are many types of them. They are all used for a more permanent storage of data
and information.
The Peripherals
Are the second category of computer hardware. They are all physical components that must be attached
directly or indirectly to the system unit to function. They fall into the following subcategories:
i. Input Unit Peripherals – Comprises of input unit devices such as computer keyboard, the
scanner, the lightpen, the joystick, the touchpad, Computer input on microfilm (CIM) and
the mouse
ii. Output Unit Peripherals – Comprising of output unit devices such as the monitor (the
computer screen), the computer printer, the computer speaker, computer output on
microfilm (COM), JPEG Viewer, Bar code reader etc.
iii. Storage Unit Peripherals – Comprises of secondary storage devices only e.g. external hard
disk.
iv. Interface Components / Cables and connectors – consists of the copper wire connection
cables (male and female, D-shell etc) for various computer devices, the differently shaped
and types of connectors plugged into the input and output ports of the computer, e.g.
power cable, USB cable, etc.
THE SOFTWARE
Software are the various written programs or set of instructions that run on the computer ‘s hardware.
They are specially written using computer programming languages.
These are specially written programs that control the functioning and operations of the computer system.
These system software are categorized based on their control and usefulness. So, we have:
iv. Interfacing between the computer users on one hand and computer resources on the other
hand.
a. Compilers – language translators that translate entire written program otherwise called source code,
at once to its equivalent object code (the translated code) and machine code equivalent for the
computer execution of the program to take place.
b. Interpreters – these are program language translators that interpret a source code in a line-by-line
order, indicating the inherent errors (called bugs), to be corrected (i.e. debugged) before proceeding to
the next line. It is generally considered to be slower than compilers in program execution.
c. Assemblers – these are the translators used to translate programs written in assembly language to
their equivalent machine language instructions.
ii. Editing – Process of amending documents, and programs. Word Editor, Word pad, Notepad etc are
example of editor programs.
iii. File Copying – Duplication of documents by generating another electronic copy say, from disk A to Disk
B. this is common and relevant during Backup exercise.
i. Dumping – this refers to the process of copying the content of the main memory (the RAM)
onto an output device such as a printer’s memory for printing.
ii. File maintenance Programs- these are programs designed to carry out deletion, insertion or
amendment processes on records as the need arises.
iii. Tracing and Debugging Programs – are programs used in conjunction with the process of
debugging and testing newly developed application programs. Tracing is the process of
dumping the content of the internal storage to the end of tracing cycle of operations following
the execution of certain instruction(s), and errors are located. Debugging is the process of
locating and eliminating errors from a program.
Application Software
The two categories of application software are:
a. User Application programs – These are programs written by the user in order to perform
specific job for the user e.g. payroll programs, stock-control programs etc. they are often called
job, which may be made up of several smaller jobs called tasks. A job usually is a combination
of both the program of instructions (the software) and the data needed by the programmed
instruction.
b. Application Packages – these are the suites of programs with their associated documentations,
designed and used for solving a particular type of user problem.
6. USES OF COMPUTER
There are several uses of computers: -
Word Processing - Word Processing software automatically corrects spelling and grammar
mistakes. If the content of a document repeats you don’t have to type it each time. You can use the
copy and paste features. You can printout documents and make several copies. It is easier to read a
word-processed document than a handwritten one. You can add images to your document.
Internet - It is a network of almost all the computers in the world. You can browse through much
more information than you could do in a library. That is because computers can store enormous
amounts of information. You also have very fast and convenient access to information. Through E-
Mail you can communicate with a person sitting thousands of miles away in seconds. There is chat
software that enables one to chat with another person on a real-time basis. Video conferencing
tools are becoming readily available to the common man.
Digital video or audio composition – Audio or video composition and editing have been made
much easier by computers. It no longer costs thousands of dollars of equipment to compose music
or make a film. Graphics engineers can use computers to generate short or full-length films or even
to create three-dimensional models. Anybody owning a computer can now enter the field of media
production. Special effects in science fiction and action movies are created using computers.
Desktop publishing - With desktop publishing, you can create page layouts for entire books on your
personal computer.
Computers in Medicine - You can diagnose diseases. You can learn the cures. Software is used in
magnetic resonance imaging to examine the internal organs of the human body. Software is used
for performing surgery. Computers are used to store patient data.
Mathematical Calculations - Thanks to computers, which have computing speeds of over a million
calculations per second we can perform the biggest of mathematical calculations.
Banks - All financial transactions are done by computer software. They provide security, speed and
convenience.
Travel - One can book air tickets or railway tickets and make hotel reservations online.
Telecommunications - Software is widely used here. Also all mobile phones have software
embedded in them.
Defense - There is software embedded in almost every weapon. Software is used for controlling the
flight and targeting in ballistic missiles. Software is used to control access to atomic bombs.
E-Learning – Instead of a book it is easier to learn from an E-learning software.
Examinations-You can give online exams and get instant results. You can check your examination
results online.
Computers in Business - Shops and supermarkets use software, which calculate the bills. Taxes can
be calculated and paid online. Accounting is done using computers. One can predict future trends
of business using artificial intelligence software. Software is used in major stock markets. One can
do trading online. There are fully automated factories running on software.
Marriage - There are matrimonial sites through which one can search for a suitable groom or bride.
News-There are many websites through which you can read the latest or old news.
Classmates-There are many alumni websites through which you can regain contact with your
classmates.
Planning and Scheduling - Software can be used to store contact information, generating plans,
scheduling appointments and deadlines.
Plagiarism - Software can examine content for plagiarism.
Sports – Software is used for making umpiring decisions. There are simulation software using which
a sportsperson can practice his skills. Computers are also to identify flaws in techhnique.
Aeroplanes – Pilots train on software, which simulates flying.
Weather analysis – Supercomputers are used to analyze and predict weather.
7. Basic Computer Operations
How Computers Work
Input: Information and programs are entered into the computer through Input devices such as the
keyboard, disks, or through other computers via network connections or modems connected to the
Internet. The input device also retrieves information off disks.
Output: Output Devices displays information on the screen (monitor) or the printer and sends information
to other computers. They also display messages about what errors may have occurred and brings up
message or dialog box asking for more information to be input. The output device also saves information
on the disk for future use.
Processing: The CPU or central processing unit is sometimes called the Control Unit and directs the
operation of the input and output devices. The Coprocessor or the Arithmetic-Logic Unit does arithmetic
and comparisons. The memory or RAM temporarily stores information (files and programs) while you are
using or working on them. The BIOS or basic input/output system controls the dialogue between the
various devices.
DEL or DELETE - Deletes the character at cursor and/or characters to the right of the cursor and all
highlighted (or selected) text.
BKSP or BACKSPACE - Deletes the character to the left of cursor and all hightlighted text.
SPACE BAR - Moves the cursor one space at a time to the right
SHIFT KEY - Use the shift keys to type capital letters and to type the upper character on keys with two
characters on them
CAPS LOCK - Locks the keyboard so it types capital letters (a light goes on when caps lock is on)
TAB - Moves the cursor five spaces to the right (number of spaces are usually adjustable). Tab moves to the
next field in a form or table (Shift-Tab for previous field).
ARROW KEYS - Moves the cursor around document without changing text
FUNCTION KEYS or F KEYS - Access commands by themselves or in combination with the three command
keys; CTRL, SHIFT, and ALT
Command or Special Keys: Command keys work in combination with other keys. Each piece of software
uses the command keys differently though there is a move to standardize some functions. The Control key
or Ctrl is often used to access commands. The Alternative key or Alt is often used to access menus. The Shift
key is used to type CAPITAL LETTERS. As well the command keys are all used to move through documents
and edit text faster and easier. As well many computers have Special keys design specifically for the
particular computer. Apple computers have the Apple keys and Macs have Command keys. Many
keyboards now have a Windows key specifically for Windows 9x and newer systems. Many older computers
also have special keys used for a variety of different functions.
Some Notebook or Laptop keys are left out because of space limitations and they usually have a Special
function key which allows other keys to double for the missing ones.
8. INTRODUCTION TO SYSTEM ANALYSIS AND
DESIGN
Systems are created to solve problems. One can think of the systems approach as an organized way of
dealing with a problem. A system is a collection of components that work together to realize some
objectives.
Basically, there are three major components in every system, namely input, processing and output.
Input Output
Processing
In a system the different components are connected with each other and they are interdependent. For
example, human body represents a complete natural system. We are also bound by many national systems
such as political system, economic system, educational system and so forth. The objective of the system
demands that some output is produced as a result of processing the suitable inputs. A well-designed
system also includes an additional element referred to as ‘control’ that provides a feedback to achieve
desired objectives of the system.
System development life cycle means combination of various activities. In other words we can say
that various activities put together are referred as system development life cycle. In the System
Analysis and Design terminology, the system development life cycle also means software
development life cycle.
The different phases of system development life cycle are shown in fig.1. 2 below:
Preliminary study
Preliminary system study is the first stage of system development life cycle. This is a brief
investigation of the system under consideration and gives a clear picture of what actually
the physical system is? In practice, the initial system study involves the preparation of a’
System Proposal’ which lists the Problem Definition, Objectives of the Study, Terms of
reference for Study, Constraints, Expected benefits of the new system, etc. in the light of
the user requirements. The system proposal is prepared by the System Analyst (who
studies the system) and places it before the user management. The management may
accept the proposal and the cycle proceeds to the next stage. The management may also
Feasibility study
The feasibility study is basically the test of the proposed system in the light of its
workability, meeting user’s requirements, effective use of resources and of course, the cost
feasibility. The main goal of feasibility study is not to solve the problem but to achieve the
scope. In the process of feasibility study, the cost and benefits are estimated with greater
accuracy to find the Return on Investment (ROI). This also defines the resources needed to
complete the detailed investigation. The result is a feasibility report submitted to the
This study is far more detailed and comprehensive than the feasibility study. The detailed
investigation of the system is carried out in accordance with the objectives of the proposed
system. This involves detailed study of various operations performed by a system and their
relationships within and outside the system. During this process, data are collected on the
available files, decision points and transactions handled by the present system. Interviews,
on-site observation and questionnaire are the tools used for detailed system study.
System analysis
Systems analysis is a process of collecting factual data, understand the processes involved,
identifying problems and recommending feasible suggestions for improving the system
functioning. The major objectives of systems analysis are to find answers for each business
process: What is being done, How is it being done, Who is doing it, When is he doing it,
Why is it being done and How can it be improved? It is more of a thinking process and
involves the creative skills of the System Analyst. It attempts to give birth to a new efficient
system that satisfies the current needs of the user and has scope for future growth within
the organizational constraints. The result of this process is a logical system design. Systems
analysis is an iterative process that continues until a preferred and acceptable solution
emerges.
System Design
Based on the user requirements and the detailed analysis of the existing system, the new
system must be designed. This is the phase of system designing. It is the most crucial phase
Some of the common symbols that are used in flowcharting and their respective meanings are
presented below:
Coding
This is also called the programming phase in which the programmer converts the program
specifications into computer instructions .The major tasks involved in this phase are
Before actually implementing the new system into operation, a test run of the system is
done for removing the bugs, if any. It is an important phase of a successful system. After
codifying the whole programs of the system, a test plan should be developed and run on a
given set of test data. The output of the test run should match the expected results.
Implementation:
Implementation is the stage of a project during which theory is turned into practice. The
major steps involved in this phase are: acquisition and Installation of hardware and
Software, Conversion user training and Documentation. After the users are trained about
the computerized system, working has to shift from manual to computerized working. The
process is called ‘Changeover’. The following strategies are followed for changeover of the
system.
a. Direct Changeover: This is the complete replacement of the old system by the new
training.
b. Parallel run: In parallel run both the systems, i.e., computerized and manual, are
executed simultaneously for certain defined period. The same data is processed by
both the systems. This strategy is less risky but more expensive because of the
following:
system.
as it used to do.
c. Pilot run: In this type of run, the new system is run with the data from one or more
of the previous periods for the whole or part of the system. The results are
compared with the old system results. It is less expensive and risky than parallel run
approach. This strategy builds the confidence and the errors are traced easily
Documentation
The documentation of the system is also one of the most important activity in the system
development life cycle. This ensures the continuity of the system. There are generally two
description of the system from the users point of view detailing how to use or
operate the system. It also includes the major error messages likely to be
design, programs, their coding, system flow, data dictionary, process description,
etc. This helps to understand the system and permit changes to be made in the
existing system.
Maintenance
Maintenance is necessary to eliminate errors in the system during its working life and to
tune the system to any variations in its working environments. It has been seen that there
are always some errors found in the systems that must be noted and corrected. It also
means the review of the system from time to time. The review of the system is done for:
knowing the full capabilities of the system, required changes or the additional
project may have to be set up to carry out the change. The new project will then proceed
In 1975, Paul Allen and William Gates, the Microsoft's founding fathers, advanced the spread of BASIC's
popularity by writing a version of BASIC for the personal computer, Altair. They also wrote versions of
BASIC for Apple computer and IBM's DOS. To strengthen its spread, Microsoft shipped a BASIC Interpreter
with its own MSDOS (Microsoft Disk Operating System). IBM-DOS's version of the interpreter was known as
BASICA.
There are, however, other versions of BASIC that use Compiler instead of the common Interpreter.
Compilers and Interpreters are translators that are used to convert the Source Code, written in BASIC for
instance, to an Object Code, which is in machine or computer readable format. The major difference
between the duos is that the BASIC Interpreter translates the source code into object code line by line
during execution and stop for debugging once an error is encountered on a line of instruction. Meanwhile,
the compiler translate the source code into object code one at a time and generates a list of errors notices
in the source code at the end of the execution; debugging can then be done and recompilation follows
again until all errors are debugged.
Like every other high-level programming languages, BASIC also has its own syntax, the rules that guides its
construction. Writing a functional BASIC program requires a strict compliance to its syntax. These syntax
are defined along the path of Data Types that are recognised by BASIC and how they are declared; the
concept of Identifiers and how they are handled within the context of Constants and Variable for storing
data; the use of expressions and statements to make up the instruction lines used in the BASIC program;
the handling of the Flow of Control to express the way BASIC handles the repetition of some useful lines of
instruction block.
A typical BASIC program sample will conclude this discussion to strengthen introductory knowledge in the
subject area.
BASIC Keywords
Keywords are used in BASIC Program; these keywords cannot be used again as Variables or Constants
identifiers to store any form of data. Some of the keywords are presented below with their respective
meaning:
Note that every line of instruction in BASIC program is started with a line number. But in the second
generation of BASIC (like QuickBASIC and PowerBASIC) these line numbers are removed and the use of
Label and GOTO are used to transfer program execution to specified line of instruction.
Pre-defined and Programmer-defined: Pre-defined types are types that are integral part of the
programming language while Programmer-defined types are defined by the programmer using
existing pre-defined types
Scalar and Compound: Scalar data types define data items that can be expressed as single values
(e.g. numbers and characters) while Compound types are defined by data items that comprise
several individual values. The difference being that Scalar types are generally pre-defined and
compound types are often programmer-defined.
Discrete and Non-discrete: Discrete or Ordinal data types are types for which each value (except its
minimum and maximum) has a predecessor and a successor value. The opposite are referred to as
non-discrete types.
Basic and Higher Level: Basic or Primitive data types are the standard scalar predefined types that
are ready for immediate use in any imperative programming language. Meanwhile, Higher level
types are defined from such basic types or other existing higher level types, which are not
necessarily programmer defined - for example, a string high-level type.
Following these background, BASIC makes use of the following Data Types to define the use of
alphanumeric data within the line of instruction in BASIC program. The following table summarises the
different data types that are used in BASIC, their respective sizes and the characters that are used to
identified their used with variables.
Explicit Declaration
declares the variable AS a type by using the DIM statement. For instance
Examples of variable declaration for different data types are presented below:
Symbolic Declaration
declare variable by putting the corresponding symbol after the variable name to define the type.
the above declaration is re-presented below:
20 DIM name$
30 DIM number#
Assignment Statements
this is used to assign a value to a variable name in the program. Data type of the variable name
must be declared before corresponding data is stored into it. Assigning a wrong data type will
trigger error during execution. Example
Conditional Statement
this is used to decide on a course of action after which a condition is tested. The IF ... THEN
statement is mostly used in this context. Example:
Control Statements
the control statements are used to provide for a repetition of block of instruction statements for a
number of times, known or unknown in advance.
10 REM this program prints out the odd number between 1 and 20
20 FOR odd% = 1 TO 20 STEP 2
30 PRINT odd%
40 NEXT
DO ... LOOP
this statement repeats a block of code until the specified condition is true. Example.