Вы находитесь на странице: 1из 45



Subject Code: 14CPL16
I Semester B.E

Prepared by:

Anand M Jyothi T
Asst Professor Asst Professor
Dept. of ISE, Dept. of ISE,
Geetha Shishu Shikshana Sangha ( R)
K.R.S. Road, Metagalli, MYSORE-16
GSSS Institute of Engineering & Technology for Women Dept of ISE

Computer Programming Lab Manual Page 1


Functional block diagram of Computer
CPU, Buses
Mother Board, Chip sets
Operating System & types of OS
Basics of Networking & Topology and NIC
Floppy Disk, Hard disks, CD-ROM/R/RW, DVDs,
Flash drives
Optical media
Keyboard, Mouse, Printers and Plotters.
Introduction to flowchart, algorithm and pseudo code

GSSS Institute of Engineering & Technology for Women Dept of ISE

Computer Programming Lab Manual Page 2

A computer is an electronic device which accepts information and processes the information
according to the program and produces the output. Computer programs may be written in
High level languages like Pascal, Fortran, Cobol and so on. Some programmer also writes
assembly language to carry out the desired task.

A computer system consists of hardware and software. A hardware refers to any physical,
electrical, electromechnaical components of the computer. For example keyboard, mouse,
cabinet of computer is considered as hardware. A software refers to a program or set of
instructions that is written to achieve a specified task.

A computer system has five basic functional units which are listed below
a) Input Unit
b) Output Unit
c) Control Unit
d) Memory Unit
e) Central processing unit
f) Arithmetic Logic Unit
Fig : Block diagram of a Computer

GSSS Institute of Engineering & Technology for Women Dept of ISE

Computer Programming Lab Manual Page 3

Basic units of computer:

GSSS Institute of Engineering & Technology for Women Dept of ISE

Computer Programming Lab Manual Page 4

Input unit:
The input device is used to enter data and information into a computer. The devices like
keyboard, mouse and scanner are commonly used as input devices. A keyboard is used to
enter alphanumeric characters and symbols. The mouse is used to pick or select a command
from the monitor screen. A scanner is used to scan an image or read a barcode and so on.

Central Processing Unit:
The processing unit comprises a processor which interprets the program instructions in
memory, controls the flow of data and performs arithmetic and logical operations. The
program instructions are processed one at a time along with the necessary data. The results
are sent to memory and the next instruction is processed. This method is repeated until the
program is executed.

Arithmetic and Logic unit:
The arithmetic-logic unit (ALU) is the unit of the computer that performs arithmetic and
logical operations on the data. This section of the machine can be relatively small consisting
of circuits and registers which perform arithmetic (+, -, *, /) and logic (>,<,<=,>=,etc)
operations. Arithmetic-logic units which can add and subtract and perform logical operations
form the backbone for the arithmetic and control operations in computers. To perform
scientific calculations the floating-point number system is used.

Control unit:
The control unit controls the overall activities of the components of the computer. It is mainly
used to coordinate the activities among other units. It will send commands signals and
controls the sequence of instructions to be executed. The control unit may be defined as the
parts that effect the retrieval of instructions in proper sequence and application of the proper
signals to the arithmetic unit and the other parts

The function of the control circuitry in a general purpose computer is to interpret the
instruction words and then sequence the necessary signals to those sections of the computer
that will cause it to perform the instructions.

GSSS Institute of Engineering & Technology for Women Dept of ISE

Computer Programming Lab Manual Page 5

Memory Unit:
The memory unit is the unit where all the input data and results stored. The CPU memory is
also called as memory register. The memory of a computer is also available in the form of

Random Access Memory (RAM). RAM is a semiconductor chip. RAM is considered as a
volatile memory, it means aslong power is supporting information stored in it remain. Once
the power is lost, the information stored in the RAM also get erased. Microcomputers
contains read Only Memory (ROM). ROM contains instructions for the microcomputers.

Microcomputers use ROM, programmable read only memory (PROM), and erasable
programmable read-only memory (EPROM) to store selected application programs. The
contents of ROM are determined when the chips are manufactured. The ROM memory is
considered as non volatile, means the information is not get erased even when power is
failed. The most important ROM chip(s) we should know about is the Basic Input/output
system or BIOS. The BIOS is a collection of small computer programs built into a ROM
chip. On personal computer there are three types of memory.

They are
1) Conventional memory: The memory into which we load our software and work files.
Conventional memory also known as base or low memory is any memory below 1M (1024)
although only 640k of it is directly available for our work.

2) Extended memory (XMS): Memory above 1M. This type of memory is usually not directly
available to our software.

3) Expanded memory (EMS): To expand the memory by reserving a special peephole of 64kb
of memory to be used when the computer requests certain data not immediately available
from RAM. Usually a software utility called an Expanded Memory Manager (EMM)
manages this expanded memory.

Output Unit:
The output device is used to display or print result from a computer. Monitor, printer and
plotter are commonly used output devices. A monitor is used to display the result in the form
of text and graphics. The printer is used to print the result. A plotter is used to plot or print
GSSS Institute of Engineering & Technology for Women Dept of ISE

Computer Programming Lab Manual Page 6

graphical result from a computer. Note that a result displayed in a monitor is temporary and it
disappears when the next result is displayed, whereas the output printed using a printer or a
plotter is permanent and these printouts can be used for any business correspondence or
documentation. Normally soft copy is referred to information that is stored on the storage
device. A hard copy refers to a print out showing the information.


The computers can be categorized into:
1. Micro Computers.
2. Mini Computers.
3. Mainframe Computers.
4. Super Computers.

Microcomputers (Personal computers)
Microcomputers are the most common type of computers in existence today, whether at work
in school or on the desk at home. The term "microcomputer" was introduced with the advent
of single chip microprocessors. The term "microcomputer" itself, is now practically an
These computers include:
Desktop computers
Laptop and notebook computers
Tablet PC
Palmtop computers
Personal digital assistants (more commonly known as PDA's)
Programmable calculator

Minicomputers (Midrange computers)
A minicomputer (colloquially, mini) is a class of multi-user computers that lies in the
middle range of the computing spectrum, in between the largest multi-user systems
(mainframe computers) and the smallest single-user systems (microcomputers or personal
GSSS Institute of Engineering & Technology for Women Dept of ISE

Computer Programming Lab Manual Page 7

computers). The contemporary term for this class of system is midrange computer, such as
the higher-end SPARC, POWER and Itanium based systems from Sun Microsystems, IBM
and Hewlett-Packard.

Minicomputers are much smaller than mainframe computers and they are also much less
expensive. The cost of these computers can vary from a few thousand dollars to several
hundred thousand dollars. They possess most of the features found on mainframe computers,
but on a more limited scale. They can still have many terminals, but not as many as the
mainframes. They can store a tremendous amount of information, but again usually not as
much as the mainframe. Medium and small businesses typically use these computers.

Mainframe Computers
The term mainframe computer was created to distinguish the traditional, large, institutional
computer intended to service multiple users from the smaller, single user machines. These
computers are capable of handling and processing very large amounts of data quickly.
Mainframe computers are used in large institutions such as government, banks and large
corporations. These institutions were early adopters of computer use, long before personal
computers were available to individuals. "Mainframe" often refers to computers compatible
with the computer architectures established in the 1960s. Thus, the origin of the architecture
also affects the classification, not just processing power. Mainframes are measured in
millions of instructions per second or MIPS.

An example of integer operation is moving data around in memory or I/O devices. A more
useful industrial benchmark is transaction processing as defined by the Transaction
Processing Performance Council. Mainframes are built to be reliable for transaction
processing as it is commonly understood in the business world: a commercial exchange of
goods, services, or money. A typical transaction, as defined by the Transaction Processing
Performance Council, would include the updating to a database system for such things as
inventory control (goods), airline reservations (services), or banking (money). A transaction
could refer to a set of operations including disk read/writes, operating system calls, or some
form of data transfer from
one subsystem to another.

GSSS Institute of Engineering & Technology for Women Dept of ISE

Computer Programming Lab Manual Page 8

A supercomputer is focused on performing tasks involving intense numerical calculations
such as weather forecasting, fluid dynamics, nuclear simulations, theoretical astrophysics,
and complex scientific computations. A supercomputer is a computer that is at the frontline
of current processing capacity, particularly speed of calculation. The term supercomputer
itself is rather fluid, and today's supercomputer tends to become tomorrow's ordinary
computer. Supercomputer processing speeds are measured in floating point operations per
second or FLOPS.
Example of floating point operation is the calculation of mathematical equations in real
numbers. In terms of computational capability, memory size and speed,
I/O technology, and topological issues such as bandwidth and latency, Supercomputers are
the most powerful. Supercomputers are very expensive and not cost-effective just to perform
batch or transaction processing. Transaction processing is handled by less powerful computer
such as server computer or mainframe.

Micro computers
Microcomputers are the types of computers we are using in your classes at Floyd College.
These computers are usually divided into desktop models and laptop models. They are
terribly limited in what they can do when compared to the larger models discussed above
because they can only be used by one person at a time, they are much slower than the larger
computers, and they cannot store nearly as much information, but they are excellent when
used in small businesses, homes, and school classrooms. These computers are inexpensive
and easy to use. They have become an indispensable part of modern life.

It is a type of computer used for engineering applications (CAD/CAM), desktop publishing,
software development, and other types of applications that require a moderate amount of
computing power and relatively high quality graphics capabilities. Workstations generally
come with a large, high-resolution graphics screen, at large amount of RAM, built-in network
support, and a graphical user interface. Most workstations also have a mass storage device
such as a disk drive, but a special type of workstation, called a diskless workstation, comes
without a disk drive. The most common operating systems for workstations are UNIX and
Windows NT. Like personal computers, most workstations are single-user computers.
GSSS Institute of Engineering & Technology for Women Dept of ISE

Computer Programming Lab Manual Page 9

However, workstations are typically linked together to form a local-area network, although
they can also be used as stand-alone systems.

Desktop Computers
A computer designed to fit comfortably on top of a desk, typically with the monitor sitting on
top of the computer. Desktop model computers are broad and low, whereas tower model
computers are narrow and tall. Because of their shape, desktop model computers are
generally limited to three internal mass storage devices. Desktop models designed to be very
small are sometimes referred to as slimline models.

Notebook computer

An extremely lightweight personal computer, Notebook computers typically weigh less than
6 pounds and are small enough to fit easily in a briefcase. Aside from size, the principal
difference between a notebook computer and a personal computer is the display screen.
Notebook computers use a variety of techniques, known as flat-panel technologies, to
produce a lightweight and non-bulky display screen. The quality of notebook display screens
varies considerably.

In terms of computing power, modern notebook computers are nearly equivalent to personal
computers. They have the same CPUs, memory capacity, and disk drives. However, all this
power in a small package is expensive. Notebook computers cost about twice as much as
equivalent regular-sized computers. Notebook computers come with battery packs that enable
you to run them without plugging them in. However, the batteries need to be recharged every
few hours.

Laptop computer
Laptop is a small, portable computer, small enough that it can sit on your lap. Nowadays,
laptop computers are more frequently called notebook computers.
Sub notebook computer
A portable computer that is slightly lighter and smaller than a full-sized notebook computer.
Typically, sub notebook computers have a smaller keyboard and screen, but are otherwise
equivalent to notebook computers.
GSSS Institute of Engineering & Technology for Women Dept of ISE

Computer Programming Lab Manual Page 10

Hand-held computer
A portable computer that is small enough to be held in ones hand. Although extremely
convenient to carry, handheld computers have not replaced notebook computers because of
their small keyboards and screens. The most popular hand-held computers are those that are
specifically designed to provide PIM (personal information manager) functions, such as a
calendar and address book. Some manufacturers are trying to solve the small keyboard
problem by replacing the keyboard with an electronic pen. However, these penbased devices
rely on handwriting recognition technologies, which are still in their infancy. Hand-held
computers are also called PDAs, palmtops and pocket computers.

Palmtop is a small computer that literally fits in your palm. Compared to full-size computers,
palmtops are severely limited, but they are practical for certain functions such as phone books
and calendars. Palmtops that use a pen rather than a keyboard for input are often called hand-
held computers or PDAs. Because of their small size, most palmtop computers do not include
disk drives. However, many contain PCMCIA slots in which you can insert disk drives,
modems, memory, and other devices. Palmtops are also called PDAs, hand-held computers
and pocket computers.

3: CPU
The central processing unit (CPU, occasionally central processor unit) is the hardware within
a computer system which carries out the instructions of a computer program by performing
the basic arithmetical, logical, and input/output operations of the system. The CPU plays a
role analogous to the brain in the computer. The term has been in use in the computer
industry at least since the early 1960s. The form, design, and implementation of CPUs have
changed dramatically] since the earliest [examples, but their fundamental operation remains
much the same.
On large machines, CPUs require one or more printed circuit boards. On personal computers
and small workstations, the CPU is housed in a single silicon chip called a microprocessor.
Since the 1970s the microprocessor class of CPUs has almost completely overtaken all other
CPU implementations. Modern CPUs are large scale integrated circuits in packages typically
less than four centimetres square, with hundreds of connecting pins.
GSSS Institute of Engineering & Technology for Women Dept of ISE

Computer Programming Lab Manual Page 11

Two typical components of a CPU are the arithmetic logic unit (ALU), which performs
arithmetic and logical operations, and the control unit (CU), which extracts instructions from
memory and decodes and executes them, calling on the ALU when necessary.
Not all computational systems rely on a central processing unit. An array processor or vector
processor has multiple parallel computing elements, with no one unit considered the "center".
In the distributed computing model, problems are solved by a distributed interconnected set
of processors.
The fundamental operation of most CPUs, regardless of the physical form they take, is to
execute a sequence of stored instructions called a program. The program is represented by a
series of numbers that are kept in some kind of computer memory. There are four steps that
nearly all CPUs use in their operation: fetch, decode, execute, and write back.
The first step, fetch, involves retrieving an instruction (which is represented by a number or
sequence of numbers) from program memory. The location in program memory is
determined by a program counter (PC), which stores a number that identifies the current
position in the program. After an instruction is fetched, the PC is incremented by the length
of the instruction word in terms of memory units.
The processor must be able to communicate with all devices. They are connected together by
a communications channel called a bus. A bus is composed of a set of communication lines
or wires. A simple bus configuration is shown. We refer to this bus as the system bus as it
connects the various components in a computer system. Internally, the CPU has a CPU bus
for transferring information between its components (e.g. the control unit, the ALU and the

To form an operational system, these different individual parts of computer must be
connected together in some organized way. There are many ways of doing it. Now, we will
consider three popular structures. If computer is to achieve a reasonable speed of operation, it
must be organized so that all units can handle one full word of data at a given time. When a
word of data is transferred between units, all its bits are transferred in parallel. This requires a
considerable number of wires to establish the necessary connections.
GSSS Institute of Engineering & Technology for Women Dept of ISE

Computer Programming Lab Manual Page 12

A collection of wires that connects several devices is called a BUS. In addition to the wires
that carry the data, the computer must have some lines for addressing and control purpose.
There are mainly three types of bus, namely

DATA BUS They are used for transmission of data, and the number of them corresponds to
the number of bits in a word.
ADDRESS BUS They are used to specify the location of data in the main memory.
CONTROL BUS They indicate the direction of data transfer and coordinate the timing of
events during the transfer.

Single bus structure

A simplest structure, which has a single bus, is as shown in the above diagram. All units are
connected to this bus, so it provides the sole means of interconnection. Because the bus can
be used for only one transfer at a time, only two units can actively use the bus at any given
instant. Bus control lines are used to arbitrate multiple requests for use of this bus. The main
virtue of the single bus structure is its low cost and flexibility for attaching peripheral
devices, but the trade-off is lower operating speed. It is not surprisingly that a single-bus
structure is primarily found in small machines, namely minicomputers and microcomputers.

Fig : Two bus structure

GSSS Institute of Engineering & Technology for Women Dept of ISE

Computer Programming Lab Manual Page 13

The figure shows the simplest form of a two bus structure. The processor interacts with the
memory through a memory bus and handles input and output functions over an I/O bus. Data
passes through the processor on its way to the memory. In such configurations the I/O
transfers are usually under direct control of the processor, which initiates transfers and
monitors their progress until completion.

In personal computers, a motherboard (sometimes alternatively known as the main board,
system board, planar board or, on logic board) is the central printed circuit board in many
modern computers and holds many of the crucial components of the system, providing
connectors for other peripherals.

Motherboard specifically refers to a printed circuit board with expansion capability. The term
main board is applied to devices with a single board and no additional expansions or
capability. In modern terms this would include controlling boards in televisions, washing
machines and other embedded systems.

A motherboard provides the electrical connections by which the other components of the
system communicate. Unlike a backplane, it also connects the central processing unit and
hosts other subsystems and devices. A typical desktop computer has its microprocessor, main
memory, and other essential components connected to the motherboard. Other components
such as external storage, controllers for video display and sound, and peripheral devices may
be attached to the motherboard as plug-in cards or via cables, in modern computers it is
increasingly common to integrate some of these peripherals into the motherboard itself.

An important component of a motherboard is the microprocessor's supporting chipset, which
provides the supporting interfaces between the CPU and the various buses and external
components. This chipset determines, to an extent, the features and capabilities of the

GSSS Institute of Engineering & Technology for Women Dept of ISE

Computer Programming Lab Manual Page 14

A chipset is usually designed to work with a specific family of microprocessors, Because it
controls communications between the processor and external devices, the chipset plays a
crucial role in determining system performance.

In computing, the term chipset is commonly used to refer to a set of specialized chips on a
computer's motherboard or an expansion card. In personal computers, the first chipset for the
IBM PC AT was the NEAT chipset by Chips and Technologies for the Intel 80286 CPU. In
home computers, game consoles and arcade game hardware of the 1980s and 1990s, the term
chipset was used for the custom audio and graphics chips. Examples include the Commodore
Amiga's Original Chip Set or SEGA's System 16 chipset.

Based on Intel Pentium-class microprocessors, the term chipset often refers to a specific pair
of chips on the motherboard: the north bridge and the south bridge. The north bridge links
the CPU to very high-speed devices, especially main memory and graphics controllers, and
the south bridge connects to lower-speed peripheral buses (such as PCI or ISA). In many
modern chipsets, the south bridge contains some on chip integrated peripherals, such as
Ethernet, USB, and audio devices.


An operating system (OS) is software that manages computer hardware resources and
provides common services for computer programs. The operating system is an essential
component of the system software in a computer system. Application programs usually
require an operating system to function.
Time-sharing operating systems schedule tasks for efficient use of the system and may also
include accounting software for cost allocation of processor time, mass storage, printing, and
other resources.
For hardware functions such as input and output and memory allocation, the operating system
acts as an intermediary between programs and the computer hardware, although the
application code is usually executed directly by the hardware and will frequently make
a system call to an OS function or be interrupted by it. Operating systems can be found on
GSSS Institute of Engineering & Technology for Women Dept of ISE

Computer Programming Lab Manual Page 15

almost any device that contains a computer from cellular phones and video game consoles to
supercomputers and web servers.
Examples of popular modern operating systems include Android, BSD, iOS, Linux, OS
X, QNX, Microsoft Windows, Windows Phone, and IBM z/OS. All these, except Windows,
Windows Phone and z/OS, share roots in UNIX.
Types of Operating Systems
A real-time operating system is a multitasking operating system that aims at executing
real-time applications. Real-time operating systems often use specialized scheduling
algorithms so that they can achieve a deterministic nature of behaviour. The main objective
of real-time operating systems is their quick and predictable response to events. They have an
event-driven or time-sharing design and often aspects of both. An event-driven system
switches between tasks based on their priorities or external events while time-sharing
operating systems switch tasks based on clock interrupts.

A multi-user operating system allows multiple users to access a computer system at
the same time. Time-sharing systems and Internet servers can be classified as multi-user
systems as they enable multiple-user access to a computer through the sharing of time.
Single-user operating systems have only one user but may allow multiple programs to run at
the same time.

Multi-tasking vs. single-tasking
A multi-tasking operating system allows more than one program to be running at the
same time, from the point of view of human time scales. A single-tasking system has only
one running program. Multi-tasking can be of two types: pre-emptive and co-operative. In
pre-emptive multitasking, the operating system slices the CPU time and dedicates one slot to
each of the programs. Unix-like operating systems such as Solaris and Linux support pre-
emptive multitasking, as does Amiga OS. Cooperative multitasking is achieved by relying on
each process to give time to the other processes in a defined manner. 16-bit versions of
Microsoft Windows used cooperative multi-tasking. 32-bit versions of both Windows NT and
GSSS Institute of Engineering & Technology for Women Dept of ISE

Computer Programming Lab Manual Page 16

Win9x, used pre-emptive multi-tasking. Mac OS prior to OS X used to support cooperative

A distributed operating system manages a group of independent computers and makes
them appear to be a single computer. The development of networked computers that could be
linked and communicate with each other gave rise to distributed computing. Distributed
computations are carried out on more than one machine. When computers in a group work in
cooperation, they make a distributed system.


Networking basics
Computer network is defined as an interconnection of autonomous computer. Here
autonomous means, there is no master and slave relationship. All computers are equal.
Computer network enables to share the resources. Computer networking also refers to
connecting computers to share data, application software and hardware devices. Networks
allow sharing of information among various computers and permit users to share files. For
example a student accesses compilers sitting at one place, where compiler may be stored on
the other machine. The student takes printout with the help of one printer connected to the
network. The printer can be shared among many students.

Types of networks
Depending the nature of the distances, protocols ( the set of rules used for communication)
the network can be classified into LAN (Local Area Network ), MAN (Metropolitan Area
Network ) and WAN ( Wide Area Network).

Local Area Network (LAN)
A LAN (local area network) is a group of computers and network devices connected
together, usually within the same building. By definition, the connections must be high-speed
and relatively inexpensive (e.g., token ring or Ethernet). They function to link computers
together and provide shared access to printers, file servers, and other services.
GSSS Institute of Engineering & Technology for Women Dept of ISE

Computer Programming Lab Manual Page 17

Any individual computer connected to a network is called workstation. A workstation may
not need a floppy disk or hard disk. A LAN or local area network connects computers and
peripherals in a limited area. LAN requires cables to connect workstations. For example LAN
is used in a hall or within a building.

Metropolitan Area Network (MAN)
A MAN (Metropolitan Area Network) is used to connect computers to cover the city or town.
The range may be approximately 50 Kilometers. Normally cables and fiber optic cables are
used to connect computers. The routing of the messages is fast. Normally central library in a
city may be connected by a MAN, so users can access the information. Figure 5.2 shows a
typical view of Metropolitan Area Network.

Wide Area Network (WAN)
A WAN (Wide Area Network) covers large distance like state, country or continents. The
WAN uses the fiber optics, cables and even satellites also. Here communication circuits are
connected with the help of hardware device called routers. Routers forward small pieces of
information called packets from one to another. Internet is the popular one comes under
WAN. Some of the examples makes use of internet are reservation of Air plane tickets,
railway tickets, etc. Another facility called e-commerce, where business is carried out
through internet. Here people can buy books, articles and so on through registering their
wants through the internet.

Network topology is the arrangement of the various elements (links, nodes, etc.) of
a network. Essentially, it is the topological

structure of a network and may be depicted
physically or logically. Physical topology is the placement of the various components of a
network, including device location and cable installation, while logical topology illustrates
how data flows within a network, regardless of its physical design. Distances between nodes,
physical interconnections, transmission rates, or signal types may differ between two
networks, yet their topologies may be identical.

GSSS Institute of Engineering & Technology for Women Dept of ISE

Computer Programming Lab Manual Page 18


Bus Topology
Bus Topology is the simplest of network topologies. In this type of topology, all the nodes
(computers as well as servers) are connected to the single cable (called bus), by the help of
interface connectors. This central cable is the backbone of the network and is known as Bus
(thus the name). Every workstation communicates with the other device through this Bus.

A signal from the source is broadcasted and it travels to all workstations connected to bus
cable. Although the message is broadcasted but only the intended recipient, whose MAC
address or IP address matches, accepts it. If the MAC /IP address of machine doesnt match
with the intended address, machine discards the signal.

A terminator is added at ends of the central cable, to prevent bouncing of signals. A barrel
connector can be used to extend it. Below I have given a basic diagram of a bus topology and
then have discussed advantages and disadvantages of Bus Network Topology

Fig : Bus topology diagram

Star Topology

In Star topology, all the components of network are connected to the central device called
hub which may be a hub, a router or a switch. Unlike Bus topology (discussed earlier),
where nodes were connected to central cable, here all the workstations are connected to
central device with a point-to-point connection. So it can be said that every computer is
indirectly connected to every other node by the help of hub.
GSSS Institute of Engineering & Technology for Women Dept of ISE

Computer Programming Lab Manual Page 19

All the data on the star topology passes through the central device before reaching the
intended destination. Hub acts as a junction to connect different nodes present in Star
Network, and at the same time it manages and controls whole of the network. Depending on
which central device is used, hub can act as repeater or signal booster. Central device can
also communicate with other hubs of different network. Unshielded Twisted Pair (UTP)
Ethernet cable is used to connect workstations to central node.

Fig Star topology diagram

Ring topology
In Ring Topology, all the nodes are connected to each-other in such a way that they make a
closed loop. Each workstation is connected to two other components on either side, and it
communicates with these two adjacent neighbors. Data travels around the network, in one
direction. Sending and receiving of data takes place by the help of TOKEN.

Token Passing : Token contains a piece of information which along with data is sent by the
source computer. This token then passes to next node, which checks if the signal is intended
to it. If yes, it receives it and passes the empty to into the network, otherwise passes token
along with the data to next node. This process continues until the signal reaches its intended

The nodes with token are the ones only allowed to send data. Other nodes have to wait for an
GSSS Institute of Engineering & Technology for Women Dept of ISE

Computer Programming Lab Manual Page 20

empty token to reach them. This network is usually found in offices, schools and small

Fig: Ring topology diagram

Mesh topology
In a mesh network topology, each of the network node, computer and other devices, are
interconnected with one another. Every node not only sends its own signals but also relays
data from other nodes. In fact a true mesh topology is the one where every node is connected
to every other node in the network. This type of topology is very expensive as there are many
redundant connections, thus it is not mostly used in computer networks. It is commonly used
in wireless networks. Flooding or routing technique is used in mesh topology.

1) Full Mesh Topology:-
In this, like a true mesh, each component is connected to every other component. Even after
considering the redundancy factor and cost of this network, its main advantage is that the
network traffic can be redirected to other nodes if one of the nodes goes down. Full mesh
topology is used only for backbone networks.
GSSS Institute of Engineering & Technology for Women Dept of ISE

Computer Programming Lab Manual Page 21

Fig: Mesh Topology Diagram
2) Partial Mesh Topology:-
This is far more practical as compared to full mesh topology. Here, some of the systems are
connected in similar fashion as in mesh topology while rests of the systems are only
connected to 1 or 2 devices. It can be said that in partial mesh, the workstations are
indirectly connected to other devices. This one is less costly and also reduces redundancy.

Tree Topology
Tree Topology integrates the characteristics of Star and Bus Topology. Earlier we saw how in
Physical Star network Topology, computers (nodes) are connected by each other through
central hub. And we also saw in Bus Topology, work station devices are connected by the
common cable called Bus. After understanding these two network configurations, we can
understand tree topology better. In Tree Topology, the number of Star networks are
connected using Bus. This main cable seems like a main stem of a tree, and other star
networks as the branches. It is also called Expanded Star Topology. Ethernet protocol is
commonly used in this type of topology. The diagram below will make it clear.

GSSS Institute of Engineering & Technology for Women Dept of ISE

Computer Programming Lab Manual Page 22

Fig: Tree Topology Diagram

A network interface card (NIC) is a circuit board or card that is installed in a computer so that
it can be connected to a network.
A network interface card provides the computer with a dedicated, full-time connection to a
network. Personal computers and workstations on a local area network (LAN) typically
contain a network interface card specifically designed for the LAN transmission technology

9: RAM (Random Access Memory)
Random Access Memory is a temporary storage medium in a computer. All data to be
processed by the computer are transferred from a storage device or keyboard to RAM during
data processing. Results obtained from executing any program are also stored in RAM. RAM
is a volatile memory. Latest computers use RAM with a memory of more than 128MB. There
are provisions also available to increase the RAM memory in any computer.

RAM consists of many storage cells each of size 1 byte and is identified by using a number
called as address or memory location. The memory address is assigned by the computer
GSSS Institute of Engineering & Technology for Women Dept of ISE

Computer Programming Lab Manual Page 23

which also varies from computer to computer and time to time. The data stored in memory
are identified using the memory address.

The internal processing speed of a computer is very fast compared to the reading and writing
from/to disk. During the time of reading from disk the CPU is idle. To reduce this waiting
time and increase the processing speed, a cache memory is used in the computer Cache
memory is a part of RAM that holds the data, which is needed next by the CPU. The size of
cache memory is 512 KB. Normally cache memory holds the recent information that is
accessed. The data retrieval time for the processor from cache is more than the thousand
times faster from disk., so the processing speed of a computer is improved.

Synchronous dynamic random access memory (SDRAM) is dynamic random access
memory (DRAM) that is synchronized with the system bus. Classic DRAM has an
asynchronous interface, which means that it responds as quickly as possible to changes in
control inputs. SDRAM has a synchronous interface, meaning that it waits for a clock
signal before responding to control inputs and is therefore synchronized with the computer's
system bus. The clock is used to drive an internal finite state machine that pipelines incoming
commands. The data storage area is divided into several banks, allowing the chip to work on
several memory access commands at a time, interleaved among the separate banks. This
allows higher data access rates than an asynchronous DRAM.
Pipelining means that the chip can accept a new command before it has finished processing
the previous one. In a pipelined write, the write command can be immediately followed by
another command, without waiting for the data to be written to the memory array. In a
pipelined read, the requested data appears after a fixed number of clock cycles after the read
command (latency), clock cycles during which additional commands can be sent. (This delay
is called the latency and is an important performance parameter to consider when purchasing
SDRAM for a computer.)
SDRAM is widely used in computers; from the original SDRAM, further generations of DDR
(or DDR1) and then DDR2 and DDR3 have entered the mass market, with DDR4 currently
being designed and anticipated to be available in 2014.

GSSS Institute of Engineering & Technology for Women Dept of ISE

Computer Programming Lab Manual Page 24

11: ROM (Read Only Memory)
Read Only Memory is a permanent storage medium which stores start up programs. These
programs which are loaded when computer is switched on. ROM stores essentially the BIOS
(Basic Input Output System) programs which are recorded by the manufacturer of the
computer system. ROM is nonvolatile memory. ROM is also known as firmware. In ROM
programs are burnt during manufacturing. Normally system programs and language
translators are stored in ROM chips. Both ROM and RAM are semiconductor chips.
Normally size of the ROM holds 8k and more depending on the requirement.

Flash memory is an electronic non-volatile computer storage medium that can be electrically
erased and reprogrammed.
Introduced by Toshiba in 1984, flash memory was developed from EEPROM (electrically
erasable programmable read-only memory). There are two main types of flash memory,
which are named after the NAND and NOR logic gates. The internal characteristics of the
individual flash memory cells exhibit characteristics similar to those of the corresponding
gates. Whereas EPROMs had to be completely erased before being rewritten, NAND type
flash memory may be written and read in blocks (or pages) which are generally much smaller
than the entire device. NOR type flash allows a single machine word(byte) to be writtento
an erased locationor read independently.
The NAND type is primarily used in main memory, memory cards, USB flash drives, solid-
state drives, and similar products, for general storage and transfer of data. The NOR type,
which allows true random access and therefore direct code execution, is used as a
replacement for the older EPROM and as an alternative to certain kinds of ROM applications,
whereas NOR flash memory may emulate ROM primarily at the machine code level; many
digital designs need ROM (or PLA) structures for other uses, often at significantly higher
speeds than (economical) flash memory may achieve.NAND or NOR flash memory is also
often used to store configuration data in numerous digital products, a task previously made
possible by EEPROMs or battery-powered static RAM. One significant disadvantage of flash
memory is the finite amount of read/write cycles in a specific block.
Example applications of both types of flash memory include personal computers, PDAs,
digital audio players, digital cameras, mobile phones, synthesizers, video games, scientific
GSSS Institute of Engineering & Technology for Women Dept of ISE

Computer Programming Lab Manual Page 25

instrumentation, industrial robotics, medical electronics, and so on. In addition to being non-
volatile, flash memory offers fast read access times, as fast as dynamic RAM, although not as
fast as static RAM or ROM. Its mechanical shock resistance helps explain its popularity
over hard disksin portable devices, as does its high durability, being able to withstand high
pressure, temperature, immersion in water, etc. Although flash memory is technically a type
of EEPROM, the term "EEPROM" is generally used to refer specifically to non-flash
EEPROM which is erasable in small blocks, typically bytes. Because erase cycles are slow,
the large block sizes used in flash memory erasing give it a significant speed advantage over
non-flash EEPROM when writing large amounts of data.

A floppy disk is used to store data permanently. It has a flexible disk coated with magnetic
material and is enclosed in a plastic cover. Floppy disks of 3 inch diameter have a storage
capacity of 1.44MB. The FDD (floppy disk drive) has a read/write head which reads/writes
data on to the disk. The disk rotates at 360rpm while reading or writing on to it.
Data are stored in a floppy disk in concentric circles known as tracks. Tracks are divided into
many storage locations called sectors. Tracks and sectors on a disk are identified by the disk
drive through formatting. Formatting is a process by which the operating system program
controls the disk drives by removing the old data and sets up each track and sector. The root
directory will be created in the disk during formatting and the users create other directories.
Information is stored in the form of files. A file allocation table (FAT) is used by the
operating system to identify the files stored in the disk.

Fig: Floppy Disk

Hard disk
Hard disk is a reliable and permanent storage disk. It has a set of metal disks coated with
magnetic material and are mounted on a central spindle which rotates at 7200 rpm. The HDD
GSSS Institute of Engineering & Technology for Women Dept of ISE

Computer Programming Lab Manual Page 26

has a set of read/write heads which are mounted on an arm. Latest hard disks are available
with a storage capacity of more than 40GB.

A hard disk has a collection of several (say 6 or 7) hard disk platters staked one above
another to have a high storage capacity. A collection of tracks across all the disks is called
cylinder. In order to read a specified file, the access mechanism with the head moves to the
specified cylinder. The advantages of a hard disk are high storage capacity, high speed of
operation and reliable media mainly in personal computers. External disturbances to the drive
may lead to the damage of disk surface or read/write head. This is a major disadvantage in a
hard disk.

Fig: Hard Disk

In computing and optical disc recording technologies, an optical disc (OD) is a flat, usually
circular disc which encodes binary data (bits) in the form of pits (binary value of 0 or off, due
to lack of reflection when read) and lands (binary value of 1 or on, due to a reflection when
read) on a special material (often aluminum on one of its flat surfaces. The encoding material
sits atop thicker substrate (usually polycarbonate) which makes up the bulk of the disc and
forms a dust defocusing layer.
The encoding pattern follows a continuous, spiral path covering the entire disc surface and
extending from the innermost track to the outermost track. The data is stored on the disc with
a laser or stamping machine, and can be accessed when the data path is illuminated with a
laser diode in an optical disc drive which spins the disc at speeds of about 200 to 4000 RPM
or more, depending on the drive type, disc format, and the distance of the read head from the
center of the disc (inner tracks are read at a faster disc speed).

GSSS Institute of Engineering & Technology for Women Dept of ISE

Computer Programming Lab Manual Page 27

15: CD ROM
Compact Disk (CD) is an optical disk used to store data permanently. It is the most reliable
storage media available today. Data stored on a compact disk cannot be erased. The CD
drives commonly available are read only. Read/Write CD drives are also available but are
expensive. Storage capacity of CD is 700MB. In the optical disk, a high power laser beam is
used to record data by burning tiny pits in the surface of the hard plastic disk. To read the
data, a low power laser beam is used to scan the disk surface.
When the laser beam reflects from the smooth surface of the disk it is interpreted as a 1 bit
and when the beam enters the tiny pits it is interpreted as a 0 bit. The major advantages of the
optical disk are high storage capacity and high quality recording of graphical images and
sound. These are used commonly nowadays. CAD and structural drawings used by architects
and engineers are generally stored in compact disks. It is also used in high quality music
recording, multimedia and educational applications.

16: CD-R
CD-R (for compact disc, recordable) is a type of write once, read many compact disc (CD)
format that allows one-time recording on a disc. The CD-R (as well as the CD-RW) format
was introduced by Philips and Sony in their 1988 specification document, the Orange Book.
Prior to the release of the Orange Book, CDs had been read-only audio, to be played in CD
players, and multimedia (CD-ROM), to be played in computers' CD-ROM drives. After the
Orange Book, any user with a CD recorder drive could create their own CDs from their
desktop computers.
Like regular CDs (all the various formats are based on the original Red Book CD-DA), CD-
Rs are composed of a polycarbonate plastic substrate, a thin reflective metal coating, and a
protective outer coating. However, in a CD-R, a layer of organic polymer dye between the
polycarbonate and metal layers serves as the recording medium. The composition of the dye
is permanently transformed by exposure to a specific frequency of light. Some CD-Rs have
an additional protective layer to make them less vulnerable to damage from scratches, since
the data - unlike that on a regular CD - is closer to the label side of the disc. A pre grooved
spiral track helps to guide the laser for recording data, which is encoded from the inside to the
outside of the disk in a single continuous spiral. The laser creates marks in the dye layer that
GSSS Institute of Engineering & Technology for Women Dept of ISE

Computer Programming Lab Manual Page 28

mimic the reflective properties of the pits and lands (lower and higher areas) of the traditional
CD. The distinct differences in the way the areas reflect light register as digital data that is
then uencoded for playback.
CD-R discs usually hold 74 minutes (650 MB) of data, although some can hold up to 80
minutes (700 MB). With packet writing software and a compatible CD-R or CD-RW drive, it
is possible to save data to a CD-R in the same way that one can save it to a floppy disk,
although - since each part of the disc can only be written once - it is not possible to delete
files and then reuse the space. The rewriteable CDs, CD-RWs, use an alloy layer (instead of
the dye layer) which can be transformed to and from a crystalline state repeatedly. CD
recorders (usually referred to as CD burners), were once much too expensive for the home
user, but now are similar in price to CD-ROM drives. CD-Rs can be created in any CD-R or
CD-RW drive.
17: CD-RW
A CD-RW (Compact Disc-ReWritable) is a rewritable optical disc. It was introduced in
1997, and was known as "CD-Writable" during development. It was preceded by the CD-
MO, which was never commercially released.
CD-RW discs require more sensitive laser optics. Also, CD-RWs cannot be read in some CD-
ROM drives built prior to 1997. CD-ROM drives will bear a "MultiRead" certification to
show compatibility. CD-RW discs need to be blanked before reuse. Different blanking
methods can be used, including "full" blanking in which the entire surface of the disc is
cleared, and "fast" blanking in which only meta-data areas are cleared: PMA, TOC and pre
gap, comprising a few percent of the disc. Fast blanking is much quicker, and is usually
sufficient to allow rewriting the disc. Full blanking removes traces of the former data, often
for confidentiality. It may be possible to recover data from full-blanked CD-RWs with
specialty data recovery equipment; however, this is generally not used except by government
agencies due to cost. CD-RW also have a shorter rewriting cycles life (ca. 1,000) compared to
virtually all of the previously exposed types storage of media (typically well above 10,000 or
even 100,000), something which however is less of a drawback considering that CD-RWs are
usually written and erased in their totality, and not with repeated small scale changes, so
normally wear leveling is not an issue.
GSSS Institute of Engineering & Technology for Women Dept of ISE

Computer Programming Lab Manual Page 29

Their ideal usage field is in the creation of test disks, temporary short or mid-term backups,
and in general, where an intermediate solution between online and offline storage schemes is

18: Digital Versatile Disc-Read Only Memory (DVD-ROM)
(DVD-ROM is a read-only digital versatile disc (DVD) commonly used for storing large
software applications. It is similar to a compact disk-read only memory (CD-ROM) but has a
larger capacity. A DVD-ROM stores around 4.38 GB of data. A CD-ROM usually stores 650
MB of data. A DVD-ROM permanently stores data files which cannot be changed, written
over or erased. A personal computer (PC) with a DVD-ROM or a DVD-RAM drive is
designed to read a DVD-ROM disc.

Generally a DVD-ROM disc is not equipped to be used with a DVD drive connected to a
home theatre system or television. But many DVD-ROM drives can generally read a DVD
movie disc. A DVD-ROM is one of the various types of DVDs. A blank DVD is generally a
DVD-R or DVD+R, which has a read-write format. The +R or -R references the format
standards and is a rewritable or recordable DVD. Compared to a CD-ROM, a DVD-ROM has
the same 5 inch diameter and 1.2 millimetre (mm) thickness. But because a DVD-ROM uses
a shorter wavelength laser with tighter compacted pits, the disc capacity is increased. In fact,
the smallest DVD-ROM can store approximately 7 times more data than a CD-ROM.
This term is also known as digital video disc ROM.

The DVD-ROM was first introduced in 1996 by the DVD Forum, a group of ten international
companies using and developing DVD and HD DVD formats for media, software and
hardware. The DVD Forum consists of the founding companies plus over 220 other
members. Japan produced the first DVD-ROMs in November 1996. By March 1997 it was
introduced in the United States. The DVD Forum also releases all DVD specifications
published in the DVD books by titles such as DVD-ROM Book or DVD-R Book.
A typical DVD-ROM can hold up to 17 GB/s of data if both sides of the disc are writable.

The DVD-ROM is comprised of two 0.6 millimetres (mm) acrylic layers bonded together.
The double-sided disc consists of two recordable grooved sides. With two layers, a DVDs
laser beam only has to go through 0.06 mm to reach the recording layer. Having a thin layer
GSSS Institute of Engineering & Technology for Women Dept of ISE

Computer Programming Lab Manual Page 30

allows the lens to focus the beam to a smaller spot size, which in turn writes smaller pits for
more data. The data is encoded in the form of spiral pits that are merely nanometres apart.
The spiral path begins at the center of the disc and coils numerous times until it reaches the
outer edge. With a double-layered disc the path continues to the second layer. A double-sided
disc needs to be manually turned over and the path resumes in the center.


A flash drive is a drive using flash memory. Most solid-state drives are flash drives. A USB
flash drive is a data storage device that includes flash memory with an integrated Universal
Serial Bus (USB) interface. USB flash drives are typically removable and rewritable, and
physically much smaller than an optical disc. Most weigh less than 30 grams (1.1 oz). As of
January 2013, drives of up to 512 gigabytes (GB) were available. A one-terabyte (TB) drive
was unveiled at the 2013 Consumer Electronics Show and became available later that year.
Storage capacities as large as 2 TB are planned, with steady improvements in size and price
per capacity expected.
Some allow up to 100,000 write/erase cycles, depending on the exact
type of memory chip used, and have a 10-year shelf storage time.
USB flash drives are often used for the same purposes for which floppy disks or CDs were
used, i.e., for storage, back-up and transfer of computer files. They are smaller, faster, have
thousands of times more capacity, and are more durable and reliable because they have
no moving parts. Additionally, they are immune to magnetic interference (unlike floppy
disks), and unharmed by surface scratches (unlike CDs). Until about 2005, most desktop and
laptop computers were supplied with floppy disk drives in addition to USB ports, but floppy
disk drives have been abandoned due to their lower capacity compared to USB flash drives.
USB flash drives use the USB mass storage standard, supported natively by modern operating
systems such as Linux, OS X, Windows, and other Unix-like systems, as well as
many BIOS boot ROMs. USB drives with USB 2.0 support can store more data and transfer
faster than much larger optical disc drives like CD-RW or DVD-RW drives and can be read
by many other systems such as the Xbox 360, PlayStation 3, DVD players and in a number of
handheld devices such as smart phones and tablet computers, though the electronically
similar SD card is better suited for those devices.
A flash drive consists of a small printed circuit board carrying the circuit elements and a USB
connector, insulated electrically and protected inside a plastic, metal, or rubberized case
GSSS Institute of Engineering & Technology for Women Dept of ISE

Computer Programming Lab Manual Page 31

which can be carried in a pocket or on a key chain, for example. The USB connector may be
protected by a removable cap or by retracting into the body of the drive, although it is not
likely to be damaged if unprotected. Most flash drives use a standard type-A USB
connection allowing connection with a port on a personal computer, but drives for other
interfaces also exist. USB flash drives draw power from the computer via the USB
connection. Some devices combine the functionality of a digital audio player with USB flash
storage; they require a battery only when used to play music.

A keyboard is a typewriter-style device, which uses an arrangement of buttons or keys, to act
as mechanical levers or electronic switches. Following the decline of punch cards and paper
tape, interaction via teleprinter-style keyboards became the main input device for computers.
A keyboard typically has characters engraved or printed on the keys and each press of a key
typically corresponds to a single written symbol. However, to produce some symbols requires
pressing and holding several keys simultaneously or in sequence. While most keyboard keys
produce letters, numbers or signs (characters), other keys or simultaneous key presses can
produce actions or execute computer commands.
Despite the development of alternative input devices, such as the mouse, touch screen, pen
devices, recognition and voice recognition, the keyboard remains the most commonly used
device for direct (human) input of alphanumeric data into computers.
In normal usage, the keyboard is used to type text and numbers into a word processor, text
editor or other programs. In a modern computer, the interpretation of key presses is generally
left to the software. A computer keyboard distinguishes each physical key from every other
and reports all key presses to the controlling software. Keyboards are also used for computer
gaming, either with regular keyboards or by using keyboards with special gaming features,
which can expedite frequently used keystroke combinations.
A keyboard is also used to give commands to the operating system of a computer, such
as Windows' Control-Alt-Delete combination, which brings up a task window or shuts down
the machine. A command-line interface is a type of user interface operated entirely through a
keyboard, or another device doing the job of one.
GSSS Institute of Engineering & Technology for Women Dept of ISE

Computer Programming Lab Manual Page 32

Fig: Keyboard
Keyboards are available in two models:
1 The standard model: 83-84 keys
2 The enhanced model: 104 or more keys.

Functions of Different keys in a standard keyboard:
Typewriter keys: Include letters, numbers and punctuation symbols used for typing.
Function Keys: Performing according to software used (F1 to F12).
Cursor Control Keys: Enables the user to move cursor to left, right, top & bottom.
Numeric Keys: Enables user to type numeric characters. These numeric keys also have
double functions. To switch over between functions NUM LOCK key is pressed.
Page Up & Page down Keys: Used for moving to preceding and next pages of the
Home & End Keys: Move the cursor to the beginning & end of the line or window.
Caps Lock Key: To type any letter in uppercase.
Shift Key: Pressing any key with two symbols or characters while holding down the shift
key causes the upper symbol to appear.
Ctrl and Alt Keys: Carry out special actions when used in combination with other keys.
By pressing the Ctrl, Alt and Delete keys simultaneously the computer automatically restarts.
Enter Key: Provides the computer the signal that you have finished giving an instruction.
It also begins a new paragraph or line in word document.
Tab Key: Moves the cursor along a line to a preset point.
Esc Key: Enables you to cancel or ignore the entry or command just entered and also used
to exit a program.
Delete & Backspace keys: Used to erase a space/character.

GSSS Institute of Engineering & Technology for Women Dept of ISE

Computer Programming Lab Manual Page 33

Exploring Different Types of Keyboard
Different types of Keyboard are:
101-key enhanced keyboard
104-key windows keyboard.
Ergonomic keyboard
Multimedia keyboard
Cordless keyboard
Types of Keyboard
Standard "full-travel" alphanumeric keyboards have keys that are on three-quarter inch
centers (0.750 inches, 19.05 mm), and have a key travel of at least 0.150 inches (3.81 mm).
Desktop computer keyboards, such as the 101-key US traditional keyboards or the 104-key
Windows keyboards, include alphabetic characters, punctuation symbols, numbers and a
variety of function keys. The internationally common 102/105 key keyboards have a smaller
left shift key and an additional key with some more symbols between that and the letter to its
right (usually Z or Y). Also the enter key is usually shaped differently. Computer keyboards
are similar to electric-typewriter keyboards but contain additional keys, such as the command
or Windows keys.
Keyboards on laptops and notebook computers usually have a shorter travel distance for the
keystroke, shorter over travel distance, and a reduced set of keys. They may not have a
numerical keypad, and the function keys may be placed in locations that differ from their
placement on a standard, full-sized keyboard. The switch mechanism for a laptop keyboard is
more likely to be a scissor switch than a rubber dome; this is opposite the trend for full-size

GSSS Institute of Engineering & Technology for Women Dept of ISE

Computer Programming Lab Manual Page 34

Handheld ergonomic keyboards are designed to be held like a game controller, and can be
used as such, instead of laid out flat on top of a table surface. Typically handheld keyboards
hold all the alphanumeric keys and symbols that a standard keyboard would have, yet only be
accessed by pressing two sets of keys at once; one acting as a function key similar to a 'Shift'
key that would allow for capital letters on a standard keyboard. Handheld keyboards allow
the user the ability to move around a room or to lean back on a chair while also being able to
type in front or away from the computer. Some variations of handheld ergonomic keyboards
also include a trackball mouse that allows mouse movement and typing included in one
handheld device.

Smaller external keyboards have been introduced for devices without a built-in keyboard,
such as PDAs, and smart phones. Small keyboards are also useful where there is a limited
A chorded keyboard allows users to press several keys simultaneously. For example, the
GKOS keyboard has been designed for small wireless devices. Other two-handed alternatives
more akin to a game controller, such as the Alpha Grip, are also used to input data and text.
A thumb keyboard (thumb board) is used in some personal digital assistants such as the Palm
Treo and BlackBerry and some Ultra such as the OQO.
Numeric keyboards contain only numbers, mathematical symbols for addition, subtraction,
multiplication, and division, a decimal point, and several function keys. They are often used
to facilitate data entry with smaller keyboards that do not have a numeric keypad, commonly
those of laptop computers. These keys are collectively known as a numeric pad, numeric
keys, or a numeric keypad, and it can consist of the following types of keys: Arithmetic
operators, numbers, Arrow keys, Navigation keys, Num Lock and Enter key.
A computer mouse is an input device that is most often used with a personal computer.
Moving a mouse along a flat surface can move the on-screen cursor to different items on
the screen. Items can be moved or selected by pressing the mouse buttons (called clicking).

GSSS Institute of Engineering & Technology for Women Dept of ISE

Computer Programming Lab Manual Page 35

It is called a computer mouse because of the wire that connects the mouse to the computer.
The people who designed the first computer mice thought that it looked like the tail on
a mouse. Today, many computer mice use wireless technology and have no wire.
On most computers, the user can move the mouse to move the cursor in the same
To choose something that is on the screen, the user can move the cursor to it and
"click" the left mouse button. The right mouse button is used to open menus that are different
depending on where the cursor is. The other mouse buttons can do different things, depending
on the software. Most mice have two buttons to click.
Most mice also have a "scroll wheel"a small wheel found between the two main mouse
buttons. The user can move the wheel back and forth to "scroll" through screen. "Scrolling"
means moving the words or pictures up or down on the screen, so another part of the page
comes into view. The wheel can also be pressed, to click it like another button.

Fig: Mouse

A printer is an output device used to print text or graphics on paper or on any other hardcopy
medium which includes even microfilm. A permanent copy from the computer is produced
using the printer. Printers are of two basic types impact and non-impact.

Impact and Non-impact printers:
Printers are categorized based on the physical contact of the print head with the paper to
produce a text or an image. An impact printer is one where the print head will be in physical
contact with the paper. In a nonimpact printer, on the other hand the print head will have no
physical contact with the paper. The Dot matrix printer is considered as a Impact printer and
Laser printer is considered as Non-
GSSS Institute of Engineering & Technology for Women Dept of ISE

Computer Programming Lab Manual Page 36

impact printer.

The basic operations performed by a printer are:
1) Moving the paper to a given line.
2) Moving the print head along the line.
3) Generating the character or image.
4) Producing the character or image on the paper.

Dot Matrix Printer:
The most popular kind of printer for small computers is the dot matrix printer, which forms
characters as arrays of dots. Dot matrix printers are compact, reliable and relatively fast. This
type of printer is an impact printer. The print head is the important hardware which produces
the character using pins arranged in a matrix form. Normally a print head has 9 pins or 24
pins arranged in a matrix form.
Combinations of pins strike an ink bed ribbon during the printing process. The print head
moves in a line and the pattern of dots required for each character is printed on the paper.
After printing a line, the paper rolls to print the next line.

Dot matrix printers produce average quality prints and as generally used in business
applications. They are used printing train number, seat number etc on a railway reservation
ticket. The speed of printing in dot matrix printer in dot matrix is measured in characters per
second (cps).

GSSS Institute of Engineering & Technology for Women Dept of ISE

Computer Programming Lab Manual Page 37

The advantages in this type of printer are carbon copies can be obtained as printing takes
place by physical impact with the paper. It is less of cost and easy to maintain. The
disadvantage is average printing quality and printer ribbon printer ribbon needs to be changed

Laser Printer:
Laser printers are fastest type of non impact electrostatic printers. They produce high quality
prints at high speeds. It operates like a copier machine. In these printers, the controlled beam
of intense laser forms images on an electrically charged rotating drum. The drum is rotated
near the fine black powder called the toner. These charged images which sticks to the paper
due to pressure and heat. The toner consists of oppositely charged ink particles which stick to
the drum in the places where the laser has charged.

The light beam strikes a multi-sided rotating mirror. As the mirror rotates, the side currently
in the path of the light beam sweeps the beam across the surface of the drum. As the beam
sweeps across the drum, the light is modulated and a single line is drawn after a line has been
drawn, the next side of the mirror is in place and a new line is drawn below the previous line.

The quality of the printout is measured by the number of dots per inch (dpi). Since the dots
are printed closely, the text or graphics appears very smooth and elegant. The speed is
measured in number of pages printed per minute (PPM) which varies between 5 and 25.
GSSS Institute of Engineering & Technology for Women Dept of ISE

Computer Programming Lab Manual Page 38

The advantages are good quality printouts can be obtained for documentation and business
applications. The printing is faster and easy to handle and maintain. The disadvantages are
the price is high and higher print cost.

Inkjet printer
An inkjet is a non impact printer. It sprays tiny drops of ink to form character and graphic
images on paper. The text and graphics printed in an inkjet printer are technically similar to
that of a dot matrix printer. These type of printers can also be used color printing. The black
inkjet printer uses black cartridge
filled with black ink whereas the color printer uses four color cartridges namely cyan (blue),
magenta (red), yellow and black. These four colors are used in combination to generate any
color in the visible spectrum.

The print heads move across the page by the control of software and spray the dots of ink
with the required combination of colors. The printer sends electrical pulses to thin resistors at
the base of firing chambers behind the nozzle. A thin layer of ink is heated by the resistor
which in turn forms a vapor bubble and the expansion forces ink through the nozzle and onto
the paper at a rate of about 6000 dots per second. The quality of the printout is equivalent to
that of laser printouts. The speed of printing is slower than that of laser printers.

The advantages of this type printer are the cost is low; quality of printing is equivalent to that
of laser printing, color printouts are cheaper easy to handle and maintain. The disadvantages
are the ink cartridges may get spoiled if unused for a long time. Some inkjet printers are very

A plotter is an output device used to print engineering drawing or graphics on large size
sheets. These are also used to draw the patterns from which microprocessors, memory chips,
and other integrated circuits are manufactured. Plotters are used when highest quality and
greatest accuracy are required.
GSSS Institute of Engineering & Technology for Women Dept of ISE

Computer Programming Lab Manual Page 39

There are two basic types of plotters: flat bed plotters and drum type plotters. Pen plotter is an
example of a flatbed plotter. Laser plotter and inkjet plotter are commonly used drum type

A pen plotter has a surface where the paper or drawing sheet is properly fixed. It has a pen
holder in a movable arm. Under the control of the computer the arm with the pen moves
across the paper to draw the picture. A few pens are also placed in a row and the arm will
pick the required color pen as per the instruction of the computer.
A drum type plotter uses a drum where the paper will be rolled. It has a print head/pen that
moves like the print head in a printer. Drum type plotters are capable of producing longer,
continuous drawings.

Drum type plotters that can produce color plots are available.The disadvantages are these are
expensive than printers. The cost of printing is high. Cost of maintenance is high. High skill
of operation is required. Process time of printing is longer.


The term algorithm originally referred to any computation performed via a set of rules
applied to numbers written in decimal form. The word is derived from the phonetic
pronunciation of the last name of Abu Ja'far Mohammed ibn Musa al-Khowarizmi, who was
an Arabic mathematician who invented a set of rules for performing the four basic arithmetic
operations (addition, subtraction, multiplication and division) on decimal numbers.

GSSS Institute of Engineering & Technology for Women Dept of ISE

Computer Programming Lab Manual Page 40

An algorithm is a representation of a solution to a problem. If a problem can be defined as a
difference between a desired situation and the current situation in which one is, then a
problem solution is a procedure, or method, for transforming the current situation to the
desired one. We solve many such trivial problems every day without even thinking about it,
for example making breakfast, travelling to the workplace etc. But the solution to such
problems requires little intellectual effort and is relatively unimportant. However, the solution
of a more interesting problem of more importance usually involves stating the problem in an
understandable form and communicating the solution to others. In the case where a computer
is part of the means of solving the problem, a procedure, explicitly stating the steps leading to
the solution, must be transmitted to the computer. This concept of problem solution and
communication makes the study of algorithms important to computer science.

Throughout history, man has thought of ever more elegant ways of reducing the amount of
labor needed to do things. A computer has immense potential for saving time/energy, as most
(computational) tasks that are repetitive or can be generalized can be done by a computer. For
a computer to perform a desired task, a method for carrying out some sequence of events,
resulting in accomplishing the task, must somehow be described to the computer. The
algorithm can be described on many levels because the algorithm is just the procedure of
steps to take and get the result. The language used to describe an algorithm to other people
will be quite different from that which is used by the computer; however the actual algorithm
will in essence be the same. An example of an algorithm people use would be a recipe to
make a cake.

4 extra large eggs, beaten
1&1/2 C. stock
1/2 teaspoon salt
1 scallion, minced
1 C. small shrimp or lobster flakes
1 t. soy sauce
1 Tablespoon oil

1. Mix all the ingredients, except the oil, in a deep bowl.
2. Put 1" water in wide pot, then place deep bowl of batter inside.
3. Cover pot tightly and steam 15 min.
GSSS Institute of Engineering & Technology for Women Dept of ISE

Computer Programming Lab Manual Page 41

4. Heat oil very hot and pour over custard.
5. Steam 5 more min. Serves 4 people"

An algorithm is procedure consisting of a finite set of unambiguous rules (instructions)
which specify a finite sequence of operations that provides the solution to a problem, or to
a specific class of problems for any allowable set of input quantities (if there are inputs). In
other word, an algorithm is a step-by-step procedure to solve a given problem

Alternatively, we can define an algorithm as a set or list of instructions for carrying out some
process step by step. A recipe in a cookbook is an excellent example of an algorithm. The
recipe includes the requirements for the cooking or ingredients and the method of cooking
them until you end up with a nice cooked dish. In the same way, algorithms executed by a
computer can combine millions of elementary steps, such as additions and subtractions, into a
complicated mathematical calculation.


Flowcharting is a tool developed in the computer industry, for showing the steps involved in
a process. A flowchart is a diagram made up of boxes, diamonds and other shapes, connected
by arrows - each shape represents a step in the process, and the arrows show the order in
which they occur. Flowcharting combines symbols and flow lines, to show figuratively the
operation of an algorithm.

Flowcharting Symbols
There are 6 basic symbols commonly used in flowcharting of assembly language
programs: Terminal, Process, input/output, Decision, Connector and Predefined Process.

GSSS Institute of Engineering & Technology for Women Dept of ISE

Computer Programming Lab Manual Page 42

Ex: The problem with this algorithm is that, some of the steps appear more than
once, i.e. step 5 get second number, step 7, get third number, etc. One could shorten the
algorithm or flowchart as follows

GSSS Institute of Engineering & Technology for Women Dept of ISE

Computer Programming Lab Manual Page 43


Pseudocode is one of the tools that can be used to write a preliminary plan that can be
developed into a computer program. Pseudocode is a generic way of describing an algorithm
without use of any specific programming language syntax. It is, as the name suggests, pseudo
code it cannot be executed on a real computer, but it models and resembles real
programming code, and is written at roughly the same level of detail..Pseudocode, by nature,
exists in various forms, although most borrow syntax from popular programming languages
(like C, Lisp, or FORTRAN). Natural language is used whenever details are unimportant or

Computer science textbooks often use pseudocode in their examples so that all programmers
can understand them, even if they do not all know the same programming languages. Since
pseudocode style varies from author to author, there is usually an accompanying introduction
explaining the syntax used.

For example, suppose you are required to design an algorithm for finding the average of
six numbers, and the sum of the numbers is given. The pseudocode will be as follows
GSSS Institute of Engineering & Technology for Women Dept of ISE

Computer Programming Lab Manual Page 44

Get the sum
Average = sum / 6
Output the average

The corresponding flowchart will appear as follows: