0% found this document useful (0 votes)
4 views125 pages

XI Notes

The document provides an overview of computer science, detailing its definition, significance, and relationship with other fields such as scientific computing and computer engineering. It discusses the evolution of computers, their functions, characteristics, and various applications across different sectors, including education, entertainment, and medicine. Additionally, it touches on the history of computer science, highlighting the transition from mechanical to modern electronic computers.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views125 pages

XI Notes

The document provides an overview of computer science, detailing its definition, significance, and relationship with other fields such as scientific computing and computer engineering. It discusses the evolution of computers, their functions, characteristics, and various applications across different sectors, including education, entertainment, and medicine. Additionally, it touches on the history of computer science, highlighting the transition from mechanical to modern electronic computers.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Lecturer By: Biran Limbu, CODES Computer Consultant, Dharan, Nepal. Email:codes@consultant.

com

Computer Science

(Class XI)
What is Computer Science?
Computer Science is the systematic study of the feasibility, structure, expression, and mechanization of the
methodical processes (or algorithms) that underlie the acquisition, representation, processing, storage,
communication of, and access to information, whether such information is encoded in bits and bytes in a
computer memory or transcribed in genes and protein structures in a human cell. The fundamental question
underlying all of computing is: what computational processes can be efficiently automated and implemented?
To tackle this seemingly simple question, computer scientists work in many complementary areas. They study
the very nature of computing to determine which problems are (or are not) computable. They compare various
algorithms to determine if they provide a correct and efficient solution to a concrete problem. They design
programming languages to enable the specification and expression of such algorithms. They design, evaluate,
and build computer systems that can efficiently execute such specifications. And, they apply such algorithms to
important application domains.

Why Computer Science?


In 1943, Thomas J. Watson, Chairman of IBM declared: “I think there is a world market for maybe five computers.” A
few billion computers later, there is a temptation to fall into Watson’s embarrassing underestimation of the
potential that computing may have on our society. Indeed, in a few decades, “one computer per capita” may sound
as outrageous as a “world market of five computers” sounds today. Computer scientists envision a world in which
computing is pervasive and seamless. The golden age of computing (and of computer scientists) has barely
begun.
Students choose to major in computer science for a variety of reasons. Many students graduate to rewarding
computer-related careers in software engineering, system administration and management, research and
development in industrial and governmental laboratories. And, since computer technology has transformed
almost all disciplines, many of our graduates use their computer science major (and the analytical skills it
instills) to prepare them for a career in other disciplines such as medicine, law, education, physical and life
sciences, social sciences, and humanities. Demand for graduates well-versed in computer science is high and is
expected to continue to grow as the information age comes of age!

How Does Computer Science Relate To Scientific Computing?


Computers and software artifacts have become indispensable tools for the pursuit of pretty much every scientific
discipline. The use of computers has enabled biologists to comprehend genetics, has enabled astrophysicists to
get within femto seconds of the big bang's initial conditions, and has enabled geologists to predict earthquakes.
It is not surprising, then, for scientists in these disciplines to increasingly rely on a computational methodology
(in addition to traditional mathematical or empirical methodologies) to make advances in their respective fields
of study. Such scientists are often referred to as computational scientists. So, a computational chemist is a
scientist who uses computers to make contribution to chemistry, just as a mathematical physicist uses
mathematics to model atomic dynamics, or an empirical biologist uses a microscope to observe cellular
behaviors. And, just like all of these scientific disciplines, advances in computer science itself often rely on the

1
Lecturer By: Biran Limbu, CODES Computer Consultant, Dharan, Nepal. Email:codes@[Link]

use of computers and computational processes. In that sense, among all scientific disciplines, Computer Science
is unique. It is the only discipline which fuels its own advancement. Indeed it is a recursive discipline!
How Does Computer Science Relate To Computer Engineering?
The realization of a computing system, subject to various physical and technological constraints, is a challenging
undertaking that requires a great deal of knowledge about the functionality and characteristics of the building
blocks available at our disposal using today's technologies (e.g., semiconductor technologies, optical
communication technologies, wireless signaling technologies, etc.) Computer engineering concerns itself with
current practices in assembling hardware and software components to erect computing engines with the best
cost-performance characteristics. In contrast, computer scientists worry about the feasibility and efficiency of
solutions to problems in a manner that is less dependent on current technologies. As such, computer scientists
work on abstractions that hide details of underlying implementations to enable the construction and
comprehension of yet more complex systems. The creative process of developing, implementing, and evaluating
computing abstractions is what pushes the frontiers of what computers and computations can do. For example,
the pervasive use of the Web in our society is a direct result of our ability to free Internet application developers
from the lower-level implementation details of moving bits and bytes over wires from one point to another.
Similarly, the tremendous advances in the use of computer animation are a direct result of our ability to free
programmers from having to worry about lower-level digital signal processing techniques.
What Does It Take To Be A Successful Computer Scientist?
Computer Science is about problem solving. Thus, the qualities of a good computer scientist include a passion
for finding elegant solutions, an ability to use mathematical analysis and logical rigor to evaluate such solutions,
creativity in modeling complex problems through the use of abstractions, attention to details and hidden
assumptions, an ability to recognize variants of the same problem in different settings, and being able to retarget
known efficient solutions to problems in new settings. If you like to solve puzzles, then computer science is for
you!

Introduction and Evolution of Computer

A computer is a programmable machine designed to sequentially and automatically carry out a sequence of
arithmetic or logical operations. The particular sequence of operations can be changed readily, allowing the
computer to solve more than one kind of problem. An important class of computer operations on some
computing platforms is the accepting of input from human operators and the output of results formatted for
human consumption. The interface between the computer and the human operator is known as the user
interface.
Conventionally a computer consists of some form of memory, at least one element that carries out arithmetic and
logic operations, and a sequencing and control unit that can change the order of operations based on the
information that is stored. Peripheral devices allow information to be entered from an external source, and allow
the results of operations to be sent out.
A computer's processing unit executes series of instructions that make it read, manipulate and then store data.
Conditional instructions change the sequence of instructions as a function of the current state of the machine or
its environment.

2
Lecturer By: Biran Limbu, CODES Computer Consultant, Dharan, Nepal. Email:codes@[Link]

The first electronic digital computers were developed in the mid-20th century (1940–1945). Originally, they were
the size of a large room, consuming as much power as several hundred modern personal computers (PCs). In
this era mechanical analog computers were used for military applications.
Modern computers based on integrated circuits are millions to billions of times more capable than the early
machines, and occupy a fraction of the space. Simple computers are small enough to fit into mobile devices, and
mobile computers can be powered by small batteries. Personal computers in their various forms are icons of the
Information Age and are what most people think of as "computers". However, the embedded computers found
in many devices from mp3 players to fighter aircraft and from toys to industrial robots are the most numerous.

General Functions of Computer


Computer is an advanced electronic device that takes raw data as input from the user and processes these data under the
control of set of instructions (called program) and gives the result (output) and saves output for the future use. It can process
both numerical and non-numerical (arithmetic and logical) calculations.

A computer has four functions:


a. accepts data Input
b. processes data Processing
c. produces output Output
d. stores results Storage

Input (Data):
Input is the raw information entered into a computer from the input devices. It is the collection of letters, numbers, images
etc.
Process:
Process is the operation of data as per given instruction. It is totally internal process of the computer system.
Output:
Output is the processed data given by computer after data processing. Output is also called as Result. We can save these
results in the storage devices for the future use.
Storage:
Computer data storage, often called storage or memory, refers to computer components andrecording media that retain
digital data. Data storage is a core function and fundamental component of computers.

3
Lecturer By: Biran Limbu, CODES Computer Consultant, Dharan, Nepal. Email:codes@[Link]

Computer System
All of the components of a computer system can be summarized with the simple equations.
COMPUTER SYSTEM = HARDWARE + SOFTWARE+ USER
• Hardware = Internal Devices + Peripheral Devices
The hardware are the parts of the computer itself including the Central Processing Unit (CPU) and
related microchips and micro-circuitry, keyboards,monitors, case and drives (hard, CD, DVD, floppy, optical, tape, etc...).
Other extra parts called peripheral components or devices include mouse, printers,modems, scanners, digital
cameras and cards (sound, colour, video) etc... Together they are often referred to as a personal computer.
All physical parts of the computer (or everything that we can touch) are known as Hardware.
• Software = Programs
The software is the information that the computer uses to get the job done. Software needs to be accessed before it can be
used. There are many terms used for the process of accessing software including running, executing, starting up,opening,
and others.
Computer programs allow users to complete tasks. A program can also be referred to as an application and the two words
are used interchangeably.
Software gives "intelligence" to the computer.

• USER = Person, who operates computer.


A user is an agent, either a human agent (end-user) or software agent, who uses a computer or network service. Users are
also widely characterized as the class of people that use a system without complete technical expertise required to
understand the system fully. Such users are also divided into users and power users. Both are terms of degradation but the
latter connotes a "know-it-all" attitude.
In projects in which the actor of the system is another system or a software agent, it is quite possible that there is no end-
user for the system. In this case, the end-users for the system would be indirect end-users.

CHARACTERISTICS OF COMPUTER
Speed, accuracy, diligence, storage capability and versatility are some of the key characteristics of a com-
puter. A brief overview of these characteristics are—
Speed The computer can process data very fast, at the rate of millions of instructions per second.
Some calculations that would have taken hours and days to complete otherwise, can be completed
in a few seconds using the computer. For example, calculation and generation of salary slips of
thousands of employees of an organization, weather forecasting that requires analysis of a large
amount of data related to temperature, pressure and humidity of various places, etc.
Accuracy Computer provides a high degree of accuracy. For example, the computer can accu-
rately give the result of division of any two numbers up to 10 decimal places.
Diligence When used for a longer period of time, the computer does not get tired or fatigued.
It can perform long and complex calculations with the same speed and accuracy from the start till
the end.
Storage Capability Large volumes of data and information can be stored in the computer and
also retrieved whenever required. A limited amount of data can be stored, temporarily, in the
primary memory. Secondary storage devices like fl oppy disk and compact disk can store a large
amount of data permanently.
Versatility Computer is versatile in nature. It can perform different types of tasks with the same
ease. At one moment you can use the computer to prepare a letter document and in the next
moment you may play music or print a document.
Computers have several limitations too. Computer can only perform tasks that it has been programmed
to do. Computer cannot do any work without instructions from the user. It executes instructions as speci-
fi ed by the user and does not take its own decisions.

4
Lecturer By: Biran Limbu, CODES Computer Consultant, Dharan, Nepal. Email:codes@[Link]

Application of Computers
Computers have proliferated into various areas of our lives. For a user, computer is a tool that provides the desired
information, whenever needed. You may use computer to get information about the reservation of tickets (railways,
airplanes and cinema halls), books in a library, medical history of a person, a place in a map, or the dictionary meaning of a
word. The information may be presented to you in the form of text, images, video clips, etc. Some of the application areas
of the computer are listed below:
Education Computers are extensively used, as a tool and as an aid, for imparting education.
Educators use computers to prepare notes and presentations of their lectures. Computers are used to develop computer-based
training packages, to provide distance education using the e-learning software, and to conduct online examinations.
Researchers use computers to get easy access to conference and journal details and to get global access to the research
material.
Entertainment Computers have had a major impact on the entertainment industry. The user can download and view
movies, play games, chat, book tickets for cinema halls, use multimedia for making movies, incorporate visual and sound
effects using computers, etc. The users can also listen to music, download and share music, create music using computers,
etc.
Sports A computer can be used to watch a game, view the scores, improve the game, play games (like chess, etc.) and
create games. They are also used for the purposes of training players.
Advertising Computer is a powerful advertising media. Advertisement can be displayed on different websites, electronic-
mails can be sent and reviews of a product by different customers can be
posted. Computers are also used to create an advertisement using the visual and the sound effects.
For the advertisers, computer is a medium via which the advertisements can be viewed globally.
Web advertising has become a signifi cant factor in the marketing plans of almost all companies. In
fact, the business model of Google is mainly dependent on web advertising for generating revenues.
Medicine Medical researchers and practitioners use computers to access information about
the advances in medical research or to take opinion of doctors globally. The medical history of
patients is stored in the computers. Computers are also an integral part of various kinds of sophis-
ticated medical equipments like ultrasound machine, CAT scan machine, MRI scan machine, etc.
Computers also provide assistance to the medical surgeons during critical surgery operations like
laparoscopic operations, etc.
Science and Engineering Scientists and engineers use computers for performing complex sci-
entifi c calculations, for designing and making drawings (CAD/CAM applications) and also for
simulating and testing the designs. Computers are used for storing the complex data, performing
complex calculations and for visualizing 3-dimensional objects. Complex scientifi c applications
like the launch of the rockets, space exploration, etc., are not possible without the computers.
Government The government uses computers to manage its own operations and also for e-
governance. The websites of the different government departments provide information to the
users. Computers are used for the fi ling of income tax return, paying taxes, online submission of
water and electricity bills, for the access of land record details, etc.
Home Computers have now become an integral part of home equipment. At home, people use
computers to play games, to maintain the home accounts, for communicating with friends and relatives via Internet, for
paying bills, for education and learning, etc. Microprocessors are embedded in house hold utilities like, washing machines,
TVs, food processors, home theatres, security devices, etc. The list of applications of computers is so long that it is not
possible to discuss all of them here. In addition to the applications of the computers discussed above, computers have also
proliferated into areas like banks, investments, stock trading, accounting, ticket reservation, military operations,
meteorological predictions, social networking, business organizations, police department, video conferencing, tele-presence,
book publishing, web newspapers, and information sharing.

5
Lecturer By: Biran Limbu, CODES Computer Consultant, Dharan, Nepal. Email:codes@[Link]

History of computer science


The history of computer science began long before the modern discipline of computer science that emerged in the twentieth
century, and hinted at in the centuries prior. The progression, from mechanical inventions and mathematical theories
towards the modern concepts and machines, formed a major academic field and the basis of a massive worldwide industry.
Mechanical computers:
A mechanical computer is built from mechanical components such as levers and gears, rather than electronic components.
The most common examples are adding machines and mechanical counters, which use the turning of gears to increment
output displays. More complex examples can carry out multiplication and division, and even differential analysis.

Abacus
The abacus, also called a counting frame, is a calculating tool used primarily in parts of Asia for performing arithmetic
processes. Today, abaci are often constructed as a bamboo frame with beads sliding on wires, but originally they were beans
or stones moved in grooves in sand or on tablets of wood, stone, or metal. The abacus was in use centuries before the
adoption of the written modern numeral system and is still widely used by merchants, traders and clerks in Asia, Africa, and
elsewhere. The user of an abacus is called an abacist.

Napier’s Bones
Napier's bones is an abacus created by John Napier for calculation of products and quotients of numbers that was based on
Arab mathematics and lattice multiplication. The abacus consists of a board with a rim; the user places Napier's rods in the
rim to conduct multiplication or division. The board's left edge is divided into 9 squares, holding the numbers 1 to 9. The
Napier's rods consist of strips of wood, metal or heavy cardboard. Napier's bones are three dimensional, square in cross
section, with four different rods engraved on each one. A set of such bones might be enclosed in a convenient carrying case.
A rod's surface comprises 9 squares, and each square, except for the top one, comprises two halves divided by a diagonal
line. The first square of each rod holds a single digit, and the other squares hold this number's double, triple, quadruple,
quintuple, and so on until the last square contains nine times the number in the top square. The digits of each product are
written one to each side of the diagonal; numbers less than 10 occupy the lower triangle, with a zero in the top half. A set
consists of 10 rods corresponding to digits 0 to 9. The rod 0, although it may look unnecessary, is obviously still needed for
multipliers or multiplicands having 0 in them.

Slide rule
The slide rule is a mechanical computer. The slide rule is used primarily for multiplication and division, and also for
functions such as roots, logarithms and trigonometry, but is not normally used for addition or subtraction.
Slide rules come in a diverse range of styles and generally appear in a linear or circular form with a standardized set of
markings (scales) essential to performing mathematical computations. Slide rules manufactured for specialized fields such
as aviation or finance typically feature additional scales that aid in calculations common to that field.
William Oughtred and others developed the slide rule in the 17th century based on the emerging work on logarithms by
John Napier. Before the advent of the pocket calculator, it was the most commonly used calculation tool in science and
engineering. The use of slide rules continued to grow through the 1950s and 1960s even as digital computing devices were
being gradually introduced; but around 1974 the electronic scientific calculator made it largely obsolete and most suppliers
left the business.

Pascal's calculator
Blaise Pascal invented the mechanical calculator in 1642. He conceived the idea while trying to help his father who had
been assigned the task of reorganizing the tax revenues of the French province of Haute-Normandie ; first called Arithmetic
Machine, Pascal's Calculator and later Pascaline, it could add and subtract directly and multiply and divide by repetition.
Pascal went through 50 prototypes before presenting his first machine to the public in 1645. He dedicated it to Pierre
Séguier, the chancellor of France at the time. He built around twenty more machines during the next decade, often
improving on his original design. Nine machines have survived the centuries, most of them being on display in European

6
Lecturer By: Biran Limbu, CODES Computer Consultant, Dharan, Nepal. Email:codes@[Link]

museums. In 1649 a royal privilege, signed by Louis XIV of France, gave him the exclusivity of the design and
manufacturing of calculating machines in France.

Stepped Reckoner
The Step Reckoner (or Stepped Reckoner) was a digital mechanical calculator invented by German mathematician Gottfried
Wilhelm Leibniz around 1672 and completed in 1694. The name comes from the translation of the German term for its
operating mechanism; staffelwalze meaning 'stepped drum'. It was the first calculator that could perform all four arithmetic
operations: addition, subtraction, multiplication and division.
Its intricate precision gearwork, however, was somewhat beyond the fabrication technology of the time; mechanical
problems, in addition to a design flaw in the carry mechanism, prevented the machines from working reliably.

Jacquard loom
The Jacquard loom is a mechanical loom, invented by Joseph Marie Jacquard in 1801, that simplifies the process of
manufacturing textiles with complex patterns such as brocade, damask and matelasse. The loom is controlled by punched
cards with punched holes, each row of which corresponds to one row of the design. Multiple rows of holes are punched on
each card and the many cards that compose the design of the textile are strung together in order. It is based on earlier
inventions by the Frenchmen Basile Bouchon (1725), Jean Baptiste Falcon (1728) and Jacques Vaucanson (1740).

Charles Babbage's Difference engine


A difference engine is an automatic, mechanical calculator designed to tabulate polynomial functions. The name derives
from the method of divided differences, a way to interpolate or tabulate functions by using a small set of polynomial
coefficients. Both logarithmic and trigonometric functions, functions commonly used by both navigators and scientists, can
be approximated by polynomials, so a difference engine can compute many useful sets of numbers. The historical difficulty
in producing error free tables by teams of mathematicians and human "computers" spurred Charles Babbage's desire to build
a mechanism to automate the process.

Analytical Engine
The Analytical Engine was a proposed mechanical general-purpose computer designed by English mathematician Charles
Babbage. It was first described in 1837 as the successor to Babbage's difference engine, a design for a mechanical
calculator. The Analytical Engine incorporated an arithmetical unit, control flow in the form of conditional branching and
loops, and integrated memory, making it the first Turing-complete design for a general-purpose computer.

Charles Babbage (1791-1871) the Father of Computers


Charles Babbage is recognized today as the Father of Computers because his impressive designs for the Difference Engine
and Analytical Engine foreshadowed the invention of the modern electronic digital computer. He led a fascinating life, as
did all the folks involved in the history of computers. He also invented the cowcatcher, dynamometer, standard railroad
gauge, uniform postal rates, occulting lights for lighthouses, Greenwich time signals, heliograph opthalmoscope.

Lady Augusta Ada Countess of Lovelace (First Computer Programmer)


Babbage owes a great debt to Lady Augusta Ada, Countess of Lovelace. Daughter of the famous romantic poet, Lord
Byron, she was a brilliant mathematician who helped Babbage in his work. Above all, she documented his work, which
Babbage never could bother to do. As a result we know about Babbage at all. Lady Augusta Ada also wrote programs to be
run on Babbage’s machines. For this, she is recognized as the first computer programmer.

7
Lecturer By: Biran Limbu, CODES Computer Consultant, Dharan, Nepal. Email:codes@[Link]

Electro-Mechanical Computer:
Census Tabulating Machine
Herman Hollerith Develop The tabulating machine. The tabulating machine was an electrical device designed to assist in
summarizing information and, later, accounting. Invented by Herman Hollerith, the machine was developed to help
process data for the 1890 U.S. Census. It spawned a larger class of devices known as unit record equipment and the data
processing industry.

Herman Hollerith worked as a statistician for the U.S. Census Bureau in the 1880s and 1890s. The U.S.
Constitution requires a census count every ten years so that the membership of the House of Representatives will be
proportional to the population of each state. This is always a moving target, hence the ten year review of the current
state of demographic affairs. The 1880 census took seven years to process. The end of the 19th/beginning of the 20th
centuries was the period of highest rate of immigration to the United States. Hollerith deduced,and it didn’t take a rocket
scientist to conclude, that the next census would take longer than ten years, the results not available before the whole
census counting thing had to start again.
So, as the saying goes, “necessity became the mother of invention” and Hollerith designed and built the Census Counting
Machine illustrated here and in the next slide. Punched cards (a la Jacquard looms) were used to collect the census data
(the origin of the IBM punched cards) and the cards were fed into a sorting machine before being read by the census
counting machine which recorded and tabulated the results. Each card was laid on an open grid. A matrix of wires was
lowered onto the card and wherever there was a hole in the card, a wire fell through, making an electrical connection
which triggered a count on the appropriate dial(s) in the face of the machine. The 1890 census took just three months to
process even though quite a bit more data was collected than ever before.
Hollerith was the first American associated with the history of computers. As you might expect, he was also the first to
make a bunch of money at it. His company, the Tabulating Machine Company, became the Computer Tabulating
Recording Company in 1913 after struggling in the market and merging with another company that produced a similar
product. The company hired a gentleman named Thomas J. Watson in 1918 who was primarily instrumental in turning the
company around. In 1924, the company was renamed International Business machines (IBM) Corporation.

Harvard Mark I
The IBM Automatic Sequence Controlled Calculator (ASCC), called the Mark I by Harvard University, was an electro‐
mechanical computer.
The electromechanical ASCC was devised by Howard H. Aiken, built at IBM and shipped to Harvard in February 1944. It
began computations for the U.S. Navy Bureau of Ships in May and was officially presented to the university on August 7,
1944.
The ASCC was built from switches, relays, rotating shafts, and clutches. It used 765,000 components and hundreds of miles
of wire, comprising a volume of 51 feet (16 m) in length, eight feet (2.4 m) in height, and two feet (~61 cm) deep. It had a
weight of about 10,000 pounds (4500 kg). The basic calculating units had to be synchronized mechanically, so they were
run by a 50‐foot (~15.5 m) shaft driven by a five‐horsepower (4 kW) electric motor. From the IBM Archives:
The Automatic Sequence Controlled Calculator (Harvard Mark I) was the first operating machine that could execute long
computations automatically. A project conceived by Harvard University's Dr. Howard Aiken, the Mark I was built by IBM
engineers in Endicott, N.Y.

8
Lecturer By: Biran Limbu, CODES Computer Consultant, Dharan, Nepal. Email:codes@[Link]

The first computer bug


The lady is U.S. Rear Admiral Dr. Grace Murray Hopper, who worked with Howard Aiken from 1944 and used his machine
for gunnery and ballistics calculation for the US Bureau of Ordnance’s Computation project. One day, the program she
was running gave incorrect results and, upon examination, a moth was found blocking one of the relays. The bug was
removed and the program performed to perfection. Since then, a program error in a computer has been called a bug.

Electronic digital computers

The Turing Machine


The "Turing" machine was described by Alan Turing in 1936, who called it an "automatic‐machine". The Turing machine is
not intended as a practical computing technology, but rather as a hypothetical device representing a computing machine.
Turing machines help computer scientists understand the limits of mechanical computation. A Turing machine is a device
that manipulates symbols on a strip of tape according to a table of rules. Despite its simplicity, a Turing machine can be
adapted to simulate the logic of any computer algorithm, and is particularly useful in explaining the functions of a CPU
inside a computer.

Atanasoff–Berry Computer
The ABC was built by Dr. Atanasoff and graduate student Clifford Berry in the basement of the physics building at Iowa
State College during 1939–42.
The Atanasoff–Berry Computer (ABC) was the first electronic digital computing device. Conceived in 1937, the machine
was not programmable, being designed only to solve systems of linear equations. It was successfully tested in 1942.
However, its intermediate result storage mechanism, a paper card writer/reader, was unreliable, and when inventor John
Vincent Atanasoff left Iowa State College for World War II assignments, work on the machine was discontinued. The ABC
pioneered important elements of modern computing, including binary arithmetic and electronic switching elements, but
its special‐purpose nature and lack of a changeable, stored program distinguish it from modern computers.

Colossus computer
Colossus was the world's first electronic, digital, programmable computer. Colossus and its successors were used by British
codebreakers to help read encrypted German messages during World War II. They used thermionic valves (vacuum tubes)
to perform the calculations.
Colossus was designed by engineer Tommy Flowers with input from Sidney Broadhurst, William Chandler, Allen Coombs
and Harry Fensom. at the Post Office Research Station, Dollis Hill to solve a problem posed by mathematician Max
Newman at Bletchley Park. The prototype, Colossus Mark 1, was shown to be working in December 1943 and was
operational at Bletchley Park by February 1944. An improved Colossus Mark 2 first worked on 1 June 1944, just in time for
the Normandy Landings. Ten Colossus computers were in use by the end of the war.
The Colossus computers were used to help decipher teleprinter messages which had been encrypted using the Lorenz
SZ40/42 machine—British codebreakers referred to encrypted German teleprinter traffic as "Fish" and called the SZ40/42
machine and its traffic "Tunny". Colossus compared two data streams, counting each match based on a programmable
Boolean function. The encrypted message was read at high speed from a paper tape. The other stream was generated
internally, and was an electronic simulation of the Lorenz machine at various trial settings. If the match count for a setting
was above a certain threshold, it would be sent as output to an electric typewriter.

9
Lecturer By: Biran Limbu, CODES Computer Consultant, Dharan, Nepal. Email:codes@[Link]

ENIAC
ENIAC (Electronic Numerical Integrator And Computer) was conceived and designed by John Mauchly and J. Presper
Eckert of the University of Pennsylvania. The team of design engineers assisting the development included Robert F. Shaw
(function tables), Jeffrey Chuan Chu (divider/square‐rooter), Thomas Kite Sharpless (master programmer), Arthur Burks
(multiplier), Harry Huskey (reader/printer) and Jack Davis (accumulators).
ENIAC was the first general‐purpose electronic computer. It was a Turing‐complete digital computer capable of being
reprogrammed to solve a full range of computing problems.
ENIAC was designed to calculate artillery firing tables for the United States Army's Ballistic Research Laboratory. When
ENIAC was announced in 1946 it was heralded in the press as a "Giant Brain". It boasted speeds one thousand times faster
than electro‐mechanical machines, a leap in computing power that no single machine has since matched. This
mathematical power, coupled with general‐purpose programmability, excited scientists and industrialists. The inventors
promoted the spread of these new ideas by conducting a series of lectures on computer architecture.

Generations of Computers

The history of computer development is often referred to in reference to the different generations of computing devices.
A generation refers to the state of improvement in the product development process. This term is also used in the
different advancements of new computer technology. With each new generation, the circuitry has gotten smaller and
more advanced than the previous generation before it. As a result of the miniaturization, speed, power, and computer
memory has proportionally increased. New discoveries are constantly being developed that affect the way we live, work
and play.
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 ­ 1940­1956: Vacuum Tubes


The first computers used vacuum tubes for circuitry and magnetic drums for memory, and were often enormous, taking
up entire rooms. They were very expensive to operate and in addition to using a great deal of electricity, generated a lot of
heat, which was often the cause of malfunctions.
First generation computers relied on machine language, the lowest‐level programming language understood by
computers, to perform operations, and they could only solve one problem at a time. Input was based on punched cards
and paper tape, and output was displayed on printouts.
The UNIVAC and ENIAC computers are examples of first‐generation computing devices. The UNIVAC was the first
commercial computer delivered to a business client, the U.S. Census Bureau in 1951.

Second Generation (1956­1963) Transistors


Transistors replaced vacuum tubes and ushered in the second generation of computers. The transistor was invented in
1947 but did not see widespread use in computers until the late 1950s. The transistor was far superior to the vacuum
tube, allowing computers to become smaller, faster, cheaper, more energy‐efficient and more reliable than their first‐
generation predecessors. Though the transistor still generated a great deal of heat that subjected the computer to
damage, it was a vast improvement over the vacuum tube. Second‐generation computers still relied on punched cards for
input and printouts for output.
10
Lecturer By: Biran Limbu, CODES Computer Consultant, Dharan, Nepal. Email:codes@[Link]

Second‐generation computers moved from cryptic binary machine language to symbolic, or assembly, languages, which
allowed programmers to specify instructions in words. High‐level programming languages were also being developed at
this time, such as early versions of COBOL and FORTRAN. These were also the first computers that stored their instructions
in their memory, which moved from a magnetic drum to magnetic core technology.

Third Generation (1964­1971) Integrated Circuits


The development of the integrated circuit was the hallmark of the third generation of computers. Transistors were
miniaturized and placed on silicon chips, called semiconductors, which drastically increased the speed and efficiency of
computers.
Instead of punched cards and printouts, users interacted with third generation computers through keyboards and
monitors and interfaced with an operating system, which allowed the device to run many different applications at one
time with a central program that monitored the memory. Computers for the first time became accessible to a mass
audience because they were smaller and cheaper than their predecessors.

Fourth Generation (1971­Present) Microprocessors


The microprocessor brought the fourth generation of computers, as thousands of integrated circuits were built onto a
single silicon chip. What in the first generation filled an entire room could now fit in the palm of the hand. The Intel 4004
chip, developed in 1971, located all the components of the computer—from the central processing unit and memory to
input/output controls—on a single chip.
In 1981 IBM introduced its first computer for the home user, and in 1984 Apple introduced the Macintosh.
Microprocessors also moved out of the realm of desktop computers and into many areas of life as more and more
everyday products began to use microprocessors.
As these small computers became more powerful, they could be linked together to form networks, which eventually led to
the development of the Internet. Fourth generation computers also saw the development of GUIs, the mouse and
handheld devices.

Fifth Generation (Present and Beyond) Artificial Intelligence


Fifth generation computing devices, based on artificial intelligence, are still in development, though there are some
applications, such as voice recognition, that are being used today. The use of parallel processing and superconductors is
helping to make artificial intelligence a reality. Quantum computation and molecular and nanotechnology will radically
change the face of computers in years to come. The goal of fifth‐generation computing is to develop devices that respond
to natural language input and are capable of learning and self‐organization.

Computer speed and Measurement Unit

Space measurement units


The size of device in computers does not reflect the space available to store data in it. There are larger devices that can
store only a few data where as many tiny devices that stores unbelievable amount of data. Because how long, how thick
etc cannot determine how much we can store inside, we need to find some other way to measure space.
Almost all of the computers use binary numbering systems (though there are some exceptions). Binary numbering system
consists of only two digits – 0 and 1 to represent any quantity. 10 in binary is equal to the 2 and 100 to 5. We will be
learning this numbering system after some days.
11
Lecturer By: Biran Limbu, CODES Computer Consultant, Dharan, Nepal. Email:codes@[Link]

Everything in computers is represented in strings of binary numbers. For example capital A is interpreted by computer as
0100 0001 and B is 0100 0010. All characters, numbers, symbols, images, sounds, animations, videos and everything, yes
everything is converted into suitable binary code to store in computer or process by computer.
So if there is any device that can store one binary digit (whether 0 or 1), its storage capacity is 1 bit. We’ve already learned
that bit is the abbreviation of binary digit. Any device that has storage space to accommodate 5 binary digits has 5 bits
space.
You require thousands and millions of bits for a file and expressing the space available in bits only is really inconvenient
because it will be an extremely large number. So, we have larger units that represent a group of lower units.
A group of 4 binary digits is called a nibble (4 bits = 1 Nibble). Similarly a group of 8 bits is called a byte (1 byte = 8 bits).
As you have seen the example above, each character requires 8 bits which is 1 byte. So 1 character requires 1 byte space.
Now, if you have a text file whose size is 32 bytes, it means there are 32 x 8 binary digits (0s and 1s) stored in it.
In the metric system 1000 lifts up the unit to the higher such as 1000 meter is 1 kilometer, 1000 liter is 1 kiloliter etc. In
binary numbering system it is 1024 (=2 10) that converts to higher unit. Following table lists the different units and
their values:

Space Measurement Units


Units Equivalent
0 or 1 1 Bit
4 bits 1 Nibble
8 bits 1 Byte
1024 bytes 1 Kilobytes (KB)
1024 Kilobytes 1 Megabyte (MB)
1024 Megabytes 1 Gigabytes (GB)
1024 Gigabytes 1 Terabytes (TB)
1024 Terabytes 1 Petabyte (PB)
1024 Petabytes 1 Exabyte (EB)

Speed Measurement Units


speed is related to time. Computer can perform millions of tasks in one second. So to compare
the speed of computer operation (execution of programs and instructions) we require some units
that can represent a very small fraction of time. Following are the units used to indicate fraction of
seconds:
Speed Measurement Units
Units Equivalent
1000 th of a second 1 Milliseconds (MS)
1000 th of a milliseconds 1 Microseconds (µs)
1000 th of a microseconds 1 Nanosecond (ns)
1000 th of a nanoseconds 1 Picoseconds (ps)
1000 th of a picoseconds 1 Femtoseconds (fs)

12
Lecturer By: Biran Limbu, CODES Computer Consultant, Dharan, Nepal. Email:codes@[Link]

CLASSIFICATION OF COMPUTER
On the basis of size
The digital computers that are available nowadays vary in their sizes and types. The computers are broadly
classifi ed into four categories (Figure 1.8) based on their size and type—(1) Microcomputers, (2) Mini‐
computers, (3) Mainframe computers, and (4) Supercomputer.

Figure 1.8 Classification of computers based on size and type


Microcomputers
Microcomputers are small, low‐cost and single‐user digital computer. They consist of CPU, input unit, output unit, storage
unit and the software. Although microcomputers are stand‐alone machines, they can be connected together to create a
network of computers that can serve more than one user. IBM PC based on Pentium microprocessor and Apple Macintosh
are some examples of microcomputers. Microcomputers include desktop computers, notebook computers or laptop,
tablet computer, handheld computer, smart phones and notebook.
Desktop Computer or Personal Computer (PC) is the most common type of microcomputer. It is a stand‐alone machine
that can be placed on the desk. Externally, it consists of three units—key‐board, monitor, and a system unit containing the
CPU, memory, hard disk drive, etc. It is not very expensive and is suited to the needs of a single user at home, small
business units, and organizations. Apple, Microsoft, HP, Dell and Lenovo are some of the PC manufacturers.
Notebook Computers or Laptop resemble a notebook. They are portable and have all the features of a desktop
computer. The advantage of the laptop is that it is small in size (can be put inside a briefcase), can be carried anywhere,
has a battery backup and has all the functionality of the desk‐top. Laptops can be placed on the lap while working (hence
the name). Laptops are costlier than the desktop machines.
Netbook These are smaller notebooks optimized for low weight and low cost, and are designed for accessing web‐based
applications. Starting with the earliest netbook in late 2007, they have gained significant popularity now. Netbooks deliver
the performance needed to enjoy popular activities like streaming videos or music, emailing, Web surfi ng or instant
messaging. The word netbook was created as a blend of Internet and notebook.
Tablet Computer has features of the notebook computer but it can accept input from a stylus or a pen instead of the
keyboard or mouse. It is a portable computer. Tablet computer are the new kind of PCs.
Handheld Computer or Personal Digital Assistant (PDA) is a small computer that can be held on the top of the palm. It is
small in size. Instead of the keyboard, PDA uses a pen or a stylus for input. PDAs do not have a disk drive. They have a
limited memory and are less powerful. PDAs can be connected to the Internet via a wireless connection. Casio and Apple
13
Lecturer By: Biran Limbu, CODES Computer Consultant, Dharan, Nepal. Email:codes@[Link]

are some of the manufacturers of PDA. Over the last few years, PDAs have merged into mobile phones to create smart
phones.
Smart Phones are cellular phones that function both as a phone and as a small PC. They may use a stylus or a pen, or may
have a small keyboard. They can be connected to the Internet wirelessly. They are used to access the electronic‐mail,
download music, play games, etc. Blackberry, Apple, HTC, Nokia and LG are some of the manufacturers of smart phones.

Minicomputers
Minicomputers are digital computers, generally used in multi‐user systems. They have high processing speed and high
storage capacity than the microcomputers. Minicomputers can support 4–200 users simultaneously. The users can access
the minicomputer through their PCs or terminal. They are used for real‐time applications in industries, research centers,
etc. PDP 11, IBM (8000 series) are some of the widely used minicomputers.

Mainframe Computers
Mainframe computers are multi‐user, multi‐programming and high performance computers. They operate at a very high
speed, have very large storage capacity and can handle the workload of many users. Mainframe computers are large and
powerful systems generally used in centralized databases. The user accesses the mainframe computer via a terminal that
may be a dumb terminal, an intelligent terminal or a PC. A dumb terminal cannot store data or do processing of its own. It
has the input and output device only. An intelligent terminal has the input and output device, can do processing, but,
cannot store data of its own. The dumb and the intelligent terminal use the processing power and the storage facility of
the mainframe computer. Mainframe computers are used in organizations like banks or companies, where many people
require frequent access to the same data. Some examples of mainframes are CDC 6600 and IBM ES000 series.

Supercomputers
Supercomputers are the fastest and the most expensive machines. They have high processing speed com‐
pared to other computers. The speed of a supercomputer is generally measured in FLOPS (Floating point Operations
Per Second). Some of the faster supercomputers can perform trillions of calculations per second. Supercomputers are built
by interconnecting thousands of processors that can work in parallel. Supercomputers are used for highly calculation‐
intensive tasks, such as, weather forecasting, climate research (global warming), molecular research, biological research,
nuclear research and aircraft design. They are also used in major universities, military agencies and scientific research
laboratories. Some examples of supercomputers are IBM Roadrunner, IBM Blue gene and Intel ASCI red. PARAM is a series
of supercomputer assembled in India by C‐DAC (Center for Development of Advanced Computing), in Pune. PARAM Padma
is the latest machine in this series. The peak computing power of PARAM Padma is 1 Tera FLOP (TFLOP).

On the basis of working principle

Digital computers:
Digital computers operates on inputs which are on‐off type (being digit 1 and 0) and its outputs is also in form of on‐off
signals. Digital computers are based on counting operation. Any data to be manipulated by a digital computer must first be
converted to a discrete(1, 0) representation. There is a practical limit to the accuracy of the readings of analog devices,
usually to the nearest tenth of the unit of measure. Thus if water in a beaker was being heated and its temperature rose
from 50 C to 51 C ,someone observing the thermometer might only be able to distinguish the temperature 50.0, 50.1,
50.2... 50.9, 51.0. However, on a digital computer, we could simulate to rise in temperature whatever degree of accuracy

14
Lecturer By: Biran Limbu, CODES Computer Consultant, Dharan, Nepal. Email:codes@[Link]

we want; so that if we wish, we could let the increment be 0.1, 0.01, 0.001,[Link] digital computers are more accurate
than analog computers.
Analog computers:
The analog computer operate by measuring rather than counting. It measure continually, usually of a physical nature data
such as lengths, voltages, or currents. It does not produce number but produces its results in the form of graph. It is more
efficient in continues calculations. Analog machines are usually special purpose devices, dedicated to a single task.
Hybrid computers:
A hybrid computer is combination of both analog and digital computer i.e. a part of processing is done on analog computer
and a part on digital computer. A hybrid computer combines the best characteristics of both analog and digital computer.
It can accept input data in both analog and digital form. It is used for simulation application.

Computer name Input Output Based on Examples


Digital On/Off, 1/0 On/Off, 1/0 Counting General purpose PCs

Measure elements Graphs pictures Continuous Weather


Measurements forecasting
Analog
speedometer,
ECG machines, etc.

Both 0/1& Measure Both On/Off & Counting & Controlling &
elements Graphs Measurements monitoring plants.
Hybrid
Petrol pumps, Modem,
Simulation etc.

On the basis of brand


On the basis of brand , the computer can be classified as IBM PC, IBM compatibles and Apple/Macintosh computer.
IBM PC:
IBM PC is the largest computer manufacturing company establishing USA. The computer manufactures by IBM PC or
branded computer. Personal Computer (PC) is the most important type of micro computer system. The micro computer
manufacture by IBM company are called IBM PC. These computers are reliable, durable and have better quality but they
are costly.

IBM compatibles:
The computers that have some functional characteristics and principles of IBM computer are called IBM compatibles. In
other word, all the computer are manufactured by the another companies rather than IBM company are Known as IBM
compatibles. All the software and hardware of IBM compatibles. These are cheaper and Their Parts are easily available in
Market. they are also duplicate or assemble computer.

Apple/Macintosh Computer:
All the computers manufacture by apple cooperation, a leading computers manufacturing computer of USA are known as
apple/macintosh computers. These computer use their own software and hardware. They are totally different than that of
IBM computers, In terms of both hardware and software. For e.g software developed for apple computer can't run or IBM

15
Lecturer By: Biran Limbu, CODES Computer Consultant, Dharan, Nepal. Email:codes@[Link]

computers and vice‐versa. Similarly, floppy disk formatting in IBM computer can't be recognized by apple macintosh
computer and vice‐versa. It is popularly used in desktop publishing (DTP) houses as they provide better quality of graphic
output.

Mobile Computing
Mobile computing' is a form of human–computer interaction by which a computer is expected to be transported during
normal usage. Mobile computing has three aspects: mobile communication, mobile hardware, and mobile software. The
first aspect addresses communication issues in ad‐hoc and infrastructure networks as well as communication properties,
protocols, data formats and concrete technologies. The second aspect is on the hardware, e.g., mobile devices or device
components. The third aspect deals with the characteristics and requirements of mobile applications.
Definitions

Mobile computing is "taking a computer and all necessary files and software out into the field."
"Mobile computing: being able to use a computing device even when being mobile and therefore changing location.
Portability is one aspect of mobile computing." "Mobile computing is the ability to use computing capability without a
pre‐defined location and/or connection to a network to publish and/or subscribe to information."
Mobile Computing is a variety of wireless devices that has the mobility to allow people to connect to the internet,
providing wireless transmission to access data and information from where ever location they may be.

THE COMPUTER SYSTEM

Computer Structure

• CPU, serves as a central processor / main processing unit.


• Main memory: to store data, programs that are running and execute the instructions.
• Systems Interconnection: a controller unit between devices those are interconnected.
• Input / Output: to interact with the outside environment and conduct relations with peripherals
(enhancement)

16
Lecturer By: Biran Limbu, CODES Computer Consultant, Dharan, Nepal. Email:codes@[Link]

Computer architecture:

1. Input / Output: to interact with the outside environment and conduct relations with peripherals
enhancement.
2. Bus-System, serves to connect the internal components and buses.
3. the external bus CPU.-CPU, serves as a central processor / main processing unit.
4. Central Process Communicating Peripheral Units on Line Image: Computer Structure - Top Level
5. Memory, as the CPU internal storage media used during data processing.
6. Register, serves as a place to store data temporarily in the CPU during execution. In the event of the
execution process data in the registers sent to the ALU for processing, the execution will be put into the
register again.
7. ALU (Arithmetic Logic Unit), serves perform arithmetic operations and logic operations. Internal CPU-
Interconnection, to control the internal components of CPU: ALU, control unit and registers - registers.
8. CU (Control Unit), the controller unit. taking, coding, and implementing a program instructions stored in
memory.

Concept of Computer Architecture


Computer architecture is the design which deals with the operational activities of the computer. The computer
architecture is also known as the digital computer organizational design which deals with the computer system and for
that the fundamental operations needs to be identified. All the requirement which are needed for the computer
architecture are to be listed down and at times the blueprint technique is also used by the computer architecture so that
all things could be performed in a much better way. The implementations requirement must also be known so that they
could be implemented on to the different parts of the computer.
Represents the attributes associated with computer systems for Example: Set the instruction, the arithmetic is used,
addressing technique, the mechanism of I / O. Computer architecture is related to Computer Organization. Computer
organization is the part that is closely related to operational units. Example: Technology hardware, interface devices,
memory technology, system memory, and control signals.

17
Lecturer By: Biran Limbu, CODES Computer Consultant, Dharan, Nepal. Email:codes@[Link]

COMPUTER ORGANISATION
Computer organization is a study of a Computer Architecture. E.g. Memory, Registers, RAM, ROM, CPU, ALU, 16 bit/ 32
bit/ 64 bit architecture, what different parts makes a computer, etc.

BASIC COMPUTER OPERATIONS


A computer performs basically five major operations or functions irrespective of their size and make. These are:
1) It accepts data or instruction by way of input,
2) It stores data,
3) It can process data as required by the user,
4) It gives results in the form of output, and
5) It controls all operations inside a computer.

1. Input: This is the process of entering data and programs in to the computer system. You should know that
computer is an electronic machine like any other machine, which takes as input raw data and performs some

18
Lecturer By: Biran Limbu, CODES Computer Consultant, Dharan, Nepal. Email:codes@[Link]

processing giving out processed data. Therefore, the input unit takes data from us to the computer in an
organized manner for processing.

2. Storage: The process of saving data and instructions permanently is known as storage. Data has to be fed
into the system before the actual processing starts. It is because the processing speed
of Central Processing Unit (CPU) is so fast that the data has to be provided to CPU with the same speed.
Therefore the data is first stored in the storage unit for faster access and processing. This storage unit or the
primary storage of the computer system is designed to do the above functionality. It provides space for storing
data and instructions. The storage unit performs the following major functions:
• All data and instructions are stored here before and after processing.
• Intermediate results of processing are also stored here.

3. Processing: The task of performing operations like arithmetic and logical operations is called processing.
The Central Processing Unit (CPU) takes data and instructions from the storage unit
and makes all sorts of calculations based on the instructions given and the type of data provided. The result is
then sent back to the storage unit.

4. Output: This is the process of producing results from the data for getting useful information. The results could
either be displayed on the screen or may be printed for future reference. The output unit therefore allows the
results to be either stored inside the computer for further processing or may give you the results in human
readable form.

5. Control: The process of input, output, processing and storage is performed under the supervision of a unit
called ‘Control Unit’. It decides when to start receiving data, when to stop it, where to store data, etc. It takes
care of step-by-step processing of all operations inside the computer.

FUNCTIONAL UNITS
In order to carry out the operations mentioned in the previous section the computer allocates the task between
its various functional units. The computer system is divided into three separate units for its operation. These are:
1) Arithmetic logical unit,
2) Control unit, and
3) Central processing unit.
(a) Arithmetic Logical Unit (ALU)
After you enter data through the input device it is stored in the primary storage unit. Arithmetic Logical Unit
performs the actual processing of data and instruction. The major operations performed by the ALU are addition,
subtraction, multiplication, division, logic and comparison. Data is transferred to ALU from storage unit when
required. After processing, the output is returned back to storage unit for further processing or getting stored.
19
Leccturer By: Biraan Limbu, COD
DES Computerr Consultant, Dharan,
D Nepal. Email:codes@
@[Link]

(b) Control Unit (CU)


Thee next compo onent of com mputer is the e Control Un
nit, which actts like the su
upervisor see eing whethe er things are
donne in proper fashion. The e control unit determiness the sequennce in which h computer programs
p and instructionns
are executed. Things
T like processing off programs stored
s in the
e main memo ory, interpretation of the instructionss
andd issuing of signals
s for otther units of the computer to execute them. It also acts as a switch board operator
wheen several users access s the computter simultane eously. Therreby it coord dinates the activities
a of computer’s
c
peripheral equippment as the ey perform the
t input and d output. Theerefore it is the
t manage er of all operaations
menntioned in th
he previous section.
s

(c) Central Proocessing Un nit (CPU)


Thee ALU and th he CU of a computer
c sysstem are join ntly known as
a the centra al processingg unit. You may
m call CPU U
as the
t brain of any
a compute er system. Itt is just like a human braain that takess all major decisions,
d ma
akes all sortts
of calculations
c a directs different
and d parrts of the com mputer by acctivating and
d controlling the operatio
ons.

Conceptt of System
m Buses:

The
e system bu
us consists of three typ
pes of busees:
• Data Bus: Carries the
e data that needs
n proce
essing
• Address Bus:
B Determmines where e data shou
uld be sent
• Control Bu
us: Determiines data processing

20
Lecturer By: Biran Limbu, CODES Computer Consultant, Dharan, Nepal. Email:codes@[Link]

Basically, it is a means of getting data from one point to another, point A to point B, one device to another
device, or one device to multiple devices. The bus includes not only the actual capability to transfer data
between devices, but also all appropriate signaling information to ensure complete movement of the data from
point A to point B. To avoid loss of data, a bus must include a means of controlling the flow of data between two
devices, in order to insure that both devices are ready to send and/or receive information. Finally, both ends
must understand the speed with which data is to be exchanged. A bus provides for all of these elements, and it
includes a port definition to allow physical interfacing or connecting of two or more devices.

Data Bus
In computer, a data bus is a group of electrical wires used to send information (data) back and forth between two
or more components. A data bus has many different defining characteristics, but one of the most important is its
width. The width of a data bus refers to the number of bits (electrical wires) that make up the bus. Common data
bus widths include 1-, 4-, 8-, 16-, 32-, and 64-bit. When manufacturers refer to the number of bits a processor
uses, such as “This computer uses a 64-bit processor,” they are referring to the width of the front side data bus,
the bus that connects the processor to its main memory. Other types of data buses used in computers include
the back side bus, which connects the processor to dedicated cache memory.

Address bus
An address bus is a computer bus (a series of lines connecting two or more devices) that is used to specify
a physical address. When processor or DMA-enabled device needs to read or write to a memory location, it
specifies that memory location on the address bus (the value to be read or written is sent on the data bus). The
width of the address bus determines the amount of memory a system can address. For example, a system with
a 32-bit address bus can address 232 (4,294,967,296) memory locations. If each memory address holds one
byte, the addressable memory space is 4 GB.

Control Bus
The control bus is used by the CPU to direct and monitor the actions of the other functional areas of the
computer. It is used to transmit a variety of individual signals (read, write, interrupt, acknowledge, and so forth)
necessary to control and coordinate the operations of the computer. The individual signals transmitted over the
control bus and their functions are covered in the appropriate functional area description.

Computer Memory

21
Lecturer By: Biran Limbu, CODES Computer Consultant, Dharan, Nepal. Email:codes@[Link]

In computing, memory refers to the physical devices used to store programs (sequences of instructions) or data
(e.g. program state information) on a temporary or permanent basis for use in a computer or
other digital electronic device.
The term primary memory is used for the information in physical systems which are fast (i.e. RAM), as a
distinction from secondary memory, which are physical devices for program and data storage which are slow to
access but offer higher memory capacity. Primary memory stored on secondary memory is called "virtual
memory".

Primary memory
Primary memory (or main memory or internal memory), often referred to simply as memory, is the only one
directly accessible to the CPU. The CPU continuously reads instructions stored there and executes them as
required. Any data actively operated on is also stored there in uniform manner.
It can be divided into two essential types: RAM and ROM.
RAM(Volatile memory)
RAM (random access memory) is the place in a computer where the operating system, application programs,
and data in current use are kept so that they can be quickly reached by the computer's processor. RAM is much
faster to read from and write to than the other kinds of storage in a computer, the hard disk, floppy disk, and CD-
ROM. However, the data in RAM stays there only as long as your computer is running. When you turn the
computer off, RAM loses its data. When you turn your computer on again, your operating system and other files
are once again loaded into RAM, usually from your hard disk.
There are two different types of RAM:
DRAM (Dynamic Random Access Memory)
SRAM (Static Random Access Memory).

DRAM (Dynamic Random Access Memory)


Dynamic RAM is a type of RAM that only holds its data if it is continuously accessed by special logic called
a refresh circuit. Many hundreds of times each second, this circuitry reads the contents of each memory cell,
whether the memory cell is being used at that time by the computer or not. Due to the way in which the cells are
constructed, the reading action itself refreshes the contents of the memory. If this is not done regularly, then the
DRAM will lose its contents, even if it continues to have power supplied to it. This refreshing action is why the
memory is called dynamic.

SRAM (Static Random Access Memory


Static RAM is a type of RAM that holds its data without external refresh, for as long as power is supplied to the
circuit. This is contrasted to dynamic RAM (DRAM), which must be refreshed many times per second in order to
hold its data contents. SRAMs are used for specific applications within the PC, where their strengths outweigh
their weaknesses compared to DRAM:
• Simplicity: SRAMs don't require external refresh circuitry or other work in order for them to keep their
data intact.
• Speed: SRAM is faster than DRAM.
In contrast, SRAMs have the following weaknesses, compared to DRAMs:
• Cost: SRAM is, byte for byte, several times more expensive than DRAM.
• Size: SRAMs take up much more space than DRAMs (which is part of why the cost is higher).
Read‐Only Memory (ROM)
One major type of memory that is used in PCs is called read-only memory, or ROM for short. ROM is a type of
memory that normally can only be read, as opposed to RAM which can be both read and written. There are two
main reasons that read-only memory is used for certain functions within the PC:
Permanence: The values stored in ROM are always there, whether the power is on or not. A ROM can be
removed from the PC, stored for an indefinite period of time, and then replaced, and the data it contains will still
be there. For this reason, it is called non-volatile storage.
Security: The fact that ROM cannot easily be modified provides a measure of security against accidental (or
malicious) changes to its contents.
22
Leccturer By: Biraan Limbu, COD
DES Computerr Consultant, Dharan,
D Nepal. Email:codes@
@[Link]

Reaad-only mem mory is most commonly used


u to store
e system-levvel programss that we wa ant to have available
a to tthe
PC at all times. The most common
c exa
ample is the system BIOS S program, which
w is stored in a ROM M called
(am
mazingly eno ough) the sysstem BIOS ROM.
R Having this in a peermanent ROOM means it i is available
e when the
powwer is turned
d on so that the
t PC can use
u it to booot up the sysstem. Rememmber that wh hen you firstt turn on the PC
the system mem mory is empty, so there has to be so
omething forr the PC to use
u when it starts
s up.

There are severaal ROM varian nts that can be changed un nder certain circumstances
c s; the followin
ng are the diffferent types of
ROM Ms with a desscription of th
heir relative modifiability:
m
• RO OM: A regulaar ROM is connstructed fromm hard‐wired logic, encodeed in the siliccon itself, mucch the way th
hat a processo or
is. Itt is designed to
t perform a specific functtion and cannnot be changeed. This is infllexible and so
o regular ROM
Ms are only ussed
generally for pro ograms that are static (not changing often) and masss‐produced. This
T product is analagous to t a commerccial
softtware CD‐ROM M that you puurchase in a store.
s

• Prrogrammable e ROM (PROM M): This is a tyype of ROM that can be prrogrammed using
u special equipment;
e itt can be written
to, but
b only oncee. This is usefu ul for compan nies that makke their own ROMs
R from sooftware they write, because when theyy
chan nge their code they can crreate new PRO OMs withoutt requiring exppensive equippment. This iss similar to thhe way a CD‐
ROMM recorder works
w by lettin
ng you "burn"" programs on nto blanks once and then letting
l you reead from them m many timess. In
fact, programmin ng a PROM is also called burning, just liike burning a CD‐R, and it is comparablee in terms of its flexibility.

• Errasable Progrrammable RO OM (EPROM): An EPROM is i a ROM thatt can be eraseed and reproggrammed. A little glass
window is installed in the top of the ROM package, thro ough which you can actually see the chip that holds the memory.
o a specific frequency can
Ultrraviolet light of n be shined th
hrough this window
w for a specified
s period of time, which
w will erasse
the EPROM and allowa it to be reprogrammmed again. Ob bviously this iss much more useful than a regular PRO OM, but it doees
requuire the erasing light. Conttinuing the "C
CD" analogy, this
t technolo ogy is analogoous to a reusaable CD‐RW.

• Ellectrically Eraasable Prograammable ROM M (EEPROM): The next levvel of eras ability is the EEPPROM, whichh can be eraseed
under software control.
c This is the most fleexible type off ROM, and iss now commo only used for holding BIOS programs.
Wheen you hear reference
r to a "flash BIOS"" or doing a BIOS
B upgrade by "flashing", this refers to reprogramm
ming the BIOS
EEPROM with a special
s softwaare program. Here we are blurring the line a bit betw ween what "rread‐only" really means, b
but
rem
member that thist rewriting is done mayb be once a yeaar or so, comp pared to real read‐write memory
m (RAM
M) where
rew
writing is donee often many times per seccond!

Cac che-Memory y
In coomputer engineering, a caache is a component that transparently
t y stores data so
s that futuree requests forr that data caan
be served
s faster.. The data thaat is stored within a cache might be values that havee been compu uted earlier or
o duplicates o of
origginal values th
hat are storedd elsewhere. If requested datad is contaiined in the caache (cache hit), this requeest can be
servved by simplyy reading the cache, which is comparatively faster. Otherwise
O (cache miss), thee data has to be recomputted
or feetched from its
i original stoorage location, which is co omparatively slower. Hencce, the greateer the number of requests
thatt can be serveed from the cache,
c the faster the overaall system perrformance becomes.

23
Lecturer By: Biran Limbu, CODES Computer Consultant, Dharan, Nepal. Email:codes@[Link]

To be cost efficient and to enable an efficient use of data, caches are relatively small. Nevertheless, caches have proven
themselves in many areas of computing because access patterns in typical computer applications have locality of
reference. References exhibit temporal locality if data is requested again that has been recently requested already.
References exhibit spatial locality if data is requested that is physically stored close to data that has been requested
already.

Cache (L1)
The Level 1 cache, or primary cache, is on the CPU and is used for temporary storage of instructions and data organized in
blocks of 32 bytes. Primary cache is the fastest form of storage. Because it’s built in to the chip with a zero wait‐state
(delay) interface to the processor’s execution unit, it is limited in size. For all L1 cache designs the control logic of the
primary cache keeps the most frequently used data and code in the cache and updates external memory only when the
CPU hands over control to other bus masters, or during direct memory access by peripherals.

Cache (L2)
Most PCs are offered with a Level 2 cache to bridge the processor/memory performance gap. Level 2 cache – also referred
to as secondary cache) uses the same control logic as Level 1 cache.
The aim of the Level 2 cache is to supply stored information to the processor without any delay (wait‐state). For this
purpose, the bus interface of the processor has a special transfer protocol called burst mode. A burst cycle consists of four
data transfers where only the address of the first 64 is output on the address bus. The most common Level 2 cache is
synchronous pipeline burst.

Memory data register


The Memory Data Register (MDR) is the register of a computer's control unit that contains the data to be stored in
the computer storage(e.g. RAM), or the data after a fetch from the computer storage. It acts like a buffer and holds
anything that is copied from the memory ready for the processor to use it. The Memory Data Register is half of a minimal
interface between a micro program and computer storage, the other half is a memory address register.
Far more complex memory interfaces exist, but this is the simplest that can work.
The Memory Data Register (MDR) contains the data value being fetched or stored. We might be tempted to say that the
MDR should be W bits wide, where W is the cell size. However on most computers the cell size is only 8‐bits, and most
data values occupy multiple cells. Thus the size of the MDR is usually a multiple of 8. Typical values of MDR width are 32
and 64 bits, which would allow us to fetch, in a single step, either an integer or a real value.

Secondary memory

Secondary memory (also known as external memory or auxiliary storage or Secondary Storage), differs from primary
storage in that it is not directly accessible by the CPU. The computer usually uses its input/output channels to access
secondary storage and transfers the desired data using intermediate area in primary storage. Secondary storage does not
lose the data when the device is powered down—it is non‐volatile. Per unit, it is typically also two orders of magnitude
less expensive than primary storage. Consequently, modern computer systems typically have two orders of magnitude
more secondary storage than primary storage and data are kept for a longer time there. Some examples of secondary
storage technologies are: Hard Disk, Floppy Disk, magnetic tape etc.
Storage Device
Computer data storage, often called storage or memory, refers to computer components and recording media that retain
digital data. Data storage is a core function and fundamental component of computers.
Storage Device Types: Magnetic Tape, Hard Disk, Floppy Disk, Flash Memory, Optical Disk(CD,VCD,DVD),
External Storage Device

Magnetic Tape: Magnetic tapes are used for large computers like mainframe computers where large volume of data is
stored for a longer time. In PC also can use tapes in the form of cassettes. The storage of data in tapes is inexpensive.

24
Lecturer By: Biran Limbu, CODES Computer Consultant, Dharan, Nepal. Email:codes@[Link]

Tapes consist of magnetic materials that store data permanently. It can be 12.5 mm to 25 mm wide plastic film‐type and
500 meter to 1200 meter long, which is coated with magnetic material. The tape unit is connected to the central processor
and information is fed into or read from the tape through the processor. It is similar to a cassette tape recorder.

Magnetic Disk (HDD): Magnetic disks used in computer are made on the circular disk and coated with magnetic material.
It rotates with very high speed inside the computer drive. Data is stored on both the surfaces of the disk. Magnetic disks
are most popular as direct access storage device. Each disk consists of a number of invisible concentric circles called tracks.
Information is recorded on tracks of a disk surface in the form of tiny magnetic spots. The presence of a magnetic spot
represents one bit and its absence represents zero bit. The information stored in a disk can be read many times without
affecting the stored data. So the reading operation is non‐destructive. But if you want to write a new data, then the
existing data is erased from the disk and new data is recorded.

Floppy Disk: It is similar to magnetic disk. It is 3.5 inch in diameter. These come in single or double density and recorded
on one or both surface of the diskette. The capacity of a high‐density 3.5 inch floppy it is 1.44 mega bytes. It is cheaper
than any other storage devices and is portable. The floppy is a low cost device particularly suitable for personal computer
system.

Optical Disk:
With every new application and software there is greater demand for memory capacity. It is the necessity to store large
volume of data that has led to the development of optical disk storage medium. Optical disks read and write the data
using light. Optical disks can be divided into the following categories:

1. Compact Disk/Read Only Memory (CD‐ROM): CD‐ROM disks are made of reflective metals. CD‐ROM is written during
the process of manufacturing by high power laser beam. Here the storage density is very high, storage cost is very low and
access time is relatively fast. Each disk is approximately 4 ½ inches in diameter and can have over 600 MB of data. As the
CD‐ROM can be read only we cannot write or make changes into the data contained in it.

2. Write Once, Read Many (WORM): The inconvenience that we cannot write anything onto a CD‐ROM is avoided in
WORM. A WORM allows the user to write data permanently on to the disk. Once the data is written it can never be erased
without physically damaging the disk. Here data can be recorded from keyboard, video scanner, OCR equipment and other
devices. The advantage of WORM is that it can store vast amount of data amounting to gigabytes (10' bytes). Any
document in a WORM can be accessed very fast, say less than 30 seconds.

3. Erasable Optical Disk: These are optical disks where data can be written, erased and re‐written. This makes use of a
laser beam to write and re‐write the data. These disks may be used as alternatives to traditional disks. Erasable optical
disks are based on a technology known as magneto‐optico (MO). To write a data bit on to the erasable optical disk the MO
drive’s laser beam heats a tiny, precisely defined point on the disk’s surface and magnetizes it.

4. A DVD is an optical disc storage media format, invented and developed by Philips, Sony,Toshiba, and Panasonic in 1995.
DVDs offer higher storage capacity than Compact Discs while having the same dimensions.
Pre‐recorded DVDs are mass‐produced using molding machines that physically stamp data onto the DVD. Such discs are
known as DVD‐ROM, because data can only be read and not written nor erased. Blank recordable DVDs (DVD‐
R and DVD+R) can be recorded once using optical disc recording technologies and supported by optical disc
drives and DVD recorder sand then function as a DVD‐ROM. Rewritable DVDs (DVD‐RW, DVD+RW, and DVD‐RAM) can be
recorded and erased multiple times.
DVDs are used in DVD‐Video consumer digital video format and in DVD‐Audio consumer digital audio format, as well as for
authoring AVCHD discs. DVDs containing other types of information may be referred to as DVD data discs.

25
Lecturer By: Biran Limbu, CODES Computer Consultant, Dharan, Nepal. Email:codes@[Link]

5. Flash memory
Flash memory is a non‐volatile computer storage chip that can be electrically erased and reprogrammed. It was developed
from EEPROM (electrically erasable programmable read‐only memory) and must be erased in fairly large blocks before
these can be rewritten with new data. Example applications of both types of flash memory include personal
computers, PDAs, digital audio players, digital cameras, mobile phones, synthesizers, video games, scientific
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 disks in portable devices; as does its high durability, being able to withstand high
pressure, temperature, immersion in water etc.

6. External Storage Device


In computing, external storage comprises devices that temporarily store information for transporting from computer to
computer. Such devices are not permanently fixed inside a computer. Semiconductor memories are not sufficient to
provide the whole storage capacity required in computers. The major limitation in using semiconductor memories is the
cost per bit of the stored information. So to fulfill the large storage requirements of computers, magnetic disks, optical
disks are generally used.
Advantages of external storage:
• External storage provides additional storage other than that available in a computer.
• Data can be transported easily from one place to another.
• It is useful to store software and data that is not needed frequently.
• External storage also works as data backup.
• This back up may prove useful at times such as fire or theft because important data is not lost.

Input Devices

In computing, an input device is any peripheral (piece of computer hardware equipment) used to provide data and
control signals to an information processing system such as a computer or other information appliance. Many input
devices can be classified according to:
• Modality of input (e.g. mechanical motion, audio, visual, etc.)
• the input is discrete (e.g. key presses) or continuous (e.g. a mouse's position, though digitized into a discrete
quantity, is fast enough to be considered continuous)
• the number of degrees of freedom involved (e.g. two‐dimensional traditional mice, or three‐dimensional
navigators designed for CAD applications)

Keyboards
It is a text base input device that allows the user to input alphabets, numbers and other characters. It consists of a set of
keys mounted on a board.
Alphanumeric Keypad
It consists of keys for English alphabets, 0 to 9 numbers, and special characters like + − / * ( ) etc.
Function Keys
There are twelve function keys labeled F1, F2, F3… F12. The functions assigned to these keys differ from one software
package to another. These keys are also user programmable keys.
Special‐function Keys
These keys have special functions assigned to them and can be used only for those specific purposes. Functions of some of
the important keys are defined below.

26
Lecturer By: Biran Limbu, CODES Computer Consultant, Dharan, Nepal. Email:codes@[Link]

Enter
It is similar to the ‘return’ key of the typewriter and is used to execute a command or program.
Spacebar
It is used to enter a space at the current cursor location.
Backspace
This key is used to move the cursor one position to the left and also delete the character in that position.
Delete
It is used to delete the character at the cursor position.
Insert
Insert key is used to toggle between insert and overwrite mode during data entry.
Shift
This key is used to type capital letters when pressed along with an alphabet key. Also used to type the special characters
located on the upper‐side of a key that has two characters defined on the same key.
Caps Lock
Cap Lock is used to toggle between the capital lock features. When ‘on’, it locks the alphanumeric keypad for capital
letters input only.
Tab
Tab is used to move the cursor to the next tab position defined in the document. Also, it is used to insert indentation into
a document.
Ctrl
Control key is used in conjunction with other keys to provide additional functionality on the keyboard.
Alt
Also like the control key, Alt key is always used in combination with other keys to perform specific tasks.
Esc
This key is usually used to negate a command. Also used to cancel or abort executing programs.
Numeric Keypad
Numeric keypad is located on the right side of the keyboard and consists of keys having numbers (0 to 9) and
mathematical operators (+ − * /) defined on them. This keypad is provided to support quick entry for numeric data.
Cursor Movement Keys
These are arrow keys and are used to move the cursor in the direction indicated by the arrow (up, down, left, right).

Mouse
The mouse is a small device used to point to a particular place on the screen and select in order to perform one or more
actions. It can be used to select menu commands, size windows, start programs etc. The most conventional kind of mouse
has two buttons on top: the left one being used most frequently.
Mouse Actions
Left Click : Used to select an item.
Double Click : Used to start a program or open a file.
Right Click : Usually used to display a set of commands.
Drag and Drop : It allows you to select and move an item from one location to another. To achieve this place the cursor
over an item on the screen, click the left mouse button and while holding the button down move the cursor to where you
want to place the item, and then release it.

Joystick
The joystick is a vertical stick which moves the graphic cursor in a direction the stick is moved. It typically has a button on
top that is used to select the option pointed by the cursor. Joystick is used as an input device primarily used with video
games, training simulators and controlling robots.

27
Lecturer By: Biran Limbu, CODES Computer Consultant, Dharan, Nepal. Email:codes@[Link]

Scanner
Scanner is an input device used for direct data entry from the source document into the computer system. It converts the
document image into digital form so that it can be fed into the computer. Capturing information like this reduces the
possibility of errors typically experienced during large data entry. Hand‐held scanners are commonly seen in big stores to
scan codes and price information for each of the items. They are also termed the bar code readers.

Bar codes
A bar code is a set of lines of different thicknesses that represent a number. Bar Code Readers are used to input data from
bar codes. Most products in shops have bar codes on them. Bar code readers work by shining a beam of light on the lines
that make up the bar code and detecting the amount of light that is reflected back.

Light Pen
It is a pen shaped device used to select objects on a display screen. It is quite like the mouse (in its functionality) but uses a
light pen to move the pointer and select any object on the screen by pointing to the object. Users of Computer Aided
Design (CAD) applications commonly use the light pens to directly draw on screen.

Touch Screen
It allows the user to operate/make selections by simply touching the display screen. Common examples of touch screen
include information kiosks, and bank ATMs.

Digital camera
A digital camera can store many more pictures than an ordinary camera. Pictures taken using a digital camera are stored
inside its memory and can be transferred to a computer by connecting the camera to it. A digital camera takes pictures by
converting the light passing through the lens at the front into a digital image.

The Speech Input Device


The “Microphones ‐ Speech Recognition” is a speech Input device. To operate it we require using a microphone to talk to
the computer. Also we need to add a sound card to the computer. The Sound card digitizes audio input into 0/1s .A speech
recognition program can process the input and convert it into machine‐recognized commands or input.

OMR(Optical Mark Recognition)


Many traditional OMR (Optical Mark Recognition) devices work with a dedicated scanner device that shines a beam of
light onto the form paper. The contrasting reflectivity at predetermined positions on a page is then utilized to detect the
marked areas because they reflect less light than the blank areas of the paper. This device is designed to be able to read
markings that have been placed in specific places on a form or card.
The person filling out the form/card will either color in a series of small squares or perhaps make a cross within the square.
The device then scans the card and senses where marks have been placed.
In contrast to the dedicated OMR device, desktop OMR software allows a user to create their own forms in a word
processor and print them on a laser printer. The OMR software then works with a common desktop image scanner with a
document feeder to process the forms once filled out.

28
Lecturer By: Biran Limbu, CODES Computer Consultant, Dharan, Nepal. Email:codes@[Link]

OCR(Optical character recognition)


Optical character recognition, usually abbreviated to OCR, is the mechanical or electronic translation of scanned images of
handwritten, typewritten or printed text into machine‐encoded text. It is widely used to convert books and documents
into electronic files, to computerize a record‐keeping system in an office, or to publish the text on a website. OCR makes it
possible to edit the text, search for a word or phrase, store it more compactly, display or print a copy free of scanning
artifacts, and apply techniques such as machine translation, text‐to‐speechand text mining to it. OCR is a field of research
in pattern recognition, artificial intelligence and computer vision.
OCR systems require calibration to read a specific font; early versions needed to be programmed with images of each
character, and worked on one font at a time. "Intelligent" systems with a high degree of recognition accuracy for most
fonts are now common. Some systems are capable of reproducing formatted output that closely approximates the original
scanned page including images, columns and other non‐textual components.

BCR(bar code reader)


A barcode reader (or barcode scanner) is an electronic device for reading printed barcodes. Like a flatbed scanner, it
consists of a light source, a lens and a light sensor translating optical impulses into electrical ones. Additionally, nearly all
barcode readers contain decoder circuitry analyzing the barcode's image data provided by the sensor and sending the
barcode's content to the scanner's output port.

Output devices
An output device is any piece of computer hardware equipment used to communicate the results of data
processing carried out by an information processing system (such as a computer) to the outside world. In
computing, input/output, or I/O, refers to the communication between an information processing system (such as
a computer), and the outside world. Inputs are the signals or data sent to the system, and outputs are the signals or data
sent by the system to the outside.

Monitor
A monitor or display (also called screen or visual display unit) is an electronic visual display for computers. The monitor
comprises the display device, circuitry, and an enclosure. The display device in modern monitors is typically a thin film
transistor liquid crystal display (TFT‐LCD) thin panel, while older monitors use a cathode ray tube about as deep as the
screen size.
Different image techniques have been used for Computer monitors. Until the 21st century most monitors were CRT but
they have been phased out for LCD monitors.
• Cathode ray tube
The traditional output device of a personal computer has been the CRT (Cathode Ray Tube) monitor. Just like a television
set (an older one, anyway) the CRT monitor contains a large cathode ray tube that uses an electron beam of varying
strength to “paint” a picture onto the color phosphorescent dots on the inside of the screen. CRT monitors are heavy and
use more electrical power than flat panel displays, but they are preferred by some graphic artists for their accurate color
rendition, and preferred by some gamers for faster response to rapidly changing graphics.
Monitor screen size is measured diagonally across the screen, in inches. Not all of the screen area may be usable for image
display, so the viewable area is also specified. The resolution of the monitor is the maximum number of pixels it can
display horizontally and vertically (such as 800 x 600, or 1024 x 768, or 1600 x 1200). Most monitors can display several
resolutions below its maximum setting. Pixels (short for picture elements) are the small dots that make of the image
displayed on the screen. The spacing of the screen’s tiny phosphor dots is called the dot pitch (dp), typically .28 or .26
(measured in millimeters). A screen with a smaller dot pitch produces sharper images.

29
Lecturer By: Biran Limbu, CODES Computer Consultant, Dharan, Nepal. Email:codes@[Link]

• Flat panel display


A flat panel display usually uses an LCD (Liquid Crystal Display) screen to display output from the
computer. The LCD consists of several thin layers that polarize the light passing through them. The
polarization of one layer, containing long thin molecules called liquid crystals, can be controlled
electronically at each pixel, blocking varying amounts of the light to make a pixel lighter or darker. Other
types of flat panel technology exist (such as plasma displays) but LCDs are most commonly used in
computers, especially laptops.

Printer
Printers are used to produce paper (commonly known as hardcopy) output. Based on the technology used, they can be
classified as Impact or Non‐impact printers.
Impact printers
Impact printers use the typewriting printing mechanism wherein a hammer strikes the paper through a ribbon in order to
produce output. Dot‐matrix and Character printers fall under this category.
Non‐impact printers
Non‐impact printers do not touch the paper while printing. They use chemical, heat or electrical signals to etch the
symbols on paper. Inkjet, Deskjet, Laser, Thermal printers fall under this category of printers.

When we talk about printers we refer to two basic qualities associated with printers:
resolution, and speed. Print resolution is measured in terms of number of dots per inch (dpi). Print speed is measured in
terms of number of characters printed in a unit of time and is represented as characters‐per‐second (cps), lines‐per‐
minute (lpm), or pages‐per‐minute (ppm).

Plotter
Plotters are used to print graphical output on paper. It interprets computer commands and makes line drawings on paper
using multicolored automated pens. It is capable of producing graphs, drawings, charts, maps etc. Computer Aided
Engineering (CAE) applications like CAD (Computer Aided Design) and CAM (Computer Aided Manufacturing) are typical
usage areas for plotters.

Audio Output: Sound Cards and Speakers:


The Audio output is the ability of the computer to output sound. Two components are needed: Sound card – Plays
contents of digitized recordings, Speakers – Attached to sound card.
Computer Peripherals
A peripheral is a device attached to a host computer, but not part of it, and is more or less dependent on the host. It
expands the host's capabilities, but does not form part of the core computer architecture.
Examples are computer printers, image scanners, tape drives, microphones, loudspeakers, webcams, and digital cameras
etc.

30
Lecturer By: Biran Limbu, CODES Computer Consultant, Dharan, Nepal. Email:codes@[Link]

Computer I/O interface

An I/O interface is required whenever the I/O device is driven by the processor. The interface must have necessary logic to
interpret the device address generated by the processor. Handshaking should be implemented by the interface using
appropriate commands (like BUSY, READY, and WAIT), and the processor can communicate with an I/O device through the
interface. If different data formats are being exchanged, the interface must be able to convert serial data to parallel form
and vice‐versa. There must be provision for generating interrupts and the corresponding type numbers for further
processing by the processor if required.

Parallel Port
A parallel port is a type of interface found on computers (personal and otherwise) for connecting various peripherals.
In computing, a parallel port is a parallel communication physical interface. It is also known as a printer port. The IEEE
1284 standard defines the bi‐directional version of the port, which allows the transmission and reception of data bits at
the same time.

31
Leccturer By: Biraan Limbu, COD
DES Computerr Consultant, Dharan,
D Nepal. Email:codes@
@[Link]

Seriial port
In co
omputing, a serial
s port is a serial comm
munication ph hysical interfaace through which
w informaation transferrs in or out
one bit at a time (in contrast to
t a parallel port).[1]
p Thro
oughout mostt of the historry of personall computers, data transferr
thro
ough serial poorts connecte ed the computer to devicess such as term minals and vaarious peripheerals.
Whiile such interffaces as Ethernet, FireWire, and USB all send data as a serial streeam, the termm "serial port"" usually
idenntifies hardwaare more or less compliant to the RS‐23 32 standard, intended to interface with h a modem orr with a similaar
commmunication device.
d

USB B Ports
Univversal Serial Bus
B (USB) wass designed to o standardize the connection of computter peripheraals, such as keeyboards,
poin
nting devices,, digital came eras, printers, portable meedia players, disk
d drives and network ad dapters to perrsonal
mputers, both to communicate and to supply electricc power. It haas become co
com ommonplace on o other deviices, such
as smart phones,, PDAs and video game consoles. USB has h effectivelyy replaced a variety
v of earrlier interfaces, such
as serial and paraallel ports, ass well as separate power chhargers for po
ortable devicces.

IEEEE 1394
The IEEE 1394 intterface, deve
eloped in late 1980s and eaarly 1990s byy Apple as FireeWire, is a serial bus interfface
stan
ndard for high
h‐speed comm munications and
a isochrono ous real‐timee data transfer. The 1394 in nterface is co
omparable
with
h USB and oftten those twoo technologiees are consideered togetherr, though USBB had won thee popularity contest.
c

I/O Bus Slots


All motherboard
m s have one orr more systemm I/O buses that are used to expand the computer'ss capabilities. The slots in tthe
hine are wherre expansion cards are placed (like your video card, sound card, network
backk of the mach n card, etc.). These
slots allow expan
nding the capabilities of yo
our machine in i many different ways, an nd the proliferation of both general
purp pansion cards is part of thee success storry of the PC platform.
pose and veryy specific exp

Specification off PC
In co
omputer science, a formal specification n is a mathemmatical description of softwware or hardwware that may be used to
develop an impleementation. It describes what w the systeem should do, not (necessarily) how thee system should do it. Giveen
suchh a specificatiion, it is possible to use formal verificattion techniquues to demonstrate that a candidate sysstem design is
corrrect with resp
pect to the sp pecification. This
T has the ad dvantage that incorrect caandidate systeem designs caan be revised
d
befoore a major innvestment haas been madee in actually im mplementing the design. AnA alternativee approach is to use provaably
corrrect refinemeent steps to trransform a sp pecification innto a design, and
a ultimatelly into an actuual implemen ntation, that iis
corrrect by constrruction.

Computer Sooftware and Classificatioon

Commputer softwaare, or just so


oftware, is a collection
c of computer
c pro
ograms and reelated data thhat provide thhe instruction
ns
for telling
t a comp
puter what too do and how w to do it. In other
o words, software
s is a conceptual entity which iss a set of

32
Lecturer By: Biran Limbu, CODES Computer Consultant, Dharan, Nepal. Email:codes@[Link]

computer programs, procedures, and associated documentation concerned with the operation of a data processing
system. We can also say software refers to one or more computer programs and data held in the storage of the computer
for some purposes. In other words software is a set of programs, procedures, algorithms and its documentation.
Program software performs the function of the program it implements, either by directly providing instructions to the
computer hardware or by serving as input to another piece of software. In contrast to hardware, software "cannot be
touched".
Types of software
ƒ Application software
ƒ Middleware
ƒ Programming languages
ƒ System software
ƒ Firmware
ƒ Computer Virus
ƒ Antivirus

Application software
Application software, also known as an application or an "app", is computer software designed to help the user to perform
specific tasks. Examples include enterprise software, accounting software, office suites, graphics software and media
players. Many application programs deal principally with documents. Apps may be bundled with the computer and its
system software, or may be published separately. Some users are satisfied with the bundled apps and need never install
one.

Middleware
Middleware is computer software components or people and their applications. The software consists of a set of services
that allows multiple processes running on one or more machines to interact. This technology evolved to provide
for interoperability in support of the move to coherent distributed architectures, which are most often used to support
and simplify complex distributed applications. It includes web servers, application servers, and similar tools that support
application development and delivery. Middleware is especially integral to modern information technology based
on XML, SOAP, Web services, and service‐oriented architecture.

Programming languages
A programming language is an artificial language designed to communicate instructions to a machine, particularly
a computer. Programming languages can be used to create programs that control the behavior of a machine and/or to
express algorithms precisely.

System software
System software is computer software designed to operate the computer hardware and to provide a platform for
running application software.
The most basic types of system software are:
Device drivers such as computer BIOS and device firmware, provides basic functionality to operate and control the
hardware connected to or built into the computer.
The operating system (prominent examples being Microsoft Windows, Mac OS X and Linux), which allows the parts of a
computer to work together by performing tasks like transferring data between memory and disks or rendering output
onto a display device. It also provides a platform to run high‐level system software and application software.

33
Lecturer By: Biran Limbu, CODES Computer Consultant, Dharan, Nepal. Email:codes@[Link]

Servers, in this context, are computer programs running to serve the requests of other programs, the "clients". The server
performs some computational task on behalf of clients which may run on either the same computer or on other
computers connected through a network.
Utility software, which helps to analyze, configure, optimize and maintain the computer.
Window systems are components of a graphical user interface (GUI), and more specifically of a desktop environment,
which supports the implementation of window managers, and provides basic support for graphics hardware, pointing
devices such as mice, and keyboards. The mouse cursor is also generally drawn by the windowing system.
In some publications, the term system software is also used to designate software development tools (like
a compiler, linker or debugger).

Firmware
In electronic systems and computing, firmware is a term often used to denote the fixed, usually rather small, programs
and/or data structures that internally control various electronic devices. Typical examples of devices containing firmware
range from end‐user products such as remote controls or calculators, through computer parts and devices like hard
disks, keyboards, TFT screens or memory cards, all the way to scientific instrumentation and industrial robotics. Also more
complex consumer devices, such as mobile phones, digital cameras, synthesizers, etc., contain firmware to enable the
device's basic operation as well as implementing higher‐level functions.

Computer Virus
A computer virus is a computer program that can replicate itself and spread from one computer to another. The term
"virus" is also commonly but erroneously used to refer to other types of malware, including but not limited
to adware and spyware programs that do not have the reproductive ability. A true virus can spread from one computer to
another (in some form of executable code) when its host is taken to the target computer; for instance because a user sent
it over a network or the Internet, or carried it on a removable medium such as a floppy disk, CD, DVD, or USB drive.
Viruses can increase their chances of spreading to other computers by infecting files on a network file system or a file
system that is accessed by another computer.
Types of Viruses
Not all computer viruses behave, replicate, or infect the same way. There are several different categories of viruses and
malware. Below I list and discuss some of the most common types of computer viruses.

Trojan horse:
A Trojan horse program has the appearance of having a useful and desired function. While it may advertise its activity
after launching, this information is not apparent to the user beforehand. Secretly the program performs other, undesired
functions. A Trojan horse neither replicates nor copies itself, but causes damage or compromises the security of the
computer. A Trojan horse must be sent by someone or carried by another program and may arrive in the form of a joke
program or software of some sort. The malicious functionality of a Trojan Horse may be anything undesirable for a
computer user, including data destruction or compromising a system by providing a means for another computer to gain
access, thus bypassing normal access controls.
Worms:
A worm is a program that makes and facilitates the distribution of copies of itself; for example, from one disk drive to
another, or by copying itself using email or another transport mechanism. The worm may do damage and compromise the
security of the computer. It may arrive via exploitation of system vulnerability or by clicking on an infected e‐mail.
Bootsector Virus:
A virus which attaches itself to the first part of the hard disk that is read by the computer upon bootup. These are normally
spread by floppy disks.
Macro Virus:
Macro viruses are viruses that use another application's macro programming language to distribute themselves. They
infect documents such as MS Word or MS Excel and are typically spread to other similar documents.
Memory Resident Viruses:
34
Lecturer By: Biran Limbu, CODES Computer Consultant, Dharan, Nepal. Email:codes@[Link]

Memory Resident Viruses reside in a computers volatile memory (RAM). They are initiated from a virus which runs on the
computer and they stay in memory after it's initiating program closes.
Rootkit Virus:
A rootkit virus is an undetectable virus which attempts to allow someone to gain control of a computer system. The term
rootkit comes from the linux administrator root user. These viruses are usually installed by Trojans and are normally
disguised as operating system files.

Polymorphic Viruses:
A polymorphic virus not only replicates itself by creating multiple files of itself, but it also changes it's digital signature
every time it replicates. This makes it difficult for less sophisticated antivirus software to detect.

Logic Bombs/Time Bombs:


These are viruses which are programmed to initiate at a specific date or when a specific event occurs. Some examples are
a virus which deletes your photos on Halloween, or a virus which deletes a database table if a certain employee gets fired.

Anti-virus
Anti‐virus software that can detect and eliminate known viruses after the computer downloads or runs the executable.
There are two common methods that an anti‐virus software application uses to detect viruses. The first, and by far the
most common method of virus detection is using a list of virus signature definitions. This works by examining the content
of the computer's memory (its RAM, and boot sectors) and the files stored on fixed or removable drives (hard drives,
floppy drives), and comparing those files against a database of known virus "signatures". The disadvantage of this
detection method is that users are only protected from viruses that pre‐date their last virus definition update. The second
method is to use a heuristic algorithm to find viruses based on common behaviors. This method has the ability to detect
novel viruses that anti‐virus security firms have yet to create a signature for.

Number Systems
There are infinite ways to represent a number. The four commonly associated with modern computers and digital
electronics are: decimal, binary, octal, and hexadecimal.
Decimal (base 10) is the way most human beings represent numbers. Decimal is sometimes abbreviated as dec.
Decimal counting goes: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, and so on.
Binary (base 2) is the natural way most digital circuits represent and manipulate numbers. (Common misspellings are
"bianary", "bienary", or "binery".) Binary numbers are sometimes represented by preceding the value with '0b', as in
0b1011. Binary is sometimes abbreviated as bin.
Binary counting goes: 0, 1, 10, 11, 100, 101, 110, 111, 1000, 1001, 1010, 1011, 1100, 1101, 1110, 1111, 10000, 10001, and
so on.
Octal (base 8) was previously a popular choice for representing digital circuit numbers in a form that is more compact
than binary. Octal is sometimes abbreviated as oct.
Octal counting goes: 0, 1, 2, 3, 4, 5, 6, 7, 10, 11, 12, 13, 14, 15, 16, 17, 20, 21, and so on.
Hexadecimal (base 16) is currently the most popular choice for representing digital circuit numbers in a form that is
more compact than binary. (Common misspellings are "hexdecimal", "hexidecimal", "hexedecimal", or "hexodecimal".)
Hexadecimal numbers are sometimes represented by preceding the value with '0x', as in 0x1B84. Hexadecimal is
sometimes abbreviated as hex.
Hexadecimal counting goes: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F, 10, 11, and so on.

35
Lecturer By: Biran Limbu, CODES Computer Consultant, Dharan, Nepal. Email:codes@[Link]

All four number systems are equally capable of representing any number. Furthermore, a number can be perfectly
converted between the various number systems without any loss of numeric value.
At first blush, it seems like using any number system other than human‐centric decimal is complicated and unnecessary.
However, since the job of electrical and software engineers is to work with digital circuits, engineers require number
systems that can best transfer information between the human world and the digital circuit world.
It turns out that the way in which a number is represented can make it easier for the engineer to perceive the meaning of
the number as it applies to a digital circuit. In other words, the appropriate number system can actually make things less
complicated.

Binary Number Conversion


The digits that all 4 numeral systems use are shown below:
Decimal Binary Hexadecimal Octal
0 0 0 0

1 1 1 1

2 10 2 2

3 11 3 3

4 100 4 4

5 101 5 5

6 110 6 6

7 111 7 7

8 1000 8 10

9 1001 9 11

10 1010 A 12

11 1011 B 13

12 1100 C 14

13 1101 D 15

14 1110 E 16

15 1111 F 17

16 10000 10 20

36
Lecturer By: Biran Limbu, CODES Computer Consultant, Dharan, Nepal. Email:codes@[Link]

Binary to Octal
An easy way to convert from binary to octal is to group binary digits into sets of three, starting with the least significant
(rightmost) digits.
Binary: 11100101 = 11 100 101
011 100 101 Pad the most significant digits with zeros if
necessary to complete a group of three.
Then, look up each group in a table:
Binary: 000 001 010 011 100 101 110 111
Octal: 0 1 2 3 4 5 6 7

Binary = 011 100 101


Octal = 3 4 5 = 345 oct

Binary to Hexadecimal
An equally easy way to convert from binary to hexadecimal is to group binary digits into sets of four, starting with the least
significant (rightmost) digits.
Binary: 11100101 = 1110 0101
Then, look up each group in a table:
Binary: 0000 0001 0010 0011 0100 0101 0110 0111
Hexadecimal: 0 1 2 3 4 5 6 7

Binary: 1000 1001 1010 1011 1100 1101 1110 1111


Hexadecimal: 8 9 A B C D E F

Binary = 1110 0101


Hexadecimal = E 5 = E5 hex

Binary to Decimal
101101,0010111(2)->Χ(10)
Index the digits of the number
150413120110
Multiply each digit
1 * 25 + 0 * 24 + 1 * 23 + 1 * 22 + 0 * 21 + 1 * 20
32 + 0 + 8 + 4 + 0 + 1 + 0 + 0 + = 45 (10)

Decimal Number Conversion


A repeated division and remainder algorithm can convert decimal to binary, octal, or hexadecimal.
1. Divide the decimal number by the desired target radix (2, 8, or 16).
2. Append the remainder as the next most significant digit.
3. Repeat until the decimal number has reached zero.
Decimal to Binary
Here is an example of using repeated division to convert 1792 decimal to binary:
Decimal Number Operation Quotient Remainder Binary
37
Lecturer By: Biran Limbu, CODES Computer Consultant, Dharan, Nepal. Email:codes@[Link]

Result
1792 ÷2= 896 0 0
896 ÷2= 448 0 00
448 ÷2= 224 0 000
224 ÷2= 112 0 0000
112 ÷2= 56 0 00000
56 ÷2= 28 0 000000
28 ÷2= 14 0 0000000
14 ÷2= 7 0 00000000
7 ÷2= 3 1 100000000
3 ÷2= 1 1 1100000000
1 ÷2= 0 1 11100000000
0 done.

Decimal to Octal
Here is an example of using repeated division to convert 1792 decimal to octal:

Octal
Decimal Number Operation Quotient Remainder
Result
1792 ÷8= 224 0 0
224 ÷8= 28 0 00
28 ÷8= 3 4 400
3 ÷8= 0 3 3400
0 done.

Decimal to Hexadecimal
Here is an example of using repeated division to convert 1792 decimal to hexadecimal:
Hexadecimal
Decimal Number Operation Quotient Remainder
Result
1792 ÷ 16 = 112 0 0
112 ÷ 16 = 7 0 00
7 ÷ 16 = 0 7 700
0 done.
The only addition to the algorithm when converting from decimal to hexadecimal is that a table must be used to obtain
the hexadecimal digit if the remainder is greater than decimal 9.
Decimal: 0 1 2 3 4 5 6 7
Hexadecimal: 0 1 2 3 4 5 6 7

Decimal: 8 9 10 11 12 13 14 15
Hexadecimal: 8 9 A B C D E F

The addition of letters can make for funny hexadecimal values. For example, 48879 decimal converted to hex is:

38
Lecturer By: Biran Limbu, CODES Computer Consultant, Dharan, Nepal. Email:codes@[Link]

Hexadecimal
Decimal Number Operation Quotient Remainder
Result
48879 ÷ 16 = 3054 15 F
3054 ÷ 16 = 190 14 EF
190 ÷ 16 = 11 14 EEF
11 ÷ 16 = 0 11 BEEF
0 done.

Octal Number Conversion

Octal to Binary
Converting from octal to binary is as easy as converting from binary to octal. Simply look up each octal digit to obtain the
equivalent group of three binary digits. (group of 3 digits)
Octal: 0 1 2 3 4 5 6 7
Binary: 000 001 010 011 100 101 110 111

Octal = 3 4 5
Binary = 011 100 101 = 011100101 binary

Octal to Hexadecimal
When converting from octal to hexadecimal, it is often easier to first convert the octal number into binary and then from
binary into hexadecimal. For example, to convert 345 octal into hex:
Octal = 3 4 5
Binary = 011 100 101 = 011100101 binary

Drop any leading zeros or pad with leading zeros to get groups of four binary digits (bits):
Binary 011100101 = 1110 0101
Then, look up the groups in a table to convert to hexadecimal digits. (group of 4 digits)
Binary: 0000 0001 0010 0011 0100 0101 0110 0111
Hexadecimal: 0 1 2 3 4 5 6 7

Binary: 1000 1001 1010 1011 1100 1101 1110 1111


Hexadecimal: 8 9 A B C D E F

Binary = 1110 0101


Hexadecimal = E 5 = E5 hex
Therefore, through a two‐step conversion process, octal 345 equals binary 011100101 equals hexadecimal E5.
Octal to Decimal
• Converting octal to decimal can be done with repeated division.
• Start the decimal result at 0.
• Remove the most significant octal digit (leftmost) and add it to the result.
• If all octal digits have been removed, you're done. Stop.
• Otherwise, multiply the result by 8.
• Go to step 2.

39
Lecturer By: Biran Limbu, CODES Computer Consultant, Dharan, Nepal. Email:codes@[Link]

Octal Digits Operation Decimal Result Operation Decimal Result


345 +3 3 ×8 24
45 +4 28 ×8 224
5 +5 299 done.
The conversion can also be performed in the conventional mathematical way, by showing each digit place as an increasing
power of 8.
345 octal = (3 * 82) + (4 * 81) + (5 * 80) = (3 * 64) + (4 * 8) + (5 * 1) = 229 decimal

Hexadecimal Number Conversion

Hexadecimal to Binary
Converting from hexadecimal to binary is as easy as converting from binary to hexadecimal. Simply look up each
hexadecimal digit to obtain the equivalent group of four binary digits.
Hexadecimal: 0 1 2 3 4 5 6 7
Binary: 0000 0001 0010 0011 0100 0101 0110 0111

Hexadecimal: 8 9 A B C D E F
Binary: 1000 1001 1010 1011 1100 1101 1110 1111

Hexadecimal = A 2 D E
Binary = 1010 0010 1101 1110 = 1010001011011110 binary

Hexadecimal to Octal
When converting from hexadecimal to octal, it is often easier to first convert the hexadecimal number into binary and
then from binary into octal. For example, to convert A2DE hex into octal:
(from the previous example)
Hexadecimal = A 2 D E
Binary = 1010 0010 1101 1110 = 1010001011011110 binary
Add leading zeros or remove leading zeros to group into sets of three binary digits.
Binary: 1010001011011110 = 001 010 001 011 011 110
Then, look up each group in a table:

Binary: 000 001 010 011 100 101 110 111


Octal: 0 1 2 3 4 5 6 7

Binary = 001 010 001 011 011 110


Octal = 1 2 1 3 3 6 = 121336 octal
Therefore, through a two‐step conversion process, hexadecimal A2DE equals binary 1010001011011110 equals octal
121336.

Hexadecimal to Decimal
Converting hexadecimal to decimal can be performed in the conventional mathematical way, by showing each digit place
as an increasing power of 16. Of course, hexadecimal letter values need to be converted to decimal values before
performing the math.

40
Lecturer By: Biran Limbu, CODES Computer Consultant, Dharan, Nepal. Email:codes@[Link]

Hexadecimal: 0 1 2 3 4 5 6 7
Decimal: 0 1 2 3 4 5 6 7
Hexadecimal: 8 9 A B C D E F
Decimal: 8 9 10 11 12 13 14 15

Convert: 2D (16)->Χ(10)
Index the digits of the number
Hexadecimal D is decimal 13
21130
We multiply each digit
2 * 161 + 13 * 160
32 + 13 = 45(10)

Calculation in Binary

Rules of Binary Addition


• 0 + 0 = 0
• 0 + 1 = 1
• 1 + 0 = 1
• 1 + 1 = 0, and carry 1 to the next more significant bit
For example,
00011010 + 00001100 = 00100110 1 1 carries
0 0 0 1 1 0 1 0 = 26(base 10)
+ 0 0 0 0 1 1 0 0 = 12(base 10)

0 0 1 0 0 1 1 0 = 38(base 10)

00010011 + 00111110 = 01010001 1 1 1 1 1 carries

0 0 0 1 0 0 1 1 = 19(base 10)
+ 0 0 1 1 1 1 1 0 = 62(base 10)

0 1 0 1 0 0 0 1 = 81(base 10)
Rules of Binary Subtraction

• 0 - 0 = 0
• 0 - 1 = 1, and borrow 1 from the next more significant bit
• 1 - 0 = 1
• 1 - 1 = 0
41
Lecturer By: Biran Limbu, CODES Computer Consultant, Dharan, Nepal. Email:codes@[Link]

For example,
00100101 - 00010001 = 00010100 0 borrows
0 0 1 10 0 1 0 1 = 37(base 10)
- 0 0 0 1 0 0 0 1 = 17(base 10)

0 0 0 1 0 1 0 0 = 20(base 10)

00110011 - 00010110 = 00011101 0 10 1 borrows


1
0 0 1 1 0 0 1 1 = 51(base 10)
- 0 0 0 1 0 1 1 0 = 22(base 10)

0 0 0 1 1 1 0 1 = 29(base 10)

Rules of Binary Multiplication

• 0 x 0 = 0
• 0 x 1 = 0
• 1 x 0 = 0
• 1 x 1 = 1, and no carry or borrow bits

For example,
00101001 × 00000110 = 11110110 0 0 1 0 1 0 0 1 = 41(base 10)
× 0 0 0 0 0 1 1 0 = 6(base 10)

0 0 0 0 0 0 0 0
0 0 1 0 1 0 0 1
0 0 1 0 1 0 0 1

0 0 1 1 1 1 0 1 1 0 = 246(base 10)

00010111 × 00000011 = 01000101 0 0 0 1 0 1 1 1 = 23(base 10)


× 0 0 0 0 0 0 1 1 = 3(base 10)

1 1 1 1 1 carries
0 0 0 1 0 1 1 1
0 0 0 1 0 1 1 1

0 0 1 0 0 0 1 0 1 = 69(base 10)

42
Lecturer By: Biran Limbu, CODES Computer Consultant, Dharan, Nepal. Email:codes@[Link]

Binary Division
Binary division is the repeated process of subtraction, just as in decimal division.
10)11(1
10
‐‐‐‐‐‐‐‐‐‐
1

Complements Methods
In mathematics and computing, the method of complements is a technique used to subtract one number from another
using only addition of positive numbers. This method was commonly used in mechanical calculators and is still used in
modern computers.
Complements are used in digital computers for simplifying the subtraction operation and for logical manipulation. There
are two types of complements for each base r system: the r’s complement and the (r‐1)’s complement. When the value of
the base r is substituted in the name, the two‐types are referred to as the 2’s and 1’s complement for binary numbers and
the 10’s and 9’s complement for decimal numbers.

One’s Complement Methods(Binary subtraction)

Let's consider how we would solve our problem of subtracting 110 from 710 using 1's complement.
1. First, we need to convert 00012 to its negative equivalent in 1's
0111 (7)
complement. - 0001 - (1)

2. To do this we change all the 1's to 0's and 0's to 1's. Notice that the
most-significant digit is now 1 since the number is negative. 0001 -> 1110

3. Next, we add the negative value we computed to 01112. This gives us 0111 (7)
a result of 101012. + 1110 +(-1)
10101 (?)
4. Notice that our addition caused an overflow bit. Whenever we have
an overflow bit in 1's complement, we add this bit to our sum to get 0101
the correct answer. If there is no overflow bit, then we leave the sum + 1
as it is. 0110 (6)

0111 (7)
5. This gives us a final answer of 01102 (or 610). - 0001 - (1)
0110 (6)

Now let's look at an example where our problem does not generate an overflow bit. We will subtract
710 from 110 using 1's complement.

43
Lecturer By: Biran Limbu, CODES Computer Consultant, Dharan, Nepal. Email:codes@[Link]

1. First, we state our problem in binary. 0001 (1)


- 0111 - (7)
2. Next, we convert 01112 to its negative equivalent and add this to 0001 (1)
00012. + 1000 +(-7)
1001 (?)
3. This time our results does not cause an overflow, so we do not need
to adjust the sum. Notice that our final answer is a negative number
0001 (1)
since it begins with a 1. Remember that our answer is in 1's
+ 1000 +(-7)
complement notation so the correct decimal value for our answer is - 1001 (-6)
610 and not 910.

Two’s Complement Methods(Binary subtraction)


Now let's consider how we would solve our problem of subtracting 110 from 710 using 2's
complement.
1. First, we need to convert 00012 to its negative equivalent in 2's
0111 (7)
complement. - 0001 - (1)

2. To do this we change all the 1's to 0's and 0's to 1's and add one to the
0001 -> 1110
number. Notice that the most-significant digit is now 1 since the
1
number is negative. 1111

3. Next, we add the negative value we computed to 01112. This gives us 0111 (7)
a result of 101102. + 1111 +(-1)
10110 (?)
4. Notice that our addition caused an overflow bit. Whenever we have
0111 (7)
an overflow bit in 2's complement, we discard the extra bit. This - 0001 - (1)
gives us a final answer of 01102 (or 610). 0110 (6)

Nine’s Complement Methods (Decimal Subtraction)


The 9's complement of a decimal number is found by subtracting each digit in the number from 9.
In 9's complement subtraction when 9's complement of smaller number is added to the larger number carry is generated.
It is necessary to add this carry to the result. When larger number is subtracted from smaller one, there is no carry and the
result is in 9's complement form and negative.
Subtract (normal):
8
‐2
=====
First step: complement to the lower number: 9‐2 =7
Second step: add upper number and complemented number: 8+7=1 5 (here, 1 is over flow bit and answer is positive)
Third step: carry out the overflow bit and add it to remaining number.

44
Lecturer By: Biran Limbu, CODES Computer Consultant, Dharan, Nepal. Email:codes@[Link]

Subtract (Negative value):


4
‐8
=====
First step: complement to the lower number: 9‐8 =1
Second step: add upper number and complemented number: 4+1= 5 (No overflow bit, its mean answer is negative)
Third step: complement the result: 9‐5=4, so answer is ‐4.

More Examples:

45
Lecturer By: Biran Limbu, CODES Computer Consultant, Dharan, Nepal. Email:codes@[Link]

Ten’s Complement Methods (Decimal Subtraction)

The 10's complement of a decimal number is equal to the 9's complement plus 1. The 10's complement can be used to
perform subtraction by adding the minuend to the 10's complement of the subtrahend and dropping the carry.

Subtract (normal):
8
‐2
=====
First step: complement to the lower number: 10‐2 =8
Second step: add upper number and complemented number: 8+8=1 6 (here, 1 is over flow bit and answer is positive)
Third step: Ignore the overflow bit and remaining number is the answer.

Subtract (Negative value):


4
‐8
=====
First step: complement to the lower number: 10‐8 =2
Second step: add upper number and complemented number: 4+2=6 (No overflow bit, its mean answer is negative)
Third step: complement the result: 10‐6=4, so answer is ‐4.

46
Lecturer By: Biran Limbu, CODES Computer Consultant, Dharan, Nepal. Email:codes@[Link]

More Examples:

Codes: Absolute Binary, BCD, ASCII ,EBCDIC, Unicode


A code is a rule for converting a piece of information (for example, a letter, word, phrase, or gesture) into another form or
representation (one sign into another sign), not necessarily of the same type. Probably the most widely known data
communications code so far in use today is ASCII. In one or another (somewhat compatible) version, it is used by nearly all
personal computers, terminals, printers, and other communication equipment. It represents 128 characters with seven‐bit
binary numbers—that is, as a string of seven 1s and 0s. In ASCII a lowercase "a" is always 1100001, an uppercase "A"
always 1000001, and so on. There are many other encodings, which represent each character by a byte (usually referred
as code pages), Binary Code, ASCII Code, BCD Code, EBCDIC Code, Unicode.
Binary Code
A binary code is a way of representing text or computer processor instructions by the use of the binary number system's
two‐binary digits 0 and 1. This is accomplished by assigning a bit string to each particular symbol or instruction. For
example, a binary string of eight binary digits (bits) can represent any of 256 possible values and can therefore correspond
to a variety of different symbols, letters or instructions.
In computing and telecommunication, binary codes are used for any of a variety of methods of encoding data, such as
character strings, into bit strings. Those methods may be fixed‐width or variable‐width. In a fixed‐width binary code, each
letter, digit, or other character, is represented by a bit string of the same length; that bit string, interpreted as a binary
number, is usually displayed in code tables in octal, decimal or hexadecimal notation. There are many character sets and
many character encodings for them.
A bit string, interpreted as a binary number, can be translated into a decimal number. For example, the lowercase "a" as
represented by the bit string 01100001, can also be represented as the decimal number 97.
For Example:
Hi = 1001000 1101001 (ASCII codes H=72 and i=105 decimal)

47
Lecturer By: Biran Limbu, CODES Computer Consultant, Dharan, Nepal. Email:codes@[Link]

ASCII Code
The American Standard Code for Information Interchange (ASCII) is a character‐encoding scheme originally based on the
English alphabet. ASCII codes represent text in computers, communications equipment, and other devices that use text.
Most modern character‐encoding schemes are based on ASCII, though they support many more characters than ASCII
does. The standard ASCII character set uses just 7 bits for each character. There are several larger character sets that use 8
bits, which gives them 128 additional characters. The extra characters are used to represent non‐English characters,
graphics symbols, and mathematical symbols. Several companies and organizations have proposed extensions for these
128 characters. The DOS operating system uses a superset of ASCII called extended ASCII or high ASCII.
CHAR DEC CHAR DEC CHAR DEC CHAR DEC
[NUL] 0 32 @ 64 ` 96
[SOH] 1 ! 33 A 65 a 97
[STX] 2 " 34 B 66 b 98
[ETX] 3 # 35 C 67 c 99
[EOT] 4 $ 36 D 68 d 100
[ENQ] 5 % 37 E 69 e 101
[ACK] 6 & 38 F 70 f 102
[BEL] 7 ' 39 G 71 g 103
[BS] 8 ( 40 H 72 h 104
[HT] 9 ) 41 I 73 i 105
[LF] 10 * 42 J 74 j 106
[VT] 11 + 43 K 75 k 107
[FF] 12 , 44 L 76 l 108
[CR] 13 - 45 M 77 m 109
[SO] 14 . 46 N 78 n 110
[SI] 15 / 47 O 79 o 111
[DLE] 16 0 48 P 80 p 112
[DC1] 17 1 49 Q 81 q 113
[DC2] 18 2 50 R 82 r 114
[DC3] 19 3 51 S 83 s 115
[DC4] 20 4 52 T 84 t 116
[NAK] 21 5 53 U 85 u 117
[SYN] 22 6 54 V 86 v 118
[ETB] 23 7 55 W 87 w 119
[CAN] 24 8 56 X 88 x 120
[EM] 25 9 57 Y 89 y 121
[SUB] 26 : 58 Z 90 z 122
[ESC] 27 ; 59 [ 91 { 123
[FS] 28 < 60 \ 92 | 124
[GS] 29 = 61 ] 93 } 125
[RS] 30 > 62 ^ 94 ~ 126
[US] 31 ? 63 _ 95 [DEL] 127

48
Lecturer By: Biran Limbu, CODES Computer Consultant, Dharan, Nepal. Email:codes@[Link]

Binary‐coded decimal
Binary‐coded decimal (BCD) is a digital encoding method for numbers using decimal notation, with each decimal digit
represented by its own binary sequence. In BCD, a numeral is usually represented by four bits which, in general, represent
the decimal range 0 through 9. Other bit patterns are sometimes used for a sign or for other indications (e.g., error or
overflow). Uncompressed (or zoned) BCD consumes a byte for each represented numeral, whereas compressed (or
packed) BCD typically carries two numerals in a single byte by taking advantage of the fact that four bits will represent the
full numeral range.
BCD's main virtue is ease of conversion between machine‐ and human‐readable formats, as well as a more precise
machine‐format representation of decimal quantities. As compared to typical binary formats, BCD's principal drawbacks
are a small increase in the complexity of the circuits needed to implement basic mathematical operations and less efficient
usage of storage facilities.
BCD takes advantage of the fact that any one decimal numeral can be represented by a four bit pattern:
Decimal: 0 1 2 3 4 5 6 7 8 9
Binary : 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001
It is possible to perform addition in BCD by first adding in binary, and then converting to BCD afterwards.
1001 + 1000 = 10001 = 0001 0001
9 + 8 = 17 = 1 1

EBCDIC Code
EBCDIC (Extended Binary Coded Decimal Interchange Code ) is a binary code for alphabetic and numeric characters that
IBM developed for its larger operating systems. It is the code for text files that is used in IBM's OS/390 operating system
for its S/390 servers and that thousands of corporations use for their legacy applications and databases. In an EBCDIC file,
each alphabetic or numeric character is represented with an 8‐bit binary number (a string of eight 0's or 1's). 256 possible
characters (letters of the alphabet, numerals, and special characters) are defined.
Dec Hex Char
129 81 a
130 82 b
131 83 c
132 84 d
133 85 e
134 86 f
135 87 g
136 88 h
137 89 i
: :
145 91 j
146 92 k
147 93 l
148 94 m
149 95 n
150 96 o
151 97 p
152 98 q
153 99 r
: :
162 A2 s
163 A3 t
164 A4 u

49
Lecturer By: Biran Limbu, CODES Computer Consultant, Dharan, Nepal. Email:codes@[Link]

165 A5 v
166 A6 w
167 A7 x
168 A8 y
169 A9 z
Dec Hex Char
193 C1 A
194 C2 B
195 C3 C
196 C4 D
197 C5 E
198 C6 F
199 C7 G
200 C8 H
201 C9 I
: :
209 D1 J
210 D2 K
211 D3 L
212 D4 M
213 D5 N
214 D6 O
215 D7 P
216 D8 Q
217 D9 R
: :
226 E2 S
227 E3 T
228 E4 U
229 E5 V
230 E6 W
231 E7 X
232 E8 Y
233 E9 Z
240 F0 0
241 F1 1
242 F2 2
243 F3 3
244 F4 4
245 F5 5
246 F6 6
247 F7 7
248 F8 8
249 F9 9

50
Lecturer By: Biran Limbu, CODES Computer Consultant, Dharan, Nepal. Email:codes@[Link]

Unicode
Fundamentally, computers just deal with numbers. They store letters and other characters by assigning a number for each
one. Before Unicode was invented, there were hundreds of different encoding systems for assigning these numbers. No
single encoding could contain enough characters: for example, the European Union alone requires several different
encodings to cover all its languages. Even for a single language like English no single encoding was adequate for all the
letters, punctuation, and technical symbols in common use.
These encoding systems also conflict with one another. That is, two encodings can use the same number for two different
characters, or use different numbers for the same character. Any given computer (especially servers) needs to support
many different encodings; yet whenever data is passed between different encodings or platforms, that data always runs
the risk of corruption.

Unicode Table
00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F

0020 ! " # $ % & ' ( ) * + , ‐ . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ? Number

0040 @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z [ \ ] ^ _ Alphabet

0060 ` a b c d e f g h i j k l m n o p q r s t u v w x y z { | } ~

Logic Function and Boolean Algebra

Boolean algebra
The English mathematician George Boole (1815‐1864) sought to give symbolic form to Aristotle's system of logic. Boole
wrote a treatise on the subject in 1854, titled An Investigation of the Laws of Thought, on Which Are Founded the
Mathematical Theories of Logic and Probabilities, which codified several rules of relationship between mathematical
quantities limited to one of two possible values: true or false, 1 or 0. His mathematical system became known
as Boolean algebra.
All arithmetic operations performed with Boolean quantities have but one of two possible outcomes: either 1 or 0. There
is no such thing as "2" or "‐1" or "1/2" in the Boolean world. It is a world in which all other possibilities are invalid by fiat.
As one might guess, this is not the kind of math you want to use when balancing a checkbook or calculating current
through a resistor. However, Claude Shannon of MIT fame recognized how Boolean algebra could be applied to on‐and‐off
circuits, where all signals are characterized as either "high" (1) or "low" (0). His 1938 thesis, titled A Symbolic Analysis of
Relay and Switching Circuits, put Boole's theoretical work to use in a way Boole never could have imagined, giving us a
powerful mathematical tool for designing and analyzing digital circuits.

51
Leccturer By: Biraan Limbu, COD
DES Computerr Consultant, Dharan,
D Nepal. Email:codes@
@[Link]

Booolean arithmeetic
Let us begin our exploration of
o Boolean alggebra by addiing numbers together:

The first three su ums make perrfect sense too anyone fammiliar with elemmentary addiition. The lastt sum, though h, is quite
posssibly responsible for more e confusion th
han any otherr single statem
ment in digitaal electronics,, because it seeems to run
conttrary to the basic
b principle matics. Well, itt does contradict principlees of addition for real numbers, but nott for
es of mathem
Boo olean numberrs. Rememberr that in the world
w of Boolean algebra, there are onlly two possible values for any a quantity and
for any
a arithmetiic operation: 1 or 0. Theree is no such thhing as "2" within the scop pe of Boolean values. Sincee the sum "1 + 1"
certtainly isn't 0, it must be 1 by
b process of elimination.
oes not matteer how many or few termss we add togeether, either. Consider thee following sums:
It do

Mulltiplication is valid in Boole a thankfully it is the sam


ean algebra, and me as in real‐n
number algeb
bra: anything multiplied byy 0
b 1 remains unchanged:
is 0,, and anythingg multiplied by

Likee "normal" alggebra, Booleaan algebra usees alphabeticcal letters to denote


d variabbles. Unlike "n
normal" algeb bra, though,
Booolean variablees are always CAPITAL letteers, never lowwer‐case. Beccause they aree allowed to possess
p only one of two
posssible values, either
e 1 or 0, each and eveery variable has
h a complem ment: the oppposite of its value.
v For example, if variaable
"A" has a value of
o 0, then the complementt of A has a vaalue of 1. Boo olean notationn uses a bar above
a the varriable charactter
to denote
d complementation, like this:

Boo
olean algebraic laws

52
Lecturer By: Biran Limbu, CODES Computer Consultant, Dharan, Nepal. Email:codes@[Link]

Logic Gates
A logic gate is an elementary building block of a digital circuit . Most logic gates have two inputs and one output. At any
given moment, every terminal is in one of the two binary conditions low (0) or high (1), represented by different voltage
levels. The logic state of a terminal can, and generally does, change often, as the circuit processes data. In most logic gates,
the low state is approximately zero volts (0 V), while the high state is approximately five volts positive (+5 V).
X ^ Y, the logical AND operation, is replaced by x ∙ y, or xy.
X v Y, the logical OR operation, is replaced by x + y.
¬X, the logical NEGATION operation, is replaced by x’ or .
There are seven basic logic gates: AND, OR, XOR, NOT, NAND, NOR, and XNOR.

AND gate
The AND gate, which is composed of two or more inputs and a single output, performs logical multiplication. The standard
symbol for the AND gate is shown in Figure 1‐3 and its truth table listed in Table 1‐2. The logical operation of the AND gate
is such that the output is HIGH (1) when all the inputs are HIGH, otherwise it is LOW (0). The highlighted area represents
the function X=AB.

53
Lecturer By: Biran Limbu, CODES Computer Consultant, Dharan, Nepal. Email:codes@[Link]

Figure 1‐3 Standard Logic Symbol for AND gate

INPUT OUTPUT

A B

0 0 0

0 1 0

1 0 0

1 1 1
Table 1‐2 Truth table for AND gate

OR gate

The OR gate, which is composed of two or more inputs and a single output, performs logical addition. The standard symbol
for the OR gate is shown in Figure 1‐5 and its truth table listed in Table 1‐3. The logical operation of the OR gate is such
that the output is HIGH (1) when any of the inputs are HIGH, otherwise it is LOW (0).

Figure 1‐5 Standard Logic Symbol for OR gate

54
Lecturer By: Biran Limbu, CODES Computer Consultant, Dharan, Nepal. Email:codes@[Link]

INPUT OUTPUT

A B

0 0 0

0 1 1

1 0 1

1 1 1
Table 1‐3 Truth table for OR gate

NOT gate
The inverter (NOT circuit) performs a basic logic function called inversion or complementation. The purpose of the inverter
is to change one logic level (HIGH / LOW) to the opposite logic level. In terms of bits, it changes a ‘1’ to a ‘0’ and vice versa.
The standard logic symbol for the inverter and a Venn diagram illustrating the relationship between the variables and the
logic gate operation, are shown in Figure 1‐1.

Figure 1‐1 Standard Logic Symbol for Inverter


We generally express the logical operation of a gate with a truth table which lists all input combinations and the
corresponding outputs. The truth table for the NOT gate is shown in Table 1‐1.
INPUT OUTPUT

0 1

1 0
Table 1‐1Truth table for NOT gate

XOR ( exclusive‐OR ) gate


The XOR ( exclusive‐OR ) gate acts in the same way as the logical "either/or." The output is "true" if either, but not both, of
the inputs are "true." The output is "false" if both inputs are "false" or if both inputs are "true." Another way of looking at
this circuit is to observe that the output is 1 if the inputs are different, but 0 if the inputs are the same.

55
Lecturer By: Biran Limbu, CODES Computer Consultant, Dharan, Nepal. Email:codes@[Link]

XOR gate

INPUT XOR OUTPUT

A B

0 0 0

0 1 1

1 0 1

1 1 0

XNOR (exclusive‐NOR) gate


The XNOR (exclusive‐NOR) gate is a combination XOR gate followed by an inverter. Its output is "true" if the inputs are the
same and "false" if the inputs are different.

XNOR gate

XNOR
INPUT
OUTPUT

A B

0 0 1

0 1 0

1 0 0

1 1 1

56
Lecturer By: Biran Limbu, CODES Computer Consultant, Dharan, Nepal. Email:codes@[Link]

Universal Gates:
A universal gate is a gate which can implement any Boolean function without need to use any other gate type.
The NAND and NOR gates are universal gates.
In practice, this is advantageous since NAND and NOR gates are economical and easier to fabricate and are the basic gates
used in all IC digital logic families.
In fact, an AND gate is typically implemented as a NAND gate followed by an inverter not the other way around!!
Likewise, an OR gate is typically implemented as a NOR gate followed by an inverter not the other way around!!

NAND gate
The NAND, which is composed of two or more inputs and a single output, is a very popular logic element because it may
be used as a universal function. That is, it may be employed to construct an inverter, an AND gate, an OR gate, or any
combination of these functions. The term NAND is formed by the concatenation NOT‐AND and implies an AND function
with an inverted output. The standard symbol for the NAND gate is shown in Figure 1‐7 and its truth table listed in Table 1‐
4. The logical operation of the NAND gate is such that the output is LOW (0) only when all the inputs are HIGH (1).

Figure 1‐7 Standard logic symbol for NAND gate

INPUT OUTPUT

A B

0 0 1

0 1 1

1 0 1

1 1 0
Table 1‐4 Truth table for NAND gate

NOR gate
The NOR gate, which is composed of two or more inputs and a single output, also has a universal property. The term NOR
is formed by the concatenation NOT‐OR and implies an OR function with an inverted output. The standard symbol for the

57
Lecturer By: Biran Limbu, CODES Computer Consultant, Dharan, Nepal. Email:codes@[Link]

NOR gate is shown in Figure 1‐7 and its truth table listed in Table 1‐5. The logical operation of the NOR gate is such that
the output is HIGH (1) only when all the inputs are LOW.

Figure 1‐7 Standard logic symbol for NOR gate


INPUT OUTPUT

A B

0 0 1

0 1 0

1 0 0

1 1 0
Table 1‐5 Truth table for NOR gate

Duality Principle:
This property of Boolean algebra state that all binary expressions remain valid when following two steps are performed:
Step 1: Interchange OR and AND operators.
Step 2: Replace all 1’s by 0’s and 0’s by 1’s.

Boolean Boolean Expression Diagram Duality Duality Diagram


Expression
(a+b).c (a.b)+c
OR AND
OR
AND

58
Leccturer By: Biraan Limbu, COD
DES Computerr Consultant, Dharan,
D Nepal. Email:codes@
@[Link]

(a.b)+c (a++b).c
OR
AND
OR AND

Morgan's The
DeM eorems
A mathematicia
m an named DeeMorgan devveloped a paair of important rules reggarding grouup complemeentation in
Booolean algebraa. Logic gatees that inverrting all inpuuts to a gate reverses
r thatt gate's essenntial functionn from AND D to
ORR, or vice verrsa, and also inverts the output.
o So, an
a OR gate with
w all inputts inverted (aa Negative-O OR gate)
behhaves the sam
me as a NAN ND gate, andd an AND gaate with all innputs inverteed (a Negative-AND gatte) behaves tthe
sam
me as a NOR R gate. DeMo organ's theorrems state thhe same equiivalence in "backward" form: f that innverting the
n the same fuunction as thhe opposite type of gate (AND
outpput of any gaate results in ( vs. OR) with inveerted inputs:

A loong bar exteending over the


t term AB acts as a groouping symbbol, and as such is entireely different from the
prodduct of A annd B indepenndently inverrted. In other words, (AB B)' is not equual to A'B'. Because
B the "prime"
sym
mbol (') cannnot be stretch
hed over twoo variables like a bar cann, we are forcced to use paarentheses too make it appply
to thhe whole terrm AB in thee previous seentence. A bar,
b howeverr, acts as its owno groupinng symbol when w stretcheed
oveer more than one variablee. This has profound
p imppact on how Boolean exppressions are evaluated and reducedd, as
we shall see.

DeMMorgan's theeorem may be b thought of in terms off breaking a long bar symmbol. When a long bar is broken, thee
opeeration directtly underneaath the breakk changes froom addition to
t multiplicaation, or vicee versa, and the broken bbar
piecces remain over
o the indiv
vidual variabbles. To illusstrate:

59
Leccturer By: Biraan Limbu, COD
DES Computerr Consultant, Dharan,
D Nepal. Email:codes@
@[Link]

Whhen multiple "layers" of bars


b exist in an expressioon, you mayy only break one bar at a time, and itt is generallyy
easiier to begin simplificatio
s on by breakinng the longeest (uppermoost) bar first. To illustratee, let's take the
t expressioon
(A + (BC)')' andd reduce it using
u DeMorrgan's Theorems:

Folllowing the advice


a of breeaking the loongest (upperrmost) bar first,
fi I'll beginn by breakinng the bar coovering the
entiire expressioon as a first step:
s

As a result, the original circcuit is reduceed to a three-input AND


D gate with thhe A input innverted:

60
Lecturer By: Biran Limbu, CODES Computer Consultant, Dharan, Nepal. Email:codes@[Link]

Venn diagram and its represent of logic gates(AND, OR, NOT)

Inverter
The inverter (NOT circuit) performs a basic logic function called inversion or complementation. The purpose of
the inverter is to change one logic level (HIGH / LOW) to the opposite logic level. In terms of bits, it changes a
‘1’ to a ‘0’ and vice versa. The standard logic symbol for the inverter and a Venn diagram illustrating the
relationship between the variables and the logic gate operation, are shown in Figure 1-1 and Figure 1-2,
respectively.

Figure 1-1 Standard Logic Symbol for Inverter

Figure 1-2 Venn diagram illustrating inverter operation


We generally express the logical operation of a gate with a truth table which lists all input combinations and the
corresponding outputs. The truth table for the NOT gate is shown in Table 1-1.
INPUT OUTPUT

0 1

1 0
Table 1-1Truth table for NOT gate
Note: The total number of possible input combinations (N) is determined by the mathematical formula:
(1-1)
where n is the number of input variables.

The AND gate


The AND gate, which is composed of two or more inputs and a single output, performs logical multiplication.
The standard symbol for the AND gate is shown in Figure 1-3 and its truth table listed in Table 1-2. The logical
operation of the AND gate is such that the output is HIGH (1) when all the inputs are HIGH, otherwise it is LOW
61
Lecturer By: Biran Limbu, CODES Computer Consultant, Dharan, Nepal. Email:codes@[Link]

(0). The Venn diagram shown in Figure 1-4 provides an insight into the AND function. The highlighted area
represents the function X=AB.

Figure 1-3 Standard Logic Symbol for AND gate

Figure 1-4 Venn diagram illustrating AND operation

INPUT OUTPUT

A B

0 0 0

0 1 0

1 0 0

1 1 1
Table 1-2 Truth table for AND gate

The OR gate
The OR gate, which is composed of two or more inputs and a single output, performs logical addition. The
standard symbol for the OR gate is shown in Figure 1-5 and its truth table listed in Table 1-3. The logical
operation of the OR gate is such that the output is HIGH (1) when any of the inputs are HIGH, otherwise it is
LOW (0). The Venn diagram shown in Figure 1-6 provides an insight into the OR function. The highlighted area
represents the function X=A+B.

62
Lecturer By: Biran Limbu, CODES Computer Consultant, Dharan, Nepal. Email:codes@[Link]

Figure 1-5 Standard Logic Symbol for OR gate


INPUT OUTPUT

A B

0 0 0

0 1 1

1 0 1

1 1 1
Table 1-3 Truth table for OR gate

Figure 1-6 Venn diagram illustrating OR operation

63
Leccturer By: Biraan Limbu, COD
DES Computerr Consultant, Dharan,
D Nepal. Email:codes@
@[Link]

Operating Systtem

An operating syystem, or OS S, is a softwaare program that enabless the computter hardwaree to communnicate and
opeerate with thee computer software.
s Wiithout a com
mputer operatting system, a computer would be usseless.
Opeerating Systeems are resoource manageers. The maiin resource is i computer hardware
h in the form of processors,
storrage, input/ooutput devicees, communiication devicces, and dataa. Some of thhe operating system funcctions are:
impplementing thhe user interrface, sharingg hardware among
a userss, allowing users
u to sharee data amongg themselves,
prevventing userrs from interffering with one
o another, scheduling resources am mong users, facilitating input/output
i t,
recoovering fromm errors, accounting for resource
r usaage, facilitatiing parallel operations,
o o
organizing d for securre
data
andd rapid access, and handlling networkk communicaations.

Objectives of Operatin ng Systems


Modern Operating systems generally haave followinng three majoor goals. Operating systeems generallly accomplissh
thesse goals by running
r proccesses in low
w privilege annd providingg service callls that invokke the operatting system
kernnel in high-pprivilege statte.
• To hide details
d of harrdware by cre eating abstraction
An abstraction is softw ware that hid des lower leveel details and provides a seet of higher‐leevel functions. An operating
system transforms the physical wo orld of devicees, instruction a time into virtual world
ns, memory, and d that is the
result of abstractions built by the operating
o system. There are several reaasons for abstraction.
First, thee code needed d to control peripheral
p devvices is not sttandardized. Operating sysstems provide subroutiness
called deevice drivers that
t perform operations on o behalf of programs for example,
e inpu
ut/output opeerations.
Second, thet operatingg system intro oduces new functions as itt abstracts the hardware. For F instance, operating
system in ntroduces the e file abstracttion so that programs
p do not
n have to deeal with diskss.
Third, the operating system
s transfo
orms the com mputer hardw ware into multtiple virtual computers,
c eaach belongingg to
a different program. Each
E programm that is running is called a process. Eacch process vieews the hardw ware through h
the lens of abstraction.
Fourth, the
t operating system can enforce
e securrity through abstraction.
a

• To allocaate resourcess to processess (Manage re


esources)
An operaating system controls
c howw processes (the active ageents) may access resourcess (passive enttities).

• Provide a pleasant an nd effective user


u interface e
The userr interacts witth the operating systems through
t the user
u interface and usually interested
i in the “look and
d
feel” of the
t operatingg system. The most importtant componeents of the usser interface are
a the comm mand
64
Lecturer By: Biran Limbu, CODES Computer Consultant, Dharan, Nepal. Email:codes@[Link]

interpreter, the file system, on‐line help, and application integration. The recent trend has been toward
increasingly integrated graphical user interfaces that encompass the activities of multiple processes on networks
of computers.
One can view Operating Systems from two points of views: Resource manager and Extended machines. Form
Resource manager point of view Operating Systems manage the different parts of the system efficiently and from
extended machines point of view Operating Systems provide a virtual machine to users that is more convenient to
use. The structurally Operating Systems can be design as a monolithic system, a hierarchy of layers, a virtual
machine system, an exokernel, or using the client-server model. The basic concepts of Operating Systems are
processes, memory management, I/O management, the file systems, and security.

System Components
Even though, not all systems have the same structure many modern operating systems share the same goal of
supporting the following types of system components.

Process Management
The operating system manages many kinds of activities ranging from user programs to system programs like
printer spooler, name servers, file server etc. Each of these activities is encapsulated in a process. A process
includes the complete execution context (code, data, PC, registers, OS resources in use etc.).
It is important to note that a process is not a program. A process is only ONE instant of a program in execution.
There are many processes can be running the same program. The five major activities of an operating system in
regard to process management are
• Creation and deletion of user and system processes.
• Suspension and resumption of processes.
• A mechanism for process synchronization.
• A mechanism for process communication.
• A mechanism for deadlock handling.
Main-Memory Management
Primary-Memory or Main-Memory is a large array of words or bytes. Each word or byte has its own address.
Main-memory provides storage that can be access directly by the CPU. That is to say for a program to be
executed, it must in the main memory.
The major activities of an operating in regard to memory-management are:
• Keep track of which part of memory are currently being used and by whom.
• Decide which process are loaded into memory when memory space becomes available.
• Allocate and deallocate memory space as needed.

File Management
A file is a collected of related information defined by its creator. Computer can store files on the disk (secondary
storage), which provide long term storage. Some examples of storage media are magnetic tape, magnetic disk and
optical disk. Each of these media has its own properties like speed, capacity, data transfer rate and access
methods.
A file systems normally organized into directories to ease their use. These directories may contain files and other
directions.
The five main major activities of an operating system in regard to file management are
1. The creation and deletion of files.
2. The creation and deletion of directions.
3. The support of primitives for manipulating files and directions.
4. The mapping of files onto secondary storage.
5. The backup of files on stable storage media.
65
Lecturer By: Biran Limbu, CODES Computer Consultant, Dharan, Nepal. Email:codes@[Link]

I/O System Management


I/O subsystem hides the peculiarities of specific hardware devices from the user. Only the device driver knows
the peculiarities of the specific device to whom it is assigned.

Secondary-Storage Management
Generally speaking, systems have several levels of storage, including primary storage, secondary storage and
cache storage. Instructions and data must be placed in primary storage or cache to be referenced by a running
program. Because main memory is too small to accommodate all data and programs, and its data are lost when
power is lost, the computer system must provide secondary storage to back up main memory. Secondary storage
consists of tapes, disks, and other media designed to hold information that will eventually be accessed in primary
storage (primary, secondary, cache) is ordinarily divided into bytes or words consisting of a fixed number of
bytes. Each location in storage has an address; the set of all addresses available to a program is called an address
space.
The three major activities of an operating system in regard to secondary storage management are:
1. Managing the free space available on the secondary‐storage device.
2. Allocation of storage space when new files have to be written.
3. Scheduling the requests for memory access.

Networking
A distributed systems is a collection of processors that do not share memory, peripheral devices, or a clock. The
processors communicate with one another through communication lines called network. The communication-
network design must consider routing and connection strategies, and the problems of contention and security.
Protection System
If a computer systems has multiple users and allows the concurrent execution of multiple processes, then the
various processes must be protected from one another's activities. Protection refers to mechanism for controlling
the access of programs, processes, or users to the resources defined by a computer systems.
Command Interpreter System
A command interpreter is an interface of the operating system with the user. The user gives commands with are
executed by operating system (usually by turning them into system calls). The main function of a command
interpreter is to get and execute the next user specified command. Command-Interpreter is usually not part of the
kernel, since multiple command interpreters (shell, in UNIX terminology) may be support by an operating
system, and they do not really need to run in kernel mode. There are two main advantages to separating the
command interpreter from the kernel.
1. If we want to change the way the command interpreter looks, i.e., I want to change the interface of command
interpreter, I am able to do that if the command interpreter is separate from the kernel. I cannot change the code
of the kernel so I cannot modify the interface.
2. If the command interpreter is a part of the kernel it is possible for a malicious process to gain access to certain
part of the kernel that it showed not have to avoid this ugly scenario it is advantageous to have the command
interpreter separate from kernel.

Operating Systems Services


Following are the five services provided by an operating systems to the convenience of the users.
Program Execution
The purpose of a computer systems is to allow the user to execute programs. So the operating systems provides an
environment where the user can conveniently run programs. The user does not have to worry about the memory
allocation or multitasking or anything. These things are taken care of by the operating systems.
66
Lecturer By: Biran Limbu, CODES Computer Consultant, Dharan, Nepal. Email:codes@[Link]

Running a program involves the allocating and deallocating memory, CPU scheduling in case of multiprocess.
These functions cannot be given to the user-level programs. So user-level programs cannot help the user to run
programs independently without the help from operating systems.

I/O Operations
Each program requires an input and produces output. This involves the use of I/O. The operating systems hides
the user the details of underlying hardware for the I/O. All the user sees is that the I/O has been performed
without any details. So the operating systems by providing I/O makes it convenient for the users to run programs.
For efficiently and protection users cannot control I/O so this service cannot be provided by user-level programs.
File System Manipulation
The output of a program may need to be written into new files or input taken from some files. The operating
systems provides this service. The user does not have to worry about secondary storage management. User gives a
command for reading or writing to a file and sees his her task accomplished. Thus operating systems makes it
easier for user programs to accomplished their task.
This service involves secondary storage management. The speed of I/O that depends on secondary storage
management is critical to the speed of many programs and hence I think it is best relegated to the operating
systems to manage it than giving individual users the control of it. It is not difficult for the user-level programs to
provide these services but for above mentioned reasons it is best if this service s left with operating system.
Communications
There are instances where processes need to communicate with each other to exchange information. It may be
between processes running on the same computer or running on the different computers. By providing this service
the operating system relieves the user of the worry of passing messages between processes. In case where the
messages need to be passed to processes on the other computers through a network it can be done by the user
programs. The user program may be customized to the specifics of the hardware through which the message
transits and provides the service interface to the operating system.

Error Detection
An error is one part of the system may cause malfunctioning of the complete system. To avoid such a situation the
operating system constantly monitors the system for detecting the errors. This relieves the user of the worry of
errors propagating to various part of the system and causing malfunctioning.
This service cannot allowed to be handled by user programs because it involves monitoring and in cases altering
area of memory or de-allocation of memory for a faulty process or may be relinquishing the CPU of a process that
goes into an infinite loop. These tasks are too critical to be handed over to the user programs. A user program if
given these privileges can interfere with the correct (normal) operation of the operating systems.
System Calls and System Programs
System calls provide an interface between the process and the operating system. System calls allow user-level
processes to request some services from the operating system which process itself is not allowed to do. In
handling the trap, the operating system will enter in the kernel mode, where it has access to privileged
instructions, and can perform the desired service on the behalf of user-level process. It is because of the critical
nature of operations that the operating system itself does them every time they are needed. For example, for I/O a
process involves a system call telling the operating system to read or write particular area and this request is
satisfied by the operating system.
System programs provide basic functioning to users so that they do not need to write their own environment for
program development (editors, compilers) and program execution (shells). In some sense, they are bundles of
useful system calls.

67
Lecturer By: Biran Limbu, CODES Computer Consultant, Dharan, Nepal. Email:codes@[Link]

Types of Operating Systems


An operating system is a software component of a computer system that is responsible for the management of
various activities of the computer and the sharing of computer resources. It hosts several applications that run on a
computer and handles the operations of computer hardware. Users and application programs access the services
offered by the operating systems, by means of system calls and application programming interfaces. Users
interact with a computer operating system through Command Line Interfaces (CLIs) or Graphical User Interfaces
known as GUIs. In short, an operating system enables user interaction with computer systems by acting as an
interface between users or application programs and the computer hardware. Here is an overview of the different
types of operating systems.

Real‐time Operating System: Real‐time systems are usually used to control complex systems that require a lot of
processing like machinery and industrial systems. It 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 behavior. The main object of real-time operating systems is their quick and
predictable response to events. They either have an event-driven or a time-sharing design. An event-driven system
switches between tasks based of their priorities while time-sharing operating systems switch tasks based on clock
interrupts.

Multi‐user and Single‐user Operating Systems: Computer operating systems of this type allow multiple users to
access a computer system simultaneously. Time-sharing systems can be classified as multi-user systems as they
enable a multiple user access to a computer through time sharing. Single-user operating systems, as opposed to a
multi-user operating system, are usable by only one user at a time. Being able to have multiple accounts on a
Windows operating system does not make it a multi-user system. Rather, only the network administrator is the
real user. But for a Unix-like operating system, it is possible for two users to login at a time and this capability of
the OS makes it a multi-user operating system. This type of operating system is seen everywhere today and is the most
common type of OS, the Windows operating system would be an example.

Multi‐tasking and Single‐tasking Operating Systems: When a single program is allowed to run at a time, the system is
grouped under the single-tasking system category, while in case the operating system allows for execution of
multiple tasks at a time, it is classified as a multi-tasking operating system. Multi-tasking can be of two types
namely, pre-emptive or 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. If you are aware of the multi-threading terminology, you can consider this type of multi-
tasking as similar to interleaved multi-threading. Cooperative multitasking is achieved by relying on each process
to give time to the other processes in a defined manner. This kind of multi-tasking is similar to the idea of block
multi-threading in which one thread runs till it is blocked by some other event. MS Windows prior to Windows
95 used to support cooperative multitasking.

Distributed Operating System: In a distributed system, software and data maybe distributed around the system,
programs and files maybe stored on different storage devices which are located in different geographical locations and
maybe accessed from different computer terminals. The development of networked computers that could be linked
and made to 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.

Embedded System: The operating systems designed for being used in embedded computer systems are known as
embedded operating systems. They are designed to operate on small machines like PDAs with less autonomy.
They are able to operate with a limited number of resources. They are very compact and extremely efficient by
68
Lecturer By: Biran Limbu, CODES Computer Consultant, Dharan, Nepal. Email:codes@[Link]

design. Windows CE, FreeBSD ect. are some examples of embedded operating systems.

Mobile Operating System: Though not a functionally distinct kind of operating system, mobile OS is definitely an
important mention in the list of operating system types. A mobile OS controls a mobile device and its design supports
wireless communication and mobile applications. It has built‐in support for mobile multimedia formats. Tablet PCs and
smart‐phones run on mobile operating systems.

Batch Processing and Interactive Systems: Batch processing refers to execution of computer programs in 'batches'
without manual intervention. In batch processing systems, programs are collected, grouped and processed on a later date.
There is no prompting the user for inputs as input data are collected in advance for future processing. Input data are
collected and processed in batches, hence the name batch processing. IBM's z/OS has batch processing capabilities. As
against this, interactive operating requires user intervention. The process cannot be executed in the user's absence.

Online and Offline Processing: In online processing of data, the user remains in contact with the computer and processes
are executed under control of the computer's central processing unit. When processes are not executed under direct
control of the CPU, the processing is referred to as offline. Let's take the example of batch processing. Here, the batching
or grouping of data can be done without user and CPU intervention; it can be done offline. But the actual process
execution may happen under direct control of the processor, that is online.

Operating systems contribute to simplifying human interaction with the computer hardware. They are responsible for
linking application programs with the hardware, thus achieving easy user access to computers. Ever imagined a computer
without an OS? It wouldn't be so user‐friendly then!

Operating System Based on User Interface


Every computer that is to be operated by an individual requires a user interface. The user interface is not actually a part of
the operating system—it generally runs in a separate program usually referred to as a shell, but is essential if human
interaction is to be supported. The user interface requests services from the operating system that will acquire data from
input hardware devices, such as a keyboard, mouse or credit card reader, and requests operating system services to
display prompts, status messages and such on output hardware devices, such as a video monitor or printer.
The two most common forms of a user interface have historically been the command‐line interface, where
computer commands are typed out line‐by‐line, and the graphical user interface, where a visual environment is present.
i) Command-line interface
A command‐line interface (CLI) is a mechanism for interacting with a computer operating system or software by typing
commands to perform specific tasks. This text‐only interface contrasts with the use of a mouse pointer with a graphical
user interface (GUI) to click on options, or menus on a text user interface (TUI) to select options. This method of
instructing a computer to perform a given task is referred to as "entering" a command: the system waits for the user to
conclude the submitting of the text command by pressing the "Enter" key (a descendant of the "carriage return" key of a
typewriter keyboard). A command‐line interpreter then receives, parses, and executes the requested user command.
Upon completion, the command usually returns output to the user in the form of text lines on the CLI. This output may be
an answer if the command was a question, or otherwise a summary of the operation.

i) Graphical user interface


A graphical user interface (GUI) is a type of user interface that allows users to interact with electronic devices with images
rather than text commands. GUIs can be used in computers, hand‐held devices such as MP3 players, portable media
players or gaming devices, household appliances and office equipment. A GUI represents the information and actions
available to a user through graphical icons and visual indicators such as secondary notation, as opposed to text‐based
interfaces, typed command labels or text navigation. The actions are usually performed through direct manipulation of the
graphical elements.

69
Lecturer By: Biran Limbu, CODES Computer Consultant, Dharan, Nepal. Email:codes@[Link]

Disk Operating System (DOS)

Disk Operating System (DOS) is an Operating System. It is a command‐line interface (CLI) mechanism for interacting with a
computer operating system or software by typing commands to perform specific tasks. It works as an interpreter between
user and computer. We give English like commands and it converts it into machine language and after the computer has
processed the information, returns the results to you in English.

70
Lecturer By: Biran Limbu, CODES Computer Consultant, Dharan, Nepal. Email:codes@[Link]

There are two name in DOS and is divided into 2 parts.


1. Primary: File Name
2. Secondary: File extension.
File Name is separated from the File extension with the help of a dot (.)
Example: ENVOICE. TXT
File Name can be from 1 to 8 characters long and
File extension contains 3 characters and is optional. The extension tells DOS about what kind of file it is.
A valid Character for naming a file: from A to Z and the digit 0 to 9
C :\> Is known as DOS/command prompt, where we give the commands.
DOS command divided into 2 parts.
1. Internal Commands or Memory-Resident Commands
2. External Command or Disk-Residence Commands

INTERNAL COMMAND
There are also called memory‐resident commands. These commands are automatically loaded into the computer’s
memory during the booting process. They actually included in the [Link] file. So these commands are executable
immediately after getting the dos prompt.
1. VER: - All O/S has its own edition number or release or version number. The version
number indicates which edition of O/S you are working on.
Syntax: VER <Enter>
Example: C:\> Ver <Enter>
Result will be: - Microsoft Windows XP [ Version 5.1.2600]
02. VOL: - It is used to display volume label and serial number of the current drive
Syntax: Vol [drive:]
Example: C:\> VOL
3. DATE: - Used to display the current system date and prompt for entering new date.
Syntax: Date <Enter>
Example: C:\> date <Enter>
4. TIME: - Displays the current system Time and prompt for entering new time.
Syntax: Time <Enter>
Example: C:\> Time <Enter>
5. CLS: - Clears the cluster screen.
Syntax: CLS <Enter>
Example: C:\> CLS <Enter>
6. DIR: - This command displays the list of directories and files with details like date of
creation whether it is directory or file etc.
Syntax: DIR <Enter>
Switches:
/p : To view one screen of files at a time.
/w : Displays only five column of filenames and directories.
/b : Display only file and directory.
/l : Display all the information in lower case letters.
/a — stands for attributes that are given below.
/-h - Hidden ( or not hidden) files
s/-s - System ( or not systems) files
d/-d - Directory ( or not Directory) names
r/-r - Read only( or not read only) files
Example:
DIR *.txt : Display all the files with extension .txt
DIR D???.* : Display all the files starting with D and having less than or equal to

71
Lecturer By: Biran Limbu, CODES Computer Consultant, Dharan, Nepal. Email:codes@[Link]

four characters in the file name and any extension.


Here “?” And “*” are called “wild card character”.
“*” Stand for any number of the character
“?” Stands for nay one character.
07. MD OR MKDIR: -Used to create a new Directory or nested Directories.
Syntax: MKDIR OR MD [DRIVE:] PATH DIRECTORY NAME
Example: C:\> MD SAMS <Enter>
08. CD OR CHDIR: - This command allows you to change present directory to another
directory.
Syntax: CD [DRIVE:] PATH
Example: C:\> CD SAMS and press <Enter>
09. PATH: - This command defines a list of directories DOS Searches for external
commands.
Syntax: PATH (Display the current Search Path)
PATH; : - ( Clear the search path so DOS will search for external commands only in the
current directory)
10. RD: - To delete the empty directory.
Syntax: RD [DRIVE:] PATH
NOTE: -The directory must be empty when we use RD.
Example: C:\> RD SAMS and press <Enter>
Switches: - 1. /s – Remove with subdirectories and files.
2. /q – Don’t ask to confirm.
11. COPY CON: -We use this command to create a new file.
Syntax: COPY CON <FILENAME>
Example: C:\> Copy Con [Link] <Enter>
Note: - Typing here and when you are done, press Ctr+Z or F6 key followed by Enter to
save the current document.
12. TYPE: - This command allows you to see the contents of an existing file on the
screen.
SYNTAX: TYPE <file name>
Example: C:\> TYPE SAMS
13. COPY: - Using this command you can make duplicate files of an exiting file from one
location to another or one directory to another with different name or exiting name.
SYNTAX: COPY < SOURCE FILE NAME> <TARGET FILENAME>
Example: C:\> COPY [Link] A:\TAJ
Example: C:\> COPY*.TXT +*.BAK TARGET FILENAME And Then Press Enter
Example: C:\> COPY [Link] C:\SAMS_1\FO\RECEPTION And Then Press Enter
You can also have the option to change the name of files as you copy it.
Example: C:\> [Link] C:\dos\[Link] And Then Press Enter
14. DEL/ERASE: This command removes one or more files from the disk or current
working directories.
SYNTAX: DEL filespec [/p] or ERASE filespec [/p]
Example: C:\> DEL C:*.BAK /P And Then Press Enter
Example: C:\> DEL abc And Then Press Enter
Example: C:\> DEL ????.COM And Then Press Enter
Switches: - 1. /p –confirmation 2. /q – In quit mode
15. REN: Used to change the name of the file or directory.
SYNTAX: REN <file name>
Example: REN sams sams1 <Enter>
Example: REN *.dat *.mst And Then Press Enter
16 PROMPT: This command allows you to customize the dos prompt.
SYNTAX: 1. PROMPT
72
Lecturer By: Biran Limbu, CODES Computer Consultant, Dharan, Nepal. Email:codes@[Link]

⇒ SOME SPECIAL $ PARAMETERS ARE GIVEN BELOW.

17. TREE: - It is used to display directory structure of a specified directory graphically.


Syntax : TREE [drive:] [path] [/f]
[/F] : displays the names of the files in each directory.

External Command or Disk-Residence Commands


These are also called Disk-Resident Commands. These commands are meant for special purpose. These are
found in separate files on Hard Disk or Floppy Disk, So that they don’t typically consume valuable memory
space. They are loaded into memory only when called.
Some External Command are:
1. XCOPY: This command is faster than Copy Command and allows you to copy entire directories/disk including
all the sub directories and files to destination.
Syntax: XCOPY Source [ Target][/Y][-Y] [/P][/E]
SWITCHES :
/-Y : Prompts before copying over existing files.
/y : Overwrites existing files without prompting.
/p : Ask before copying each file.
/e : Copying empty directory also.
/s : Copying subfolders.
EXAMPLE: XCOPY C:\SAMS D:\SAMS /S/E
2. MOVE : This command moves a file or group of files from one directory to another and also one disk to
another disk. It can also be used to rename directories.
SYNTAX: Move [Path File Name] [Destination file name path]
SWICHES:
/-Y : Prompt before it overwrites while it copies file that already exists.
/Y : Overwrites existing files without prompting.
EXAMPLE: move c:\sams\[Link] to d:
EXAMPLE: move c:\sams\[Link] to d:\ new_sams
4. FC: Stands for File Compare. If you wish to compare two files or two sets of files then you may use this
command. This command has the capability to differentiate between the files and display the difference
SYNTAX: FC <files spec 1> <files spec2> [/a][/b][/c][l][/n]

73
Lecturer By: Biran Limbu, CODES Computer Consultant, Dharan, Nepal. Email:codes@[Link]

Switches
/a : This switch displays only the first and last line of each group.
/b : Compare the files in library mode ( byte-by-byte)
/c : Ignore the case of letters.
/l : Compare the files in text mode.
/n : Displays the line number for lines that are different.
EXAMPLE: FC [Link] [Link]\n and then Press <enter>
5. DOSKEY: Dos can remember only the last command you had entered. But in order to make DOS remember
all the commands you enter you will have to load a DOSKEY utility. Also Used To Create Macros
Syntax: DOSKEY and Press <Enter>
Display message on the screen.
DOSKEY Installed.
NOTE: - To display all commands from the history list one the screen.
Example: DOSKEY / History or /h < Enter>.
Now when DOSKEY is in memory, it can help store all the commands which you enter so that any of
those commands need not be typed again to be executed. And this all are called HISTORY LIST. Now
when you want the same command to be done you can use right arrow key or ‘F1’ or ‘F3’ Issuing
following command.
Second feature of DOSKEY is Doskey Macro. Using this macro you can create own command and latter you
can run it on the system prompt. For example
EXAMPLE: - DOSKEY C= CLS
Now if you type at the system prompt only C and press enter it will clear the screen.
Recalling Commands: Some key is provided to recall recent commands you have run
since installing DOSKEY.
Key Strok Effect
Up Arrow Display the Preceding Command and further list.
Down Arrow Show the next command you executed after the one that’s being
displayed.
Page Up Display the oldest command that is still in Doskey.
Page Down Show the most recent command that you executed
F7 Display the entire list of command that you executedd.
F9 Selects a commands
Alt+F7 Erase the command history list.
Alt+F10 Erase all macros in memory
Esc Clear the command line.
Ctrl-T Command separator
6. MEM:
This command displays amount of total available memory ( low, Expanded and
Extended) and all currently programs.
Syntax: MEM [/f][/p][/m]
Switches:
/f : Using this switch MEM display all the areas of memory that are fee.
/p : Use this option to display the information one screen at a time.
/m : Display information about how a specified program is using memory.
Example: MEM/p and then press <Enter>
7. FILTER:
A Powerful feature of DOS is its use of filters to process data directly. A DOS FILTER
can process in unique way any data that passes through it and can change what we see
on the screen.
There are three FILTERS include in DOS.
A. MORE: More command used to pause vertical Scrolling on the display screen,
after each screenful, The display pauses and the message - - More - - appears.
Pressing any key display the next screen.
74
Lecturer By: Biran Limbu, CODES Computer Consultant, Dharan, Nepal. Email:codes@[Link]

EXAMPLE: C:\> MORE < TYPE [Link] and then press <Enter>
EXAMPLE: C:\> DIR /MORE and then press <Enter>
B. SORT: Reads, Sorts in Order and sends the data to the screen, file or to another
device. Sort to arrange data in an order.
SYNTAX: SORT [drive:][Path][filename][/r][+n]
Switches:
[drive:][Path][filename] : Specifies the name and location of the file to be
searches. It must be preceded
by the redirection character (<).
[/r] : Sort lines in reverse ASCII Order ( Z-A)
[+n] : Sorts line starting with the contents in column n. The default is 1.
EXAMPLE: C:\> SORT < NAME .TXT and then press <Enter>
EXAMPLE: C:\> SORT /+20 < PHONE .TXT and then press <Enter>
EXAMPLE: C:\> DIR / SORT > PHONE .TXT and then press <Enter>
Note: Sort command doesn’t distinguish between upper and lower case. It can sort file
of maximum 63 k size.
Combining Input & Output redirection :
EXAMPLE: C:\> SORT < NAME .DAT > [Link] and then press
<Enter>
Here the sort command is being directed to take its input from <[Link] and after
sorting, send its output to the > [Link] file.
C. FIND: The find Filter is used to search a file one or more designated character (called
a text string) Depending upon the form of the FIND Command. Each line having (or not
having) the text string is sent to an output devices. Such as the Screen, a file or the
printer. The text string is always typed within quotes ( “Text Sring”).
SYNTAX: FIND [/v][/c][/n] “String “ [d:] [path][filename]
Switches:
[/v] : Displays all the lines that do not contain string.
[/c] : Display the total number of lines found to contain the string.
[/n] : Display the line number as well as the line that contains the string.
[/i] : Ignores uppercase or lowercase during the search.
Where:
“String” : Specifies one or more alphabet or numeric character whose maximum
length should not be more than 250 characters and must be enclosed in double quotes.
[d:] [path][filename] : Specifies the name and location of the file to be searches .
EXAMPLE: C:\> FIND “Rajni” [Link] [Link] and then press <Enter>
EXAMPLE: C:\> DIR/ FIND “TXT” and then press <Enter>
7. ATTRIB:
Every File on the Disk has its own description like size, space occupied, the type, the
date it was created, etc. Likewise, every file has few attributes. The attributes of a file
indicates whether it is a
i) Read-Only File: r ii) Archive File a
iii) Hidden File: h iv) System File s
With the ATTRIB command you can check the attributes of a file.
SYNTAX: ATTRIB [+r][+a][+h][/+s] [filename]
Switches:
+r, -r : +r Read-Only attribute or, -r turn of Read-Only attribute
+a,-a : +a archive attribute, or -a turn of archive attribute
+h,-h : +h hidden attribute, or –h turn of hidden attribute
+s, -s : +s system attribute and it should not be used generally.
Note:
While Creating a new file every file gets read only attribute and archive attribute by
75
Lecturer By: Biran Limbu, CODES Computer Consultant, Dharan, Nepal. Email:codes@[Link]

default.
EXAMPLE: C:\> ATTRIB [Link] +R and then press <Enter>
EXAMPLE: C:\> ATTRIB [Link] +H and then press <Enter>
8. DELTREE:
This command used for deleting an entire directory whether in that directory contains
files or subdirectories and also it will delete hidden files.
Syntax: DELTREE [drive:][path] directories [/y]
EXAMPLE: C:\> DELTREE [Link] and then press <Enter>
9. EDIT:
This is the DOS Editor, which you can use to edit the text file and also creating new file.
Syntax: Edit [drive:][path][filename]
EXAMPLE: C:\> EDIT c:\sams\[Link] and then press <Enter>
EXAMPLE: C:\> Edit NEW FILE and then press <Enter>

System Files: [Link], [Link], MSDOS. sys, [Link]

[Link]: A hidden file in the root directory of the primary drive. This file provides the basic I/O capabilities for the system,
allowing it the ability to communicate with the different peripherals. [Link] directs the overall process of loading the
Operating System.
[Link]: [Link] an important system file on MS‐DOS and Windows 9x systems. It is run after [Link]. In MS‐
DOS, it contains the core operating system code, the kernel. On Windows 9x systems, the DOS kernel code is merged into
[Link], and [Link] is an ASCII file containing configuration directives.
By default, the file is located in the root directory of the bootable drive/partition (normally C:\) and has the hidden, read‐
only, and system file attributes set. When an application needs to access a device or peripheral, this file translates the
request into actions that [Link] can perform.
[Link]: A user‐configurable text file that usually contains device drivers and system setup values. [Link] is
the primary configuration file for the DOS operating systems. It is a special file that contains setup or configuration
instructions for the computer system.
Example [Link] for MS‐DOS
device=c:\dos\[Link]
device=c:\dos\[Link] ram
dos=high,umb
shell=c:\dos\[Link] c:\dos /e:512 /p
• The first line loads the [Link] driver that enables DOS to use the high memory
area.
• The second line loads the EMM386 memory manager, which emulates expanded memory. The
command line argument RAM allows the use of the upper memory area. Another argument
that can be given to [Link] is NOEMS, which allows use of the upper memory area
without emulating expanded memory. The NOEMS switch also frees up more umb blocks.
• The third line causes DOS to use high memory and upper memory when possible, freeing
up more conventional memory for applications to use.
• The final line sets the shell to the default shell, [Link], and starts it with
C:\DOS as the working directory, with an environment size of 512 bytes, and the /P
indicates that it is the primary process and therefore cannot be shut down by using
the exit command.

[Link]: This is the Command Interpreter. It can accept commands from the user, launch programs and pass
this Information to [Link]. [Link] is the filename of the default operating system shell for DOS operating
systems and the default command line interpreter on Windows 95, Windows 98 and Windows Me. It has an additional
role as the first program run after boot, hence being responsible for setting up the system by running the [Link]
configuration file, and being the ancestor of all processes.

76
Lecturer By: Biran Limbu, CODES Computer Consultant, Dharan, Nepal. Email:codes@[Link]

[Link]: Another user‐configurable text file that is used to set system variables and load TSRs (Terminate and
Stay Resident). [Link] is a system file found originally on DOS‐type operating systems. It is a plain‐text batch file
that is located in the root directory of the boot device. The name of the file stands for "automatic execution", which
describes its function in automatically executing commands on system startup

Windows Operating System

An enclosed, rectangular area on a display screen. Most modern operating systems and applications have graphical user
interfaces (GUIs) that divide display into several windows. Within each window, we can run a different program or display
different data.
Windows are particularly valuable in multitasking environments, which allow execute several programs at once. By
dividing display into windows, we can see the output from all the programs at the same time. To enter input into a
program, we simply click on the desired window to make it the foreground process.

Introduction to GUI and its features


A graphical user interface (GUI) is a pictorial interface to a program. A good GUI can make programs easier to use by
providing them with a consistent appearance and with intuitive controls like pushbuttons, list boxes, sliders, menus, and
so forth. The GUI should behave in an understandable and predictable manner, so that a user knows what to expect when
he or she performs an action. For example, when a mouse click occurs on a pushbutton, the GUI should initiate the action
described on the label of the button.
GUIs, such as the one supported by the Apple Macintosh or Windows, enable to set the dimensions and position of each
window by moving the mouse and clicking appropriate buttons. Windows can be arranged so that they do not overlap
(tiled windows) or so they do overlap (overlaid windows). Overlaid windows (also called cascading windows) resemble a
stack of pieces of paper lying on top of one another; only the topmost window is displayed in full. We can move a window
to the top of the stack by positioning the pointer in the portion of the window that is visible and clicking the mouse
buttons. This is known as popping. We can expand a window to fill the entire screen by selecting the window's zoom box.
In addition to moving windows, changing their size, popping and zooming them, we can also replace an entire window
with an icon (this is sometimes called minimizing). An icon is a small picture that represents the program running in the
window. By converting a window into an icon, we can free up space on the display screen without erasing the window
entirely. It is always possible to reconvert the icon into a window whenever we want.
A window can also be a logical view of a file. By moving the window, we can view different portions of the file.

World most known Windows Operating system is a Microsoft Windows or MS‐Windows. Microsoft Windows is a series of
operating systems produced by Microsoft. Microsoft introduced an operating environment named Windows on November
20, 1985 as an add‐on to MS‐DOS in response to the growing interest in graphical user interfaces (GUIs). Microsoft
Windows came to dominate the world's personal computer market, overtaking Mac OS, which had been introduced in
1984.

Working with a Window Environment

Menubar
A menubar provides the facility to launch programs via a menu and may contain additional facilities including a start
button, a taskbar, and a system tray.

77
Lecturer By: Biran Limbu, CODES Computer Consultant, Dharan, Nepal. Email:codes@[Link]

Title Bars
A titlebar is a window decoration component provided by some window managers which appears at the top of each
window. The titlebar is typically used to display the name of the application, or the name of the open document, and may
provide title bar buttons for minimizing, maximizing, closing or rolling up of application windows.
Title Bar Buttons
Title bar buttons are included in the titlebar of some window managers, and provide the facility to minimize, maximize,
rollup or close application windows. Some window managers may display the titlebar buttons in the taskbar or task panel,
rather than in a titlebar.
Autohide
An autohide facility enables menubars to disappear when the pointer is moved away from the edge of the screen.
Borders
A border is a window decoration component provided by some window managers, that appears around the active
window. Some window managers may also display a border around background windows.
Context Menu
Some window managers provide a context menu that appears when an alternative click event is applied to a desktop
component.
Desktop Wallpaper
Some window managers provide a desktop wallpaper facility that enables a background picture to be displayed in the root
window.
Focus Stealing
Focus stealing is a facility provided by some window managers that allows an application that is not in focus to suddenly
gain focus and steal user input intended for the previously focused application.
Iconification
An iconification facility enables running applications to be minimized to a desktop icon or taskpanel icon.
Joined Windows
Some window managers provide a joined windows facility that enables application window frames to be joined together.
Keyboard Equivalents
Some window managers provide keyboard equivalents that enables functionality provided by the mouse to be replicated
by using a keyboard.
Menu Panel
A menu panel a component of some window managers that provides the facility to launch programs using a menu. A
menu panel is similar to a menubar, but appears as a floating panel, rather than a horizontal or vertical bar.
The menu panel may contain additional facilities including a start button, a task panel, and a system tray.
Mouse focus
The mouse focus model determines how the pointing device affects the input focus within the window manager. The
focus model determines which component of the graphical user interface is currently selected to receive input as the
pointer is moved around the screen.
Mouse warping
Mouse warping is a facility that centers the pointer on the current application as it is made active.
Multiple Desktops
A window manager may provide a multiple desktops facility. This enables several root windows to be used, and a facility to
switch between desktops. This prevents clutter of the root window, because applications can be run on different desktops.
Pager
Some window managers provide a pager tool that provides the facility to switch between multiple desktops. The pager
may appear as an onscreen window or as a gadget in the taskbar or taskpanel.
Plug‐ins
Some window managers have a modular construction, enabling plug‐in modules to be used to provide features as
required.

78
Lecturer By: Biran Limbu, CODES Computer Consultant, Dharan, Nepal. Email:codes@[Link]

Rollup
A rollup facility enables windows to appear as just a titlebar on the desktop.
Root Menu
Some window managers provide a root menu, which appears when the root window or desktop background is touched.
Shortcuts
Some window managers provide a shortcut facility, which enables icons to be placed on the root window, which can be
used to access specific programs or facilities.
Tabbed Windows
Some window managers provide a tabbed windows facility, that enables applications to be grouped together to share
common frames.
Task Switching
The window manager may provide various task switching facilities, to enable selection of the currently focused
application, including:
Changing the mouse focus using a pointing device
Keyboard task switching facilities (for example, by pressing Alt‐Tab)
Clicking on the task in a taskbar or taskpanel
Taskbar
Some window managers provide a taskbar which shows running applications. The taskbar may show all applications that
are running including those that have been minimized, and may provide the facility to switch focus between them. The
taskbar may be incorporated into a menubar on some window managers.
Task Panel
A task panel is similar to a taskbar, but appears as a floating panel, rather than a horizontal or vertical bar.
Start Button
A start button is a desktop widget that provides a menu of programs that can be launched. The start button is typically
placed on a menubar at the bottom of the screen.
Notification Area
A Notification Area is used to display icons for system and program features that have no desktop window. It contains
mainly icons to indicate status information and notifications such as arrival of a new mail message. Some systems may also
show a clock in the Notification Area.
Virtual Desktop
A virtual desktop (also called a scrolling desktop) is a facility provided by some window managers that enables the desktop
to be larger than the actual screen

Concept of Open Sources Operating System

The term "open source software" refers primarily to a set of terms and conditions associated with the software's license.
The term "open source" derives from the fact that the software's source code is at least available and in fact ususally
distributed with the executable code (the normal way of distributing software). Per one of the typical terms and conditions
in an OSI‐compliant license, the software can be (1.) "freely" changed and (2.) somewhat freely redistributed (depending
on which open source license is used).
There are a variety of open source software foundations that are more independent than the norm from the companies
that use their project code for revenue generation. However even these foundations are heavily funded by technology
companies (e.g., Apache Software Foundation by all the major market participants including Microsoft, Mozilla by Google,
the Linux Foundation by IBM and HP, and so forth) There are a variety of open source software foundations that are more
independent than the norm from the companies that use their project code for revenue generation. However even these
foundations are heavily funded by technology companies (e.g., Apache Software Foundation by all the major market
participants including Microsoft, Mozilla by Google, the Linux Foundation by IBM and HP, and so forth)
79
Lecturer By: Biran Limbu, CODES Computer Consultant, Dharan, Nepal. Email:codes@[Link]

Open Source Platforms(OS)


The most well‐known open source OS is Linux, a UNIX operating system derivative named after its creator, Linus Torvalds.
The Linux Foundation, where Linus works, is more or less "in charge of" the operating system kernel. (Of course under
open source development philosophy, anyone can take it and fork it into something else but Linus owns the name Linux.)
The Linux kernel is turned into a platform by adding a wide range of utility software, primarily developed under the banner
of the GNU organization.
How do companies profit from open source?
A number of companies have been built around a so‐called open source business model, where they license their software
for free or very inexpensively, but derive their revenues from support and training services. This model is really no
different than most other long‐time software companies which almost always sell subscription maintenance service after
selling the initial right to use license. In fact, most long‐time participants in the software market realize well more than half
of their software‐related revenue from this source.
Many companies following the so‐called open source business model adopt a tiered approach to their product offerings,
releasing a completely free community edition of their software, and then charging a license fee for their enterprise
edition, which is often based on their community edition but includes additional features or is more highly scalable. Again,
this marketing tactic is not different from many publishers of closed‐source software.

Introduction to UNIX, Linux

UNIX Operating System Concept


UNIX is a powerful computer operating system originally developed at AT&T Bell Laboratories. It is very popular among the
scientific, engineering, and academic communities due to its multi‐user and multi‐tasking environment, flexibility and
portability, electronic mail and networking capabilities, and the numerous programming, text processing and scientific
utilities available. It has also gained widespread acceptance in government and business. Over the years, two major forms
(with several vendor’s variants of each) of UNIX have evolved: AT&T UNIX System V and the University of California at
Berkeley’s Berkeley Software Distribution (BSD). This document will be based on the SunOS 4.1.3_U1, Sun’s combination
of BSD UNIX (BSD versions 4.2 and 4.3) and System V because it is the primary version of UNIX available at Rice. Also
available are Solaris, a System Vbased version, and IRIX, used by Silicon Graphics machines.

Types of UNIX
There are many different versions of UNIX, although they share common similarities. The most popular varieties of UNIX
are Sun Solaris, GNU/Linux, and MacOS X.

UNIX Components
Unix is made up of three components
1. the kernel;
2. the shell; and
3. Applications.
80
Lecturer By: Biran Limbu, CODES Computer Consultant, Dharan, Nepal. Email:codes@[Link]

The kernel
The kernel is the main component of most computer operating systems; it is a bridge between applications and the actual
data processing done at the hardware level. The kernel's responsibilities include managing the system's resources (the
communication between hardware and software components).[1] Usually as a basic component of an operating system, a
kernel can provide the lowest‐level abstraction layer for the resources (especially processors and I/O devices) that
application software must control to perform its function. It typically makes these facilities available to application
processes through inter‐process communication mechanisms and system calls.
Operating system tasks are done differently by different kernels, depending on their design and implementation. While
monolithic kernels execute all the operating system code in the same address space to increase the performance of the
system, micro kernels run most of the operating system services in user space as servers, aiming to improve
maintainability and modularity of the operating system.[2] A range of possibilities exists between these two extremes.
The kernel of Unix is the heart of the operating system. It allocates time and memory to programs and handles the
filestructure and communication between the different parts of the computer system such as the keyboard and the
screen.

The shell
Interact with the system through a command interpreter program called the shell. The shell is an interface between the
user and the Unix kernel. When a user logs in Unix checks the username and password, and then starts another program
called the shell. The shell interprets the commands the user types and transmits them to the kernel to be executed. These
commands are programs.
There are a variety of shells available for the various Unix systems. The expert user can customize their own shell and
users can use different shells on the same machine.
Variety of shells:
• sh ‐ the bourne shell
• bash ‐ the bourne again shell
• csh ‐ the c shell
• ksh ‐ the Korn shell (strangely, not named for the band)
• zsh ‐ the z shell

Application programs
Programs are not part of the operating system as such.

Linux Operating System Concept

Linux is a free open‐source operating system based on UNIX. Linus Torvalds originally created Linux with the assistance of
developers from around the world.
• Free
• Unix Like
• Open Source
• Network operating system
• Strictly speaking, Linux is a kernel. A kernel provides access to the computer hardware and controls access to
resources. The kernel decides who will use a resource, for how long and when. You can download the Linux kernel
from the official web site. However, the Linux kernel itself is useless unless you get all the applications such as text
editors, email clients, browsers, office applications, etc. Therefore, someone came up with idea of a Linux
distribution. A typical Linux distribution includes:
• Linux kernel
• GNU application utilities such as text editors, browsers
81
Lecturer By: Biran Limbu, CODES Computer Consultant, Dharan, Nepal. Email:codes@[Link]

• GUI (X windows)
• Office application software
• Software development tools and compilers
• Thousands of ready to use application software packages
• Linux Installation programs/scripts
• Linux post installation management tools daily work such as adding users, installing applications, etc

Who created Linux?


In 1991 Linus Torvalds was studying UNIX at a university, where he was using a special educational experimental purpose
operating system called Minix (a small version of UNIX to be used in the academic environment). However, Minix had its
limitations and Linus felt he could create something better. Therefore, he developed his own version of Minix, known as
Linux. Linux was Open Source right from the start.
Linux is kernel developed by Linus. The kernel was bundled with system utilities and libraries from the GNU project to
create a usable operating system. Sometime people refer Linux as GNU/Linux because it has system utilities and libraries
from the GNU project. Linus Torvalds is credited for creating the Linux Kernel, not the entire Linux operating system.
Linux distribution = Linux kernel + GNU system utilities and libraries + Installation scripts + Management utilities etc.
Please note that Linux is now packaged for different uses in Linux distributions, which contain the sometimes modified
kernel along with a variety of other software packages tailored to different requirements such as:
• Server
• Desktop
• Workstation
• Routers
• Various embedded devices
• Mobile phones etc

Programming Concepts & Logics


Concept programming is a programming paradigm focusing on how concepts, translate into representations that are
found in the code space. A programming paradigm is a fundamental style of computer programming. (Compare with a
methodology, which is a style of solving specific software engineering problems.) Paradigms differ in the concepts and
abstractions used to represent the elements of a program (such as objects, functions, variables, constraints, etc.) and the
steps that compose a computation (assignment, evaluation, continuations, data flows, etc.).

Computer program
A computer program (also software, or just a program) is a sequence of instructions written to perform a specified task
with a computer. A computer requires programs to function, typically executing the program's instructions in a central
processor. The program has an executable form that the computer can use directly to execute the instructions. The same
program in its human‐readable source code form, from which executable programs are derived (e.g., compiled), enables a
programmer to study and develop its algorithms.
Computer source code is often written by computer programmers. Source code is written in a programming language that
usually follows one of two main paradigms: imperative or declarative programming. Source code may be converted into an
executable file (sometimes called an executable program or a binary) by a compiler and later executed by a central
processing unit. Alternatively, computer programs may be executed with the aid of an interpreter, or may be embedded
directly into hardware.

Programming language
A programming language is an artificial language designed to communicate instructions to a machine, particularly a
computer. Programming languages can be used to create programs that control the behavior of a machine and/or to
82
Lecturer By: Biran Limbu, CODES Computer Consultant, Dharan, Nepal. Email:codes@[Link]

express algorithms precisely. A programming language is a notation for writing programs, which are specifications of a
computation or algorithm.

Types of programming languages


There are several types of languages:
• Low level programming language
• High level programming language
• 4 GL

Low-level programming language


Low‐level languages can be converted to machine code without using a compiler or interpreter, and the resulting code
runs directly on the processor. A program written in a low‐level language can be made to run very fast, and with a very
small memory footprint; an equivalent program in a high‐level language will be more heavyweight. Low‐level languages
are simple, but are considered difficult to use, due to the numerous technical details which must be remembered.
Examples of Low-level programming language are: Machine Code and Assembly language
Machine code
Machine code is the only language a microprocessor can process directly without a previous transformation. Currently,
programmers almost never write programs directly in machine code, because it requires attention to numerous details
which a high‐level language would handle automatically, and also requires memorizing or looking up numerical codes for
every instruction that is used. For this reason, second generation programming languages provide one abstraction level on
top of the machine code. Machine code may be regarded as a primitive (and cumbersome) programming language or as
the lowest‐level representation of a compiled and/or assembled computer program. While it is possible to write programs
in machine code, because of the tedious difficulty in managing CPU resources, it is rarely done any more, except for
situations that require the most extreme optimization.
Assembly
An assembly language is a low‐level programming language for computers, microprocessors, microcontrollers, and other
programmable devices. It implements a symbolic representation of the machine codes and other constants needed to
program a given CPU architecture. This representation is usually defined by the hardware manufacturer, and is based on
mnemonics that symbolize processing steps (instructions), processor registers, memory locations, and other language
features. An assembly language is thus specific to certain physical (or virtual) computer architecture. This is in contrast to
most high‐level programming languages, which, ideally, are portable.
Assembly language is considered a low‐level language because while it is not a microprocessor's native language, an
assembly language programmer must still understand the microprocessor's unique architecture (such as its registers and
instructions). These simple instructions are then assembled directly into machine code. The assembly code can also be
abstracted to another layer in a similar manner as machine code is abstracted into assembly code.

High level programming language


A high‐level programming language is a programming language with strong abstraction from the details of the computer.
In comparison to low‐level programming languages, it may use natural language elements, be easier to use, or be from the
specification of the program, making the process of developing a program simpler and more understandable with respect
to a low‐level language. "High‐level language" refers to the higher level of abstraction from machine language. Rather than
dealing with registers, memory addresses and call stacks, high‐level languages deal with variables, arrays, objects, complex
arithmetic or boolean expressions, subroutines and functions, loops, threads, locks, and other abstract computer science
concepts, with a focus on usability over optimal program efficiency. Unlike low‐level assembly languages, high‐level
languages have few, if any, language elements that translate directly into a machine's native opcodes. Other features, such
as string handling routines, object‐oriented language features, and file input/output, may also be present.
Examples of high level programming languages are: C,C++,C#, LISP, PROLOG etc

83
Lecturer By: Biran Limbu, CODES Computer Consultant, Dharan, Nepal. Email:codes@[Link]

High level programming Execution models


There are three models of execution for modern high‐level languages:
Interpreted
Interpreted languages are read and then executed directly, with no compilation stage. A program called an interpreter
reads each program line following the program flow, converts it to machine code, and executes it; the machine code is
then discarded, to be interpreted anew if the line is executed again.
Compiled
Compiled languages are transformed into an executable form before running. There are two types of compilation:
Machine code generation
Some compilers compile source code directly into machine code. This is the original mode of compilation, and
languages that are directly and completely transformed to machine‐native code in this way may be called "truly
compiled" languages.
Intermediate representations
When a language is compiled to an intermediate representation, that representation can be optimized or saved
for later execution without the need to re‐read the source file. When the intermediate representation is saved, it
is often represented as byte code. The intermediate representation must then be interpreted or further compiled
to execute it. Virtual machines that execute byte code directly or transform it further into machine code have
blurred the once clear distinction between intermediate representations and truly compiled languages.
Translated
A language may be translated into a lower‐level programming language for which native code compilers are already widely
available. The C programming language is a common target for such translators.

Fourth-generation programming language


A fourth‐generation programming language (1970s‐1990) (abbreviated 4GL) is a programming language or programming
environment designed with a specific purpose in mind, such as the development of commercial business software. All 4GLs
are designed to reduce programming effort, the time it takes to develop software, and the cost of software development.
The 4GL is an example of 'black box' processing; each is further from the machine. It is this latter nature that is directly
associated with 4GL having errors that are harder, in many cases, to debug. In terms of applications, a 4GL could be
business oriented or it could deal with some technical domain. Being further from the machine implies being closer to
domain.
Examples of high level programming languages are: SQL, Clipper, FoxPro, Informix‐4GL etc

Concept of Programming Statement


In computer programming a statement can be thought of as the smallest standalone element of an imperative
programming language. A program written in such a language is formed by a sequence of one or more statements. A
statement will have internal components (e.g., expressions). Many languages make a distinction between statements and
definitions, with a statement only containing executable code and a definition declaring an identifier. A distinction can also
be made between simple and compound statements; the latter may contain statements as components.

Kinds of statements
Simple statements
Int a,b,c;
a=20;
b=30;
c=a+b;
printf(“%d”,c);

84
Lecturer By: Biran Limbu, CODES Computer Consultant, Dharan, Nepal. Email:codes@[Link]

Compound statements
For(int a=1;a<=5;a++)
{
Statement…
}
Syntax
Programming languages are characterized by the flavor of statements they use (e.g.: The curly brace language family).
Many statements are introduced by identifiers like if, while or repeat. Often statement keywords are reserved such that
they cannot be used as names of variables or functions. Imperative languages typically use special syntax for each
statement, which looks quite different to function calls.
For example:
For counter syntax:
For(initial value;condition;counter)
{
Statement ….
}

Semantics
Semantically many statements differ from subroutine calls by their handling of parameters. Usually an actual subroutine
parameter is evaluated once before the subroutine is called. This contrasts to many statement parameters which can be
evaluated several times (e.g. the condition of a while loop) or not at all (e.g. the loop body of a while loop). Technically
such statement parameters are closures which are executed when needed. When closure parameters are available for
subroutines a statement like behavior can be implemented by subroutines also. For languages without closure parameters
the semantic description of a loop or conditional is usually beyond the capabilities of the language. Therefore standard
documents often refer to semantic descriptions in natural language.
Semantics is the study of meaning. It focuses on the relation between signifiers, such as words, phrases, signs and
symbols, and what they stand for.
For example:
x += y (C, C++, C#, Java, Perl, Python, Ruby, PHP, etc.)
LET X = X + Y (BASIC)

Semantics errors
In computer programming, a Semantics errors
Or logic error is a bug in a program that causes it to operate incorrectly, but not to terminate abnormally (or crash). A
logic error produces unintended or undesired output or other behavior, although it may not immediately be recognized as
such. Logic errors occur in both compiled and interpreted languages. Unlike a program with a syntax error, a program with
a logic error is a valid program in the language, though it does not behave as intended. The only clue to the existence of
logic errors is the production of wrong solutions.
Common causes: The mistake could be the logical error in a statement (for example, a wrong or incorrect formula or
divided by zero etc.), an error in an algorithm, or even the wrong algorithm selected.

Program Control Structures: Sequence, Selection and Iteration.


Programming languages that support complex logic (i.e. like logic decisions) will implement sequence, decision and
repetition structures. These structures will provide the programming flexibility necessary for computer programs to solve
complex problems. Control structures enable the grouping of processing steps, the implementation of decisions and the
use of repetition in our logic and then our programs.
Three control structures:
85
Lecturer By: Biran Limbu, CODES Computer Consultant, Dharan, Nepal. Email:codes@[Link]

(1) Sequence
(2) Selection structures
(3) Repetition (a.k.a. iteration or looping)

Sequence structures
Sequence structures are the simplest of control structures to implement and the closest in format. Sequence structures
have one input and one output within the sequence structure and typically consist of instruction(s) (i.e. a calculation or
maybe an assignment). The result is passed on to the next structure. Sequence structures appear as rectangles in
flowcharts and statements in pseudo code.
Pseudo code example:
total = sales times *salesTax

Figure 2: Sequence structure flowchart

Selection structures
Selection structures also known as Decision structures; provide our program logic with the ability to test a Boolean
expression that will return a Boolean value of true or false. The test constitutes a decision in our logic. The Boolean
expression typically consists of two identifiers, literals or other expressions joined by a logical operator. It is important to
understand that Boolean expressions can only produce a solution with two alternatives. By nesting (adding new decision
structures within the true and false branches), even complex decisions can be implemented in a program. Decision
structures appear as diamond shaped symbols in flowcharts and are implemented in pseudo code as an if statement. The
flowchart diamond symbol (which also identifies the boolean expression) will have a true line and optionally a false line
drawn from the points on the diamond. Pseudo code will include statements indented under the’ if’ statement for true
Boolean expressions and under the else statement for a false Boolean expression.
Pseudo code for .10 percent book discount with purchase of more than 3 books:
if (books > 3 then
totSales = sales * .90
else
totSales = sales
Flow Chart for .10 percent book discount with purchase of more than 3 books:

86
Lecturer By: Biran Limbu, CODES Computer Consultant, Dharan, Nepal. Email:codes@[Link]

Figure 3: Decision structure flowchart


Iteration structures
Iteration structures, also known as looping or Repetition structures, provide our program logic with ability to repeat a
block of statements based on the evaluation of a Boolean expression. This structure allows us to take a group of several
statements and repeat their execution based on some decision or condition. The repetition could be as simple as iteration
that allows us to repeat through a block of code a certain number of times or can be as complex as repetition based on a
Boolean comparison (i.e. when sales > 1000). Like the decision structure, the repetition evaluates a Boolean expression to
control reentry into the loop. Repetition structures appear as a diamond with a line returning above the diamond to
facilitate repetition and another line showing the flow of the logic when the loop concludes. In pseudo code and program
code, the repetition structure is usually implemented with a while loop and has the statements included in the repetition
indented under the while loop.
Pseudo code to repeat a sequence statement 10 times:
while cnt < 10
total = cnt * qty
Flow Chart for to repeat a sequence statement 10 times:

Figure 4: Repetition structure flowchart


87
Lecturer By: Biran Limbu, CODES Computer Consultant, Dharan, Nepal. Email:codes@[Link]

Program Design tools – Pseudo code, Algorithm and Flowchart


Software design is a process of problem solving and planning for a software solution. After the purpose and specifications
of software are determined, software developers will design or employ designers to develop a plan for a solution.
The most common ways to design the logic of a program is to use pseudo code, Algorithm and Flowchart.
Pseudo code
Pseudocode is a way for computer programmers to create high level descriptions of algorithms that they would like to
figure out on paper before programming the actual code itself. It doesn't strictly follow the programming structures of any
single language. In fact, it's usually done in a very ad hoc fashion in a way that allows programmers to sketch out their
ideas informally so that they can wrap their minds around a particular programming problem.
There is no standard syntax for pseudocode, and writing in pseudocode will not yield an executable program. Pseudocode
can be considered to be simplified programming code that can apply to multiple languages. It often includes descriptions
of programming actions written in plain English or in terms that are very close to plain English in nature. A piece of
pseudocode for an algorithm that logs a user into some online system, for example, might look something like this:

example1: Example 2:
pseudocode: If then Else pseudocode: Case
If age > 17 Case of age
Display a message indicating you can vote. 0 to 17 Display "You can't vote."
Else 18 to 64 Display "Your in your working years."
Display a message indicating you can't vote. 65 + Display "You should be retired."
Endif Endcase

Example 3: Example 4:
pseudocode: While pseudocode: For
count assigned zero For x starts at 0, x < 5, increment x
While count < 5 Display "Are we having fun?"
Display "I love computers!" Endfor
Increment count
Endwhile
Example 5: Example 6:
pseudocode: Do While pseudocode: Repeat Until
count assigned five count assigned five
Do Repeat
Display "Blast off is soon!" Display "Blast off is soon!"
Decrement count Decrement count
While count > zero Until count < one

Algorithm
Algorithm is a procedure for solving a problem. It is basically the description of steps for computation of a problem. This is
also referred as a step by step procedure to solve a problem. It abstracts the data, operations and the semantics of a
problem and then creates a solution using all those abstractions. It describes the process of solving a particular problem. A
computer program can also be viewed as an elaborate algorithm.
The main points about algorithms are:
What are the inputs for that particular algorithm?
What will be the output with respect to the given inputs?
How much time will be required for that algorithm to solve the problem (i.e. the efficiency of that algorithm)?

88
Lecturer By: Biran Limbu, CODES Computer Consultant, Dharan, Nepal. Email:codes@[Link]

This means that by giving an input data, a particular algorithm is expected to give the output within a particular time which
is counted in time units and speed. It can be implemented in any of the languages (may be C, C++, Java or [Link] etc…).
Algorithm is often rendered in pseudo code. Algorithms are slightly different to pseudo code. An Algorithm is much more
descriptive and does not contain mathematical symbols. Pseudo code is the next step in the software development cycle.
The algorithms are then translated into descriptions which are pretty much closer to the actual programming language.
Algorithms play a very important role in designing good software and also help in finding best solution to a problem.
Algorithm can be formally written down and has very practical consequences to achieve software re‐use which helps in
saving a lot of time for software developers. There are a number of formalizations of algorithms. E.g. is Turing machine.
Using the Turing machine, an algorithm is a description of a states and steps required to compute something.
The computers are increasing in complexities and therefore more and more software algorithms are being used these
days. The algorithms have taken a form which is also called hard software. The algorithms have become a basic part in
computer’s circuitry and can also stand alone in special devices. A number of different applications algorithms are
available which are highly advanced systems. For example – Algorithms such as Artificial intelligence algorithms will be
becoming very common in near future. Thus helping day to day needs not only in the field of computers but in other fields
as well.
Algorithm for finding factorial of any number:
1. Take a number as a input from the user.
2. Initialize a variable fact=1

3. fact=fact*number
4. number=number‐1
5. repeat step 3 to 5 if number>0
6. print the value of fact variable
Algorithm illustrate in c programming language:
void main()
{
int x;
int factorial=1;
printf("enter number :");
scanf(“%d”,&x);
for (int i=x; i > 0;i‐‐)
{
factorial =factorial * i;
}
printf(" facotorial of x is: “,factorial);
}

Flowchart
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. This is not a complete list of all the possible flowcharting
symbols, it is the ones used most often in the structure of Assembly language programming.

89
Lecturer By: Biran Limbu, CODES Computer Consultant, Dharan, Nepal. Email:codes@[Link]

Flowchart for finding factorial of any number:

90
Lecturer By: Biran Limbu, CODES Computer Consultant, Dharan, Nepal. Email:codes@[Link]

Flowchart illustrate in c programming language:


void main()
{
int x;
int factorial=1;
printf("enter number :");
scanf(“%d”,&x);
for (int i=x; i > 0;i‐‐)
{
factorial =factorial * i;
}
printf(" facotorial of x is: “,factorial);
}

Introduction to Data Type

Although some contemporary programming languages allow programmers to invent own data types, and define
their related operations, there are a number of traditional data types found in most programming languages:
Integer
Integers are numeric data items, which are either positive or negative including zero, i.e. 1, 488, -22, 0, 456. Some
programming languages put restrictions on the magnitude of integers which may be used in program instructions.
These restrictions are usually dependent on the size of the memory location of the computer in which the
language may run.
Real Numbers
There are two types of real numbers, Fixed-Point and Floating Point.
Fixed Point
Fixed point data items are numbers which have embedded decimal point i.e. 1.5, 458.4589, -0.569.
Floating Point
Floating point data items are numbers, which are, held as binary fractions by a computer. The numbers are
expressed in a form where you have a mantissa and an exponent, for example
Number Mantissa Exponent
12.3 = 0.123 * 102 0.123 2
123000 =0.123 * 106 0.123 6
0.000123 =0.123 * 10- 3
0.123 -3
Floating point representation of data is used to overcome the restrictions placed on the magnitude of numbers by
the size of computer’s memory locations.
Character
Character data, sometimes referred to as “string” data, may consist of any digits, letters of the alphabet or symbols
which, the internal coding system of the computer is capable of representing. Many programming languages
require character data to be enclosed by quotation marks when used in program instructions, for example PRINT
“HAPPY NEW YEAR”.
Boolean
Boolean data items are used as status indicators and may contain only one of two possible values: True or False.

91
Lecturer By: Biran Limbu, CODES Computer Consultant, Dharan, Nepal. Email:codes@[Link]

Application Package

Word Processor
A word processor, or word processing program, does exactly what the name implies. It processes words. It also
processes paragraphs, pages, and entire papers. Some examples of word processing programs include Microsoft
Word, WordPerfect (Windows only), AppleWorks (Mac only), and [Link].
The first word processors were basically computerized typewriters, which did little more than place characters on
a screen, which could then be printed by a printer. Modern word processing programs, however, include features
to customize the style of the text, change the page formatting, and may be able to add headers, footers, and page
numbers to each page. Some may also include a "Word Count" option, which counts the words and characters
within a document.

Word processing
Using a computer to create, edit, and print documents. Of all computer applications, word processing is the most
common. To perform word processing, you need a computer, a special program called a word processor, and a
printer. A word processor enables you to create a document, store it electronically on a disk, display it on a
screen, modify it by entering commands and characters from the keyboard, and print it on a printer.
The great advantage of word processing over using a typewriter is that you can make changes without retyping
the entire document. If you make a typing mistake, you simply back up the cursor and correct your mistake. If
you want to delete a paragraph, you simply remove it, without leaving a trace. It is equally easy to insert a word,
sentence, or paragraph in the middle of a document. Word processors also make it easy to move sections of text
from one place to another within a document, or between documents. When you have made all the changes you
want, you can send the file to a printer to get a hardcopy.
Word processors vary considerably, but all word processors support the following basic features:
• insert text: Allows you to insert text anywhere in the document.
• delete text: Allows you to erase characters, words, lines, or pages as easily as you can cross them out on paper.
• cut and paste : Allows you to remove (cut) a section of text from one place in a document and insert (paste) it
somewhere else.
• copy : Allows you to duplicate a section of text.
• page size and margins : Allows you to define various page sizes and margins, and the word processor will
automatically readjust the text so that it fits.
• search and replace : Allows you to direct the word processor to search for a particular word or phrase. You can
also direct the word processor to replace one group of characters with another everywhere that the first group
appears.
• word wrap : The word processor automatically moves to the next line when you have filled one line with text,
and it will readjust text if you change the margins.
• print: Allows you to send a document to a printer to get hardcopy.
Word processors that support only these features (and maybe a few others) are called text editors. Most word
processors, however, support additional features that enable you to manipulate and format documents in more
sophisticated ways. These more advanced word processors are sometimes called full-featured word processors.
Full-featured word processors usually support the following features:
• file management : Many word processors contain file management capabilities that allow you to create, delete,
move, and search for files.
92
Lecturer By: Biran Limbu, CODES Computer Consultant, Dharan, Nepal. Email:codes@[Link]

• font specifications: Allows you to change fonts within a document. For example, you can specify bold, italics,
and underlining. Most word processors also let you change the font size and even the typeface.
• footnotes and cross‐references: Automates the numbering and placement of footnotes and enables you to
easily cross‐reference other sections of the document.
• graphics graphics: Allows you to embed illustrations and graphs into a document. Some word processors let you
create the illustrations within the word processor; others let you insert an illustration produced by a different
program.
• headers , footers , and page numbering: Allows you to specify customized headers and footers that the word
processor will put at the top and bottom of every page. The word processor automatically keeps track of page
numbers so that the correct number appears on each page.
• layout : Allows you to specify different margins within a single document and to specify various methods for
indenting paragraphs.
• macros : A macro is a character or word that represents a series of keystrokes. The keystrokes can represent
text or commands. The ability to define macros allows you to save yourself a lot of time by replacing common
combinations of keystrokes.
• merges: Allows you to merge text from one file into another file. This is particularly useful for generating many
files that have the same format but different data. Generating mailing labels is the classic example of using
merges.
• spell checker : A utility that allows you to check the spelling of words. It will highlight any words that it does not
recognize.
• tables of contents and indexes: Allows you to automatically create a table of contents and index based on
special codes that you insert in the document.
• thesaurus: A built‐in thesaurus that allows you to search for synonyms without leaving the word processor.
• windows : Allows you to edit two or more documents at the same time. Each document appears in a separate
window. This is particularly valuable when working on a large project that consists of several different files.
• WYSIWYG (what you see is what you get): With WYSIWYG, a document appears on the display screen exactly
as it will look when printed.
The line dividing word processors from desktop publishing systems is constantly shifting. In general, though,
desktop publishing applications support finer control over layout, and more support for full-color documents.

Open:‐ This tools is used for displaying a dialogue box for opening existing files from the directory we specify. The
shortcut command for open is Ctrl+O
Save:‐ This tools is used for saving our current files that we are working with it or if we have not saved,i.e., our file if it is a
new one, then it prompts us to save as –where we neeed to specify the directory and the file name . The shortcut key for
save is Ctrl+S
Print:‐ This tools is used for printing our document or the document which we choose to print .The shortcut key for print
is Ctrl+P
Undo:‐ This tools is used for canceling any commands that we have used recently . The shortcut key for undo is Ctrl+Z
Redo: This tools is used for redoing whatever command or action we [Link] shortcut key for redo is Ctrl+Y
Text justification: ‐ when we click on this tools the text we type or selected will be justified, i.e., aligned on both sides. In
other word it is the combination of left and right alignment. The text appear to be balanced between left and right

93
Lecturer By: Biran Limbu, CODES Computer Consultant, Dharan, Nepal. Email:codes@[Link]

Find and replace: ‐ The tools Find is used for searching any text in the document, if such text is found we can replaced
by another text which we want to using the tools Replace. The shortcut key for find is Ctrl+F. The shortcut key for Replace
is Ctrl+H
Document formatting
Formatting a document is the way or process of changing the outlook of the document that means making the outlook of
the document attractive as per our desire using different document formatting tools such as changing font styles,
changing font sizes , changing alignment (right , left, centered, justified) making text bold, italic and putting underline for
headings , putting background on the pages, putting header and footer notes, inserting bullet and numbering where
necessary etc
Speller and thesaurus
Speller is a tool available in any word processing software by which we can check the spelling and grammar after each
word or after finishing the whole document. It got the facility of using different English language and even now it has gone
further including different international language, we can even include local words into its custom dictionary which can be
used so easily where as thesaurus is a tool which is used to see the word meanings, synonyms, antonyms etc of any words
and even can change the meanings and can add our own meanings to it.
Templates/Style Sheets
After designing a document, its format can be used again. Layout codes (margins, tabs, fonts, etc.) can be stored in a
template file (style sheet) and applied to a new document.
Mail Merge
Creates customized letters from a form letter and a list of names and addresses. The list can be created as a document or
can be imported from popular database formats.
Columns
Columns can be created in all word processors by tabbing to a tab stop. However, true column capability wraps words to
the next line within each column. Columns are required for writing resumes with employer information on the left and
work history on the right. Script writing also requires column capability. Magazine‐style columns flow words from the
bottom of one column to the top of the next.
Graphics Vs. Text Based
Graphics‐based programs (Windows, Macintosh, etc.) show a close facsimile on screen of the typefaces that will be
printed. Earlier text‐based DOS programs always show the same type size on screen.
Text‐based word processors are fine for typing letters and documents with a simple format. They are also very responsive
and good for creative writing. Some authors still use ancient DOS word processors because they are more flexible than
many GUI‐based products, and they run fine under Windows. Graphics‐based systems are necessary for preparing
newsletters and brochures that contain a variety of font styles and sizes.
The User Interface
Word processing programs run from the ridiculous to the sublime. Some of the most awkward programs have sold well. As
a novice, it is difficult to tell a good one from a bad one. It takes time to explore the nuances. Also, what is acceptable for
the slow typist can be horrendous for the fast typist.
Repetitive functions such as centering and changing display attributes (bold, italic, etc.) should be a snap. Changing
margins, tabs, indents and fonts should also be easy.
The most important component in word processing has nothing to do with software. The keyboard is the primary interface
between the user and the machine, and the feel of the keys is critical. Key placement is also important.

94
Lecturer By: Biran Limbu, CODES Computer Consultant, Dharan, Nepal. Email:codes@[Link]

Document Collaboration
Document and file collaboration is a term used to describe tools or systems set up to help multiple people work together
on a single document or file to achieve a single final version. Normally, this refers to software which allows teams to work
on a single document, such as a Word document, at the same time from different computer terminals or mobile devices.
Hence, document or file collaboration today is a system allowing people to collaborate across different locations using an
Internet, or "cloud", enabled approach.
Word Art
WordArt is a text‐styling feature that is available in the Microsoft Office suite of products. It allows users to create stylized
text with various "special effects" such as textures, outlines, and many other manipulations that are not available through
the standard font formatting. For example, one can create shadows, rotate, "bend" and "stretch" the shape of the text.

Spread Sheet
A spreadsheet is a computer application with tools that increase the user's productivity in capturing, analyzing, and
sharing tabular data sets. It displays multiple cells usually in a two‐dimensional matrix or grid consisting of rows and
columns (in other words, a table, hence "tabular"). Each cell contains alphanumeric text, numeric values, or formulas. A
formula defines how the content of that cell is to be calculated from the contents of any other cell (or combination of
cells) each time any cell is updated. A pseudo third dimension to the matrix is sometimes applied as another layer, or
layers/sheets, of two‐dimensional data.
Spreadsheets developed as computerized simulations of paper accounting worksheets. They boost productivity because of
their ability to re‐calculate the entire sheet automatically after a change to a single cell is made (which was a manual
process in the days of paper ledgers). Spreadsheets have now replaced paper‐based systems throughout the business
world, with any exceptions being rare, because of the much greater productivity that they make possible, and thus the
competitive disadvantage of spreadsheet illiteracy. Although they were first developed for accounting or bookkeeping
tasks, they now are used extensively in any context where tabular lists are built, sorted, and shared.

Spread Sheet Concepts


The main concepts are those of a grid of cells, called sheet, with either raw data, called values, or formulas in the cells.
Formulas say how to mechanically compute new values from existing values. Values are generally numbers, but can be
also pure text, dates, months, etc. Extensions of these concepts include logical spreadsheets. Various tools for
programming sheets, visualizing data, remotely connecting sheets, displaying cells dependencies, etc. are commonly
provided.
Cells
A "cell" can be thought of as a box for holding a datum. A single cell is usually referenced by its column and row (A2 would
represent the cell below containing the value 10). Usually rows, representing the dependant variables, are referenced in
decimal notation starting from 1, while columns representing the independent variables using the letters A‐Z as numerals.
Its physical size can usually be tailored for its content by dragging its height or width at box intersections (or for entire
columns or rows by dragging the column or rows headers).
Cell formatting
Depending on the capability of the spreadsheet application, each cell (like its counterpart the "style" in a word processor)
can be separately formatted using the attributes of either the content (point size, color, bold or italic) or the cell (border
thickness, background shading, color). To aid the readability of a spreadsheet, cell formatting may be conditionally applied
to data ‐ for example, a negative number may be displayed in red.
95
Lecturer By: Biran Limbu, CODES Computer Consultant, Dharan, Nepal. Email:codes@[Link]

A cell's formatting does not typically affect its content and depending on how cells are referenced or copied to other
worksheets or applications, the formatting may not be carried with the content.
Cell reference
In place of a named cell, an alternative approach is to use a cell (or grid) reference. Most cell references indicate another
cell in the same spreadsheet, but a cell reference can also refer to a cell in a different sheet within the same spreadsheet,
or (depending on the implementation) to a cell in another spreadsheet entirely, or to a value from a remote application.
A typical cell reference in "A1" style consists of one or two case‐insensitive letters to identify the column (if there are up to
256 columns: A‐Z and AA‐IV) followed by a row number (e.g. in the range 1‐65536). Either part can be relative (it changes
when the formula it is in is moved or copied), or absolute (indicated with $ in front of the part concerned of the cell
reference). The alternative "R1C1" reference style consists of the letter R, the row number, the letter C, and the column
number; relative row or column numbers are indicated by enclosing the number in square brackets. Most current
spreadsheets use the A1 style, some providing the R1C1 style as a compatibility option.
When the computer calculates a formula in one cell to update the displayed value of that cell, cell reference(s) in that cell,
naming some other cell(s), cause the computer to fetch the value of the named cell(s).
Cell ranges
Likewise, instead of using a named range of cells, a range reference can be used. Reference to a range of cells is typically
of the form (A1:A6) which specifies all the cells in the range A1 through to A6. A formula such as "=SUM(A1:A6)" would
add all the cells specified and put the result in the cell containing the formula itself.
Data format
A cell or range can optionally be defined to specify how the value is displayed. The default display format is usually set by
its initial content if not specifically previously set, so that for example "31/12/2007" or "31 Dec 2007" would default to the
cell format of "date". Similarly adding a % sign after a numeric value would tag the cell as a percentage cell format. The cell
contents are not changed by this format, only the displayed value.
Some cell formats such as "numeric" or "currency" can also specify the number of decimal places.
Sheets
In the earliest spreadsheets, cells were a simple two‐dimensional grid. Over time, the model has been expanded to include
a third dimension, and in some cases a series of named grids, called sheets. The most advanced examples allow inversion
and rotation operations which can slice and project the data set in various ways.
Formulas
A formula identifies the calculation needed to place the result in the cell it is contained within. A cell containing a formula
therefore has two display components; the formula itself and the resulting value. The formula is normally only shown
when the cell is selected by "clicking" the mouse over a particular cell; otherwise it contains the result of the calculation.
A formula assigns values to a cell or range of cells, and typically has the format:
=expression
Where the expression consists of:
• values, such as 2, 9.14 or 6.67E-11;
• references to other cells, such as, e.g., A1 for a single cell or B1:B3 for a range;
• arithmetic operators, such as +, -, *, /, and others;
• relational operators, such as >=, <, and others; and,
• functions, such as SUM(), TAN(), and many others.

96
Lecturer By: Biran Limbu, CODES Computer Consultant, Dharan, Nepal. Email:codes@[Link]

Functions
Spreadsheets usually contain a number of supplied functions, such as arithmetic operations (for example, summations,
averages and so forth), trigonometric functions, statistical functions, and so forth. In addition there is often a provision for
user-defined functions.

Charts
Many spreadsheet applications permit charts, graphs or histograms to be generated from specified groups of cells which are
dynamically re-built as cell contents change. The generated graphic component can either be embedded within the current
sheet or added as a separate object.

Presentation
Presentation is the practice of showing and explaining the content of a topic to an audience or learner. Presentations come in
nearly as many forms as there are life situations. In the business world, there are sales presentations, informational and
motivational presentations, first encounters, interviews, briefings, status reports, image-building, and of course, the
inevitable training sessions. Presentations can also be categorized as vocational and a vocational. In addition, they are
expository or persuasive. And they can be impromptu, extemporaneous, written, or memorizes. When looking at
presentations in the broadest terms, it's more important to focus on their purpose. There are three basic purposes for giving
oral presentations:
1. To inform
2. To persuade (convince)
3. To build good will

Presentation program
A presentation program (also called a presentation graphics program) is a computer software package used to display
information, normally in the form of a slide show. It typically includes three major functions: an editor that allows text to be
inserted and formatted, a method for inserting and manipulating graphic images and a slide-show system to display the
content.

Microsoft PowerPoint
Microsoft PowerPoint is a full-featured desktop presentation program. It is part of the Office suite and can be purchased
separately. A presentation can be a collection of slides relating to a specific topic, which may be shown while the topic is
discussed or may be shown as a continuous show. From the presentation slides, handouts, speaker notes, or outlines can also
be prepared. PowerPoint contains graphic tools and many kinds of pictures and graphs to be imported. A Macintosh version
is available which functions almost identically to the Windows version. Presentations created in either platform can be run
from the other, without any conversion needed.

Slide
Slide is a page, document, or template where all the content of the presentation is written. In other word a single page in
the slide show presentation is known as slide
Presentation
Collection of more than one slide together on a particular topic is known as presentation
Presentation contain different slides, different contents, different objects and different animations
Slide show
Slide show is the way of presenting the slides to a mass of people in real sense. how the slides are flown from one to
another is defined in the slide show. It displays all the slides in full screen .This are the real world happening of the

97
Lecturer By: Biran Limbu, CODES Computer Consultant, Dharan, Nepal. Email:codes@[Link]

presentation. All the graphics, text flows, picture, animation can only seen in this show or views but can’t be added or
modified
Transactions
In Microsoft PowerPoint, slide transitions are motion effects that occur in Slide Show view when you move from one slide
to the next during a presentation. You can control the speed, add sound, and even customize the properties of transition
effects. To add a transition first of all select a slide in the left hand panel that contains the Slides and Outline tabs (I'd keep
it simple and work in the Slides tab). The transition will occur immediately before the selected slide is displayed. Click
Transitions > Transition To This Slide, and then click on the transition you want to use. If you want to see a larger selection
of transitions, click on the more button (the down arrow at the bottom right of the group.

Features of PowerPoint presentation:


Creating A New And Opening An Existing Presentation
• Creating A New Presentation
• Creating A New Presentation Based On A Template
• Opening An Existing Presentation

PowerPoint Basic Tasks


• Adding New Slides
• Deleting Slides
• Moving Slides
• PowerPoint Views
• Modifying Backgrounds

Templates
• Applying PowerPoint Templates
• Creating Your Own PowerPoint Template

PowerPoint Text
• Using Textboxes
• Content Placeholders
• Formatting Text

Graphics
• Insert Powerpoint Image
• Using Clipart Images
• PowerPoint Transitions
• Creating Animations
• Adding Sounds

Miscellaneous PowerPoint Tasks


• Powerpoint Spell Check
• Running The Slideshow
• Pointer Options
• Saving Presentations
• Saving As A Web Page
• Printing Presentations
98
Lecturer By: Biran Limbu, CODES Computer Consultant, Dharan, Nepal. Email:codes@[Link]

Internet and E-mail


Introduction of Internet
The Internet, sometimes called simply "the Net," is a worldwide system of computer networks ‐ a network of networks in
which users at any one computer can, if they have permission, get information from any other computer (and sometimes
talk directly to users at other computers). It was conceived by the Advanced Research Projects Agency (ARPA) of the U.S.
government in 1969 and was first known as the ARPANet. The original aim was to create a network that would allow users
of a research computer at one university to be able to "talk to" research computers at other universities. A side benefit of
ARPANet's design was that, because messages could be routed or rerouted in more than one direction, the network could
continue to function even if parts of it were destroyed in the event of a military attack or other disaster.

Use of Internet
The Internet is a worldwide collection of computer networks, cooperating with each other to exchange data using a common
software standard. Through telephone wires and satellite links, Internet users can share information in a variety of forms.
The size, scope and design of the Internet allows users to:
• connect easily through ordinary personal computers and local phone numbers;
• exchange electronic mail (E-mail) with friends and colleagues with accounts on the Internet;
• post information for others to access, and update it frequently;
• access multimedia information that includes sound, photographic images and even video; and
• Access diverse perspectives from around the world.
• Sharing research and business data among colleagues and like-minded individuals.
• Communicating with others and transmitting files via E-mail.
• Requesting and providing assistance with problems and questions.
• Marketing and publicizing products and services.
• Gathering valuable feedback and suggestions from customers and business partners.

An additional attribute of the Internet is that it lacks a central authority—in other words, there is no "Internet, Inc." that
controls the Internet. Beyond the various governing boards that work to establish policies and standards, the Internet is
bound by few rules and answers to no single organization.

Concept of Protocols
HTTP (Hypertext Transfer Protocol) is the set of rules for transferring files (text, graphic images, sound, video, and other
multimedia files) on the World Wide Web. As soon as a Web user opens their Web browser, the user is indirectly making
use of HTTP. HTTP is an application protocol that runs on top of the TCP/IP suite of protocols (the foundation protocols for
the Internet).
HTTP concepts include (as the Hypertext part of the name implies) the idea that files can contain references to other files
whose selection will elicit additional transfer requests. Any Web server machine contains, in addition to the Web page files
it can serve, an HTTP daemon, a program that is designed to wait for HTTP requests and handle them when they arrive.
Your Web browser is an HTTP client, sending requests to server machines. When the browser user enters file requests by
either "opening" a Web file (typing in a Uniform Resource Locator or URL) or clicking on a hypertext link, the browser
builds an HTTP request and sends it to the Internet Protocol address (IP address) indicated by the URL. The HTTP daemon
in the destination server machine receives the request and sends back the requested file or files associated with the request.
(A Web page often consists of more than one file.)

99
Lecturer By: Biran Limbu, CODES Computer Consultant, Dharan, Nepal. Email:codes@[Link]

Web Browser, Web Page, Website, Web Server, URL, DNS

Web Browser
A web browser is a software application for retrieving, presenting, and traversing information resources on the World Wide
Web. An information resource is identified by a Uniform Resource Identifier (URI) and may be a web page, image, video,
or other piece of content. Hyperlinks present in resources enable users easily to navigate their browsers to related resources.
A web browser can also be defined as an application software or program designed to enable users to access, retrieve and
view documents and other resources on the Internet.
Although browsers are primarily intended to access the World Wide Web, they can also be used to access information
provided by web servers in private networks or files in file systems. The major web browsers are Firefox, Google Chrome,
Internet Explorer, Opera, and Safari.

Web Page
A web page or webpage is a document or information resource that is suitable for the World Wide Web and can be accessed
through a web browser and displayed on a monitor or mobile device. This information is usually in HTML or XHTML
format, and may provide navigation to other web pages via hypertext links. Web pages frequently subsume other resources
such as style sheets, scripts and images into their final presentation.
Web pages may be retrieved from a local computer or from a remote web server. The web server may restrict access only to
a private network, e.g. a corporate intranet, or it may publish pages on the World Wide Web. Web pages are requested and
served from web servers using Hypertext Transfer Protocol (HTTP).

Website
A website, also written as Web site, web site, or simply site, is a set of related webpages containing content (media),
including text, video, music, audio, images, etc. A website is hosted on at least one web server, accessible via a network
such as the Internet or a private local area network through an Internet address known as a Uniform Resource Locator. All
publicly accessible websites collectively constitute the World Wide Web.
A webpage is a document, typically written in plain text interspersed with formatting instructions of Hypertext Markup
Language (HTML, XHTML). A webpage may incorporate elements from other websites with suitable markup anchors.

Web Server
Web server can refer to either the hardware (the computer) or the software (the computer application) that helps to deliver
content that can be accessed through the Internet.
The most common use of web servers is to host web sites but there are other uses such as data storage or running enterprise
applications. The primary function of a web server is to deliver web pages on the request to clients. This means delivery of
HTML documents and any additional content that may be included by a document, such as images, style sheets and scripts.

URL(Uniform resource locator)


A uniform resource locator or universal resource locator (URL) is a specific character string that constitutes a reference to
an Internet resource. A URL is technically a type of uniform resource identifier (URI) but in many technical documents and
verbal discussions URL is often used as a synonym for URI. Every URL consists of some of the following: the scheme
name (commonly called protocol), followed by a colon, two slashes then depending on scheme, a domain name
(alternatively, IP address), a port number, the path of the resource to be fetched or the program to be run, then, for programs
such as Common Gateway Interface (CGI) scripts, a query string and an optional fragment identifier. For example:-
Http://[Link]

DNS
The Domain Name System (DNS) is a hierarchical distributed naming system for computers, services, or any resource
connected to the Internet or a private network. It associates various information with domain names assigned to each of the
participating entities. Most importantly, it translates domain names meaningful to humans into the numerical identifiers
associated with networking equipment for the purpose of locating and addressing these devices worldwide. The Domain

100
Lecturer By: Biran Limbu, CODES Computer Consultant, Dharan, Nepal. Email:codes@[Link]

Name System makes it possible to assign domain names to groups of Internet resources and users in a meaningful way,
independent of each entity's physical location. Because of this, World Wide Web (WWW) hyperlinks and Internet contact
information can remain consistent and constant even if the current Internet routing arrangements change or the participant
uses a mobile device. Internet domain names are easier to remember than IP addresses such as [Link]. Users take
advantage of this when they recite meaningful Uniform Resource Locators (URLs) and e-mail addresses without having to
know how the computer actually locates them.
The Domain Name System distributes the responsibility of assigning domain names and mapping those names to IP
addresses by designating authoritative name servers for each domain. Authoritative name servers are assigned to be
responsible for their particular domains, and in turn can assign other authoritative name servers for their sub-domains. This
mechanism has made the DNS distributed and fault tolerant and has helped avoid the need for a single central register to be
continually consulted and updated.
In general, the Domain Name System also stores other types of information, such as the list of mail servers that accept email
for a given Internet domain. By providing a worldwide, distributed keyword-based redirection service, the Domain Name
System is an essential component of the functionality of the Internet.

Search Engine, Messenger Services

Search Engine
A web search engine is designed to search for information on the World Wide Web and FTP servers. The search results are
generally presented in a list of results often referred to as SERPS, or "search engine results pages". The information may
consist of web pages, images, information and other types of files. Some search engines also mine data available in
databases or open directories. Unlike web directories, which are maintained only by human editors, search engines also
maintain real-time information by running an algorithm on a web crawler (sometimes also known as a spider). When a user
enters a query into a search engine (typically by using key words), the engine examines its index and provides a listing of
best-matching web pages according to its criteria, usually with a short summary containing the document's title and
sometimes parts of the text. World most used Search engines are [Link], [Link], [Link], [Link], [Link],
[Link] ect.

Messenger Services
A messenger service can come in two forms: Instant Messaging and WinPopUp
Instant Messaging
Instant messaging (IM) is a form of real-time direct text-based chatting communication in push mode between two or more
people using personal computers or other devices, along with shared clients. The user's text is conveyed over a network,
such as the Internet. More advanced instant messaging software clients also allow enhanced modes of communication, such
as live voice or video calling and inclusion of links to media.

WinPopUp
Winpopup sends messages from one Windows computer to another on the same LAN. It is available in all Windows
versions from Windows for Workgroups 3.1 to Windows Me, but has never been included with Windows NT-based
operating systems.
There is also a port to Linux with an extended feature called LinPopUp, which allows adding Linux computers to the set.
Linpopup is an X Window graphical port of Winpopup, and a package for Debian linux. It runs over Samba. Linpopup does
not have to run all the time, can run minimized, and its messages are encrypted with a strong cypher.

E-mail
Electronic mail, commonly known as email or e-mail, is a method of exchanging digital messages from an author to one or
more recipients. Modern email operates across the Internet or other computer networks. Some early email systems required
101
Lecturer By: Biran Limbu, CODES Computer Consultant, Dharan, Nepal. Email:codes@[Link]

that the author and the recipient both be online at the same time, in common with instant messaging. Today's email systems
are based on a store-and-forward model. Email servers accept, forward, deliver and store messages. Neither the users nor
their computers are required to be online simultaneously; they need connect only briefly, typically to an email server, for as
long as it takes to send or receive messages.
An email message consists of three components, the message envelope, the message header, and the message body. The
message header contains control information, including, minimally, an originator's email address and one or more recipient
addresses. Usually descriptive information is also added, such as a subject header field and a message submission date/time
stamp.

Different types of E-mail Account


Web Mail
Web-based email is also known as Web Mail or browser-based email because it uses your browser and the Internet as tools
to access your email account. Web-based email possesses virtually all the functionality of other types of email and allows
access from anywhere in the world. Web Mail is characterized by its mobility and ease of use because there is no
configuration. Our Web-based email technology is no exception as it requires no configuration - for the end-user it's as
simple arriving to the address (URL) of your email site and entering a username and password. Enter Group Web-based
email has all the standard functionality associated with POP mail, allowing users to:
Send, receive, forward and reply to email messages
Send and receive attachments
Create and manage folders
Create and manage contacts
Check mail from other POP email accounts
Customize signatures, identities and other preferences
Edit Passwords
Utilize auto-forwarding and vacation auto-responses

POP Mail
POP (Post Office Protocol) mail is normally used in conjunction with 3rd party email management software like Outlook or
Eudora on your own computer. To receive mail with a POP mail account an end users connects to a shared mail server and
then downloads all the new mail to their computer. Thereafter, your 3rd party email software located on your computer
enables you to read, send and perform all the other management functions. Your computer (also known as the client side) is
responsible for storing emails (also referred to as storing emails locally). POP mail is like a store-and-forward service,
moving mail on demand normally from a mail server to a single local client computer. Once an email is delivered to the
client software, the message is typically deleted from the POP server.

IMAP
IMAP (Internet Message Access Protocol) combines features of Web-mail and POP mail allowing you to access email from
your local server. IMAP is more useful for businesses that have their own servers. IMAP is a client/server protocol in which
your server receives and stores messages while the client computer displays the header and sender of the email. This system
allows you to decide whether or not you would like to download the message. Even when downloaded, messages remain on
the server. You can also delete messages, manipulate folders and accounts and manage other features on the server. Email
stored on an IMAP server can be manipulated from many mediums such as home desktops, office workstations and laptops.
IMAP provides mobility and convenience, eliminating the need to transfer messages or files back and forth between
different computers.

102
Lecturer By: Biran Limbu, CODES Computer Consultant, Dharan, Nepal. Email:codes@[Link]

Web Page Designing (HTML)


Web pages are written in HTML - a simple scripting language. HTML is short for Hyper Text Markup Language.
• Hypertext is simply a piece of text that works as a link.
• Markup Language is a way of writing layout information within documents.
Basically an HTML document is a plain text file that contains text and nothing else. When a browser opens an HTML file,
the browser will look for HTML codes in the text and use them to change the layout, insert images, or create links to other
pages. Since HTML documents are just text files they can be written in even the simplest text editor. A more popular choice
is to use a special HTML editor - maybe even one that puts focus on the visual result rather than the codes - a so-called
WYSIWYG editor ("What You See Is What You Get"). Some of the most popular HTML editors, such as FrontPage or
Dreamweaver will let you create pages more or less as you write documents in Word or whatever text editor you're using.
You can write your HTML by hand with almost any available text editor, including notepad that comes as a standard
program with Windows. All you need to do is type in the code, then save the document, making sure to put an .html
extension or an .htm extension to the file (for instance "[Link]").

Elements and tags


You are now ready to learn the essence of HTML:
Elements.
Elements give structure to a HTML document and tells the browser how website to be presented. Generally elements consist
of a start tag, some content, and an end tag.
Tags
Tags are labels you use to mark up the beginning and end of an element. All tags have the same format: they begin with a
less-than sign "<" and end with a greater-than sign ">". Generally speaking, there are two kinds of tags - opening tags:
<html> and closing tags: </html>. The only difference between an opening tag and a closing tag is the forward slash "/".
Label content by putting it between an opening tag and a closing tag. HTML is all about elements. To learn HTML is to
learn and use different tags.

Example:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html>
<head>
<title>Example</title>
</head>
<body>
<p>Hello World!</p>
</body>
</html>
Explanation of the above code:
• The <!DOCTYPE... > element tells the browser which version of HTML the document is using.
• The <html> element can be thought of as a container that all other tags sit inside (except for the !DOCTYPE tag).
• The <head> tag contains information that is not normally viewable within your browser (such as meta tags, JavaScript and
CSS), although the <title> tag is an exception to this. The content of the <title> tag is displayed in the browser's title bar
(right at the very top of the browser).
• The <body> tag is the main area for your content. This is where most of your code (and viewable elements) will go.
• The <p> tag declares a paragraph. This contains the body text.

103
Lecturer By: Biran Limbu, CODES Computer Consultant, Dharan, Nepal. Email:codes@[Link]

Detail about all the different aspects of HTML, including:


• Text: Formatting, Resizing, Layout, Listing,
• Links: To local pages, To pages at other sites, To bookmarks
• Images: Inserting images (GIF and jpg), Adding a link to an image
• Backgrounds: Colors, Images, Fixed Image
• Tables
• Frames
• Forms
BACKGROUND COLOR
<body bgcolor="#FF0000">
BACKGROUND IMAGE
<body background="[Link]"> or
<body background="[Link]" bgcolor="#333333"> or
<body background="[Link]" bgproperties="fixed">
Text: Formatting
Headings
There is a special tag for specifying headings in HTML. There are 6 levels of headings in HTML ranging from h1 for the most
important, to h6 for the least important.
Typing this code:
<h1>Heading 1</h1>
<h2>Heading 2</h2>
<h3>Heading 3</h3>
<h4>Heading 4</h4>
<h5>Heading 5</h5>
<h6>Heading 6</h6>

BASE FONT
To specify the overall font for your page add the <basefont> tag at the beginning of the <body> section.
Example:
<body>
<basefont face="arial, verdana, courier" size="4" color="green">
Hello! This is my page.<br>
All text looks the same<br>
since I only specified a basefont.<br>
</body>

FONT
The <font> tag will change the font (Size 1‐7). Example:
<font color="red" face="arial" size="2">This local text looks different.</font>
TEXT FORMAT

These are the tags for text formats:


<b>text</b> writes text as bold
<i>text</i> writes text in italics
<u>text</u> writes underlined text
<sub>text</sub> lowers text and makes it smaller

104
Lecturer By: Biran Limbu, CODES Computer Consultant, Dharan, Nepal. Email:codes@[Link]

<sup>text</sup> lifts text and makes it smaller


<blink>text</blink> guess yourself! (Note: Netscape only.)
<strike>text</strike> strikes a line through the text
<tt>text</tt> writes text as on a classic typewriter
<pre>text</pre> writes text exactly as it is, including spaces.
<em>text</em> usually makes text italic
<strong>text<strong> usually makes text bold
<big>text</big> increase the size by one

<small>text</small> decrease the size by one

TEXT LAYOUT
These tags will let you control the layout.

HTML EXPLANATION
Adds a paragraph break after the
<p>text</p> text.
(2 linebreaks).
<p align="left">text</p> Left justify text in paragraph.
<p align="center">text</p> Center text in paragraph.
<p align="right">text</p> Right justify text in paragraph.
Adds a single linebreak where the
text<br>
tag is.
Turns off automatic linebreaks
<pre>text</pre>

Allows the browser to insert a


linebreak
text<wbr> at exactly this point
- even if the text is within <nobr>
tags.
<center>text</center> Center text.
<div
Center text.
align="center">text</div>
<div align="left">text</div> Left justify text.
<div align="right">text</div> Right justify text.

105
Lecturer By: Biran Limbu, CODES Computer Consultant, Dharan, Nepal. Email:codes@[Link]

Horizontal Rule
Typing this code:
Here's a horizontal rule... <hr /> ...that was a horizontal rule :)

HTML Lists
Unordered (un-numbered) List or BULLETED LISTS
Bullet options:
• disc
• circle
• square
Syntax.

HTML-CODE EXPLANATION / EXAMPLE


Makes a bulleted list using the default bullet type:
<ul>
<li>text</li> • text
<li>text</li> • text
<li>text</li> • text
</ul>

Starts a bulleted list using discs as bullets:

• This is one line


<ul type="disc"> • This is another line
• And this is the final line

Starts a bulleted list using circles as bullets:

o This is one line


<ul type="circle"> o This is another line
o And this is the final line

Starts a bulleted list using squares as bullets:

ƒ This is one line


<ul type="square">
ƒ This is another line
ƒ And this is the final line

<ul>
<li>List item 1</li>
<li>List item 2</li>
<li>List item 3</li>
</ul>
Ordered (numbered) List
Number options:
• Plain numbers
• Capital Letters
106
Lecturer By: Biran Limbu, CODES Computer Consultant, Dharan, Nepal. Email:codes@[Link]

• Small Letters
• Capital Roman Numbers
• Small Roman Numbers
syntax.

HTML-CODE EXPLANATION / EXAMPLE


Makes a numbered list using the default number type:
<ol>
<li>text</li> 1. text
<li>text</li> 2. text
<li>text</li> 3. text
</ol>

Starts a numbered list, first # being 5.

5. This is one line


<ol start="5"> 6. This is another line
7. And this is the final line

Starts a numbered list, using capital letters.

A. This is one line


<ol type="A"> B. This is another line
C. And this is the final line

Starts a numbered list, using small letters.

a. This is one line


<ol type="a"> b. This is another line
c. And this is the final line

Starts a numbered list, using capital roman numbers.

I. This is one line


<ol type="I"> II. This is another line
III. And this is the final line

Starts a numbered list, using small roman numbers.

i. This is one line


<ol type="i"> ii. This is another line
iii. And this is the final line

<ol type="1"> Starts a numbered list, using normal numbers.

107
Lecturer By: Biran Limbu, CODES Computer Consultant, Dharan, Nepal. Email:codes@[Link]

1. This is one line


2. This is another line
3. And this is the final line

An example of how type and start can be combined.

VII. This is one line


<ol type="I" start="7"> VIII. This is another line
IX. And this is the final line

Typing this code:


<ol>
<li>List item 1</li>
<li>List item 2</li>
<li>List item 3</li>
</ol>

HTML Attributes
HTML tags can contain one or more attributes. Attributes are added to a tag to provide the browser with more information
about how the tag should appear or behave. Attributes consist of a name and a value separated by an equals (=) sign.
Example
Consider this example:
<body style="background-color:orange">
This particular attribute statement, style="background-color:orange", tells the browser to style the body element with a
background color of orange.
The browser knows to make the background color orange because we are using standard HTML tags and attributes (along
with standard Cascading Style Sheets code) for setting the color.

HTML Colors
In HTML, colors can be added by using the style attribute. You can specify a color name (eg, blue), a hexadecimal value
(eg, #0000ff), or an RGB value (eg rgb(0,0,255)).
Syntax
Foreground Color
To add color to an HTML element, you use style="color:{color}", where {color} is the color value. For example:
<h3 style="color:blue">HTML Colors</h3>

Background Color
To add a background color to an HTML element, you use style="background-color:{color}", where {color} is the color
value. For example:
<h3 style="background-color:blue">HTML Colors</h3>
Border Color
To add a colored border to an HTML element, you use style="border:{width} {color} {style}", where {width} is the width
of the border, {color} is the color of the border, and {style} is the style of the border. For example:
<h3 style="border:1px blue solid;">HTML Colors</h3>
This results in:
HTML Colors

108
Lecturer By: Biran Limbu, CODES Computer Consultant, Dharan, Nepal. Email:codes@[Link]

Color Names
The most common methods for specifying colors are by using the color name or the hexadecimal value. Although color
names are easier to remember, the hexadecimal values and RGB values provides you with more color options.
Hexadecimal values are a combination of letters and numbers. The numbers go from 0 - 9 and the letters go from A to F.
When using hexadecimal color values in your HTML/CSS, you preceed the value with a hash (#). Although hexadecimal
values may look a little weird at first, you'll soon get used to them.
There are 16 color names (as specified in the HTML 4.0 specification). The chart below shows these color names and their
corresponding hexadecimal value.
Color Name Hexadecimal Value Color Name Hexadecimal Value
Black #000000 Green #008000
Silver #c0c0c0 Lime #00ff00
Gray #808080 Olive #808000
White #ffffff Yellow #ffff00
Maroon #800000 Navy #000080
Red #ff0000 Blue #0000ff
Purple #800080 Teal #008080
Fushia #ff00ff Aqua #00ffff
You can make up your own colors by simply entering any six digit hexadecimal value (preceeded by a hash). In the
following example, we're using the same code as above. The only difference is that, instead of using "blue" as the value,
we're using its hexadecimal equivalent (which is #0000ff):
<h3 style="color:#0000ff">HTML Colors</h3>

HTML Links
Links, otherwise known as hyperlinks, are defined using the <a> tag - otherwise known as the anchor element.
To create a hyperlink, you use the a tag in conjunction with the href attribute (href stands for Hypertext Reference). The
value of the href attribute is the URL, or, location of where the link is pointing to.
Example HTML Code:
More information <a href="[Link] school</a>

Hypertext references can use absolute URLS, relative URLs, or root relative URLs.
Absolute
This refers to a URL where the full path is provided. For example, [Link]
Relative
This refers to a URL where only the path, relative to the current location, is provided. For example, if we want to reference
the [Link] URL, and our current location is [Link] we
would use tutorial/[Link]
Root relative
This refers to a URL where only the path, relative to the domain's root, is provided. For example, if we want to reference the
[Link] URL, and the current location is [Link] we would
use /html/tutorial/[Link]. The forward slash indicates the domain's root. This way, no matter where your file is located,
you can always use this method to determine the path, even if you don't know what the domain name will eventually be.
COLORS ON TEXT LINKS
The general color of text links is specified in the <body> tag, like in the example below:

109
Lecturer By: Biran Limbu, CODES Computer Consultant, Dharan, Nepal. Email:codes@[Link]

<body link="#C0C0C0" vlink="#808080" alink="#FF0000">

• link - standard link - to a page the visitor hasn't been to yet. (standard color is blue - #0000FF).
• vlink - visited link - to a page the visitor has been to before. (standard color is purple - #800080).
• alink - active link - the color of the link when the mouse is on it. (standard color is red - #FF0000).

Link Targets
You can nominate whether to open the URL in a new window or the current window. You do this with the target attribute.
For example, target="_blank" opens the URL in a new window.
The target attribute can have the following possible values:
_blank Opens the URL in a new browser window.
_self Loads the URL in the current browser window.
Loads the URL into the parent frame (still within the current browser window). This is only applicable when
_parent
using frames.
Loads the URL in the current browser window, but cancelling out any frames. Therefore, if frames were being
_top
used, they aren't any longer.
Example HTML Code:
Check out this <a href="[Link] target="_blank">depot school students</a>

Named Anchors (within the page)


You can make your links "jump" to other sections within the same page. You do this with named anchors.
To use named anchors, you need to create two pieces of code - one for the hyperlink (this is what the user will click on), and
one for the named anchor (this is where they will end up).
This page uses a named anchor. I did this by performing the steps below:
Example HTML Code:
<h2>Link Targets<a name="link_targets"></a></h2>
This is done by linking to the name of the named anchor. You need to precede the name with a hash (#) symbol.
Example HTML Code:
<a href="#link_targets">Link Targets</a>

Email Links
You can create a hyperlink to an email address. To do this, use the mailto attribute in your anchor tag.
Example HTML Code:
<a href="[Link] King Kong</a>
Clicking on this link should result in your default email client opening up with the email address already filled out.
Example HTML Code:
<a href="[Link] there">Email King Kong</a>

HTML Images

Images make up a large part of the web - most websites contain images. HTML makes it very easy for you to embed images
into your web page.
To embed an image into a web page, the image first needs to exist in either .jpg, .gif, or .png format. You can create images
in an image editor (such as Adobe Photoshop) and save them in the correct format.
Once you've created an image, you need to embed it into your web page. To embed the image into your web page, use the
<img /> tag, specifying the actual location of the image.
Example of Image Usage
HTML Code:
<img src="[Link]" width="100" height="100" alt="Smile" />

110
Lecturer By: Biran Limbu, CODES Computer Consultant, Dharan, Nepal. Email:codes@[Link]

The img above contains a number of attributes. These attributes tell the browser all about the image and how to display it.
Here's an explanation of these attributes:
Required attribute. This is the path to the image. It can be either an absolute path, or a relative path (remember these
src
terms from our last lesson?)
Optional attribute (but recommended). This specifies the width to display the image. If the actual image is wider, it
will shrink to the dimensions you specify here. Likewise, if the actual image is smaller it will expand to your
width
dimensions. I don't recommend specifying a different size for the image, as it will lose quality. It's better to make
sure the image is the correct size to start with.
Optional attribute (but recommended). This specifies the height to display the image. This attribute works similar to
height
the width.
alt Alternate text. This specifies text to be used in case the browser/user agent can't render the image.
border Image border

Image Alignment
You can determine how your images will be aligned, relative to the other content on the page (such as a paragraph of text).
You do this using the align attribute (left, right, top, middle, bottom).
HTML Code:
<p>
<img src="[Link]" width="100" height="100" alt="Smile" align="right"/>Here is a paragraph of text aligned to the right
</p>

Image Links
You can make your images "clickable" so that when a user clicks the image, it opens another URL. You do this by simply
wrapping the image with hyperlink code.
HTML Code:
<a href="[Link]
<img src="[Link]
width="100" height="100" alt="Smile" />
</a>
Image Border
You might notice that this has created a border around the image. This is default behaviour for most browsers. If you don't
want the border, specify border="0".
HTML Code:
<a href="[Link]
<img src="[Link]" width="100" height="100" alt="Smile" border="0" /></a>

IMAGE MAPPING
It is possible to make one image link to several pages, depending on where the image is clicked.
<img src="[Link]" usemap = #example border=0>
<map name=example>
<area shape=Rect Coords=0,0,29,29 Href="[Link]
<area shape=Rect Coords=30,30,59,59 Href="[Link]
</map>
In the above example we only used rectangular imagemappings. Possible shapes are:
• <area shape=rect coords= x1,y1, x2,y2 Href="[Link]
• <area shape=circle coords= x1,y1, x2,y2 Href="[Link]
• <area shape=polygon coords= x1,y1, x2,y2, .., xn,yn Href="[Link]

111
Lecturer By: Biran Limbu, CODES Computer Consultant, Dharan, Nepal. Email:codes@[Link]

HTML Comments
Comments are a part of the HTML code and is used to explain the code. This can be helpful for other HTML coders when
trying to interpret someone elses code. It can also be useful for yourself if you have to revisit your code in many months, or
even years time. Comments aren't displayed in the browser - they are simply there for the programmer's benefit.
You write comments like this:
<!-- Write your comment here -->
Comments always start with <!-- and end with -->. This tells the browser when a comment begins and ends.
Example HTML Code:
<-- Display a happy image --->
<img src=[Link] width="100" height="100" alt="Smile" />

HTML Tables
In HTML, the original purpose of tables was to present tabular data. Although they are still used for this purpose today,
many web designers tended to use tables for advanced layouts. This is probably due to the restrictions that HTML has on
layout capabilities - it wasn't really designed as a layout language.
Anyway, whether you use tables for presenting tabular data, or for page layouts, you will use the same HTML tags.
Basic table tags
In HTML, you create tables using the table tag, in conjunction with the tr and td tags. Although there are other tags for
creating tables, these are the basics for creating a table in HTML.
HTML Code:
<table border="1">
<tr>
<td>Table cell 1</td><td>Table cell 2</td>
</tr>
</table>
This results in:
Table cell 1 Table cell 2
You'll notice that we added a border attribute to the table tag. This particular attribute allows us to specify how thick the
border will be. If we don't want a border we can specify 0 (zero). Other common attributes you can use with your table tag
include width, width, cellspacing and cellpadding.
You can also add attributes to the tr and td tags. For example, you can specify the width of each table cell.
Widths can be specified in either pixels or percentages. Specifying the width in pixels allows you to specify an exact width.
Percentages allows the table to "grow" or "shrink" depending on what else is on the page and how wide the browser is.
HTML Code:
<table border="1" cellpadding="5" cellspacing="5" width="100%">
<tr>
<td width="20%">Table cell 1</td><td>Table cell 2</td>
</tr>
</table>
This results in:
Table cell 1 Table cell 2

Table Headers
Many tables, particularly those with tabular data, have a header row or column. In HTML, you can use the th tag.
Most browsers display table headers in bold and center-aligned.
HTML Code:
<table border="1" cellpadding="5" cellspacing="5" width="100%">
<tr>
<th>Table header</th>
<th>Table header</th>
112
Lecturer By: Biran Limbu, CODES Computer Consultant, Dharan, Nepal. Email:codes@[Link]

</tr>
<tr>
<td width="20%">Table cell 1</td><td>Table cell 2</td>
</tr>
</table>
This results in:
Table header Table header

Table cell 1 Table cell 2

Colspan
You can use the colspan attribute to make a cell span multiple columns.
HTML Code:
<table border="1" cellpadding="5" cellspacing="5" width="100%">
<tr>
<th colspan="2">Table header</th>
</tr>
<tr>
<td width="20%">Table cell 1</td><td>Table cell 2</td>
</tr>
</table>
This results in:
Table header

Table cell 1 Table cell 2

Rowspan
Rowspan is for rows just what colspan is for columns (rowspan allows a cell to span multiple rows).
HTML Code:
<table border="1" cellpadding="5" cellspacing="5" width="100%">
<tr>
<th rowspan="2">Table header</th><td>Table cell 1
</tr>
<tr>
<td>Table cell 2</td>
</tr>
</table>
This results in:
Table cell 1
Table header
Table cell 2

Color
You can apply color to your table using CSS. Actually, you can apply any applicable CSS property to your table - not just
colors. For example, you can use CSS to apply width, padding, margin, etc
HTML Code:
<table border="1" cellpadding="5" cellspacing="5" width="100%">
<tr>
113
Lecturer By: Biran Limbu, CODES Computer Consultant, Dharan, Nepal. Email:codes@[Link]

<th style="color:blue;background-color:yellow;" rowspan="2">Table header</th><td>Table cell 1


</tr>
<tr>
<td>Table cell 2</td>
</tr>
</table>

This results in:


Table cell 1
Table header
Table cell 2

HTML Forms
HTML enables us to create forms. This is where our websites can become more than just a nice advertising brochure. Forms
allow us to build more dynamic websites that allow our users to interact with it.
An HTML form is made up of any number of form elements. These elements enable the user to do things such as enter
information or make a selection from preset options.
In HTML, a form is defined using the <form></form> tags. The actual form elements are defined between these two tags.
The Input Tag
This is the most commonly used tag within HTML forms. It allows you to specify various types of user input fields such as
text, radio buttons, checkboxes etc.
Text
Input type=text
size=
maxlength=
name=
value=
align=
tabindex=
Text fields are used for when you want the user to type text or numbers into the form.
<input type="text" />
Password
Input type=password
size=
maxlength=
name=
value=
align=

textarea
Input type=textarea
rows=
cols=
name=
Example:

114
Lecturer By: Biran Limbu, CODES Computer Consultant, Dharan, Nepal. Email:codes@[Link]

<textarea cols="40" rows="5" name="mytext">text area.


</textarea>

Hidden
Input type=hidden
name=
value=
Radio Buttons
Radio buttons are used for when you want the user to select one option from a pre-determined set of options.
<input type="radio" name="lunch" value="pasta" /><br />
<input type="radio" name="lunch" value="rissotto" />
Checkboxes
Checkboxes are similar to radio buttons, but enable the user to make multiple selections..
<input type="checkbox" name="lunch" value="pasta" /><br />
<input type="checkbox" name="lunch" value="rissotto" />
Submit & Reset
The submit button allows the user to actually submit the form.
<input type="submit" />
<input type="reset" />

Select Lists
A select list is a dropdown list with options. This allows the user to select one option from a list of pre-defined options.
The select list is created using the select in conjunction with the option tag.
<select name=”myselect”>
<option value ="sydney">Sydney</option>
<option value ="melbourne">Melbourne</option>
<option value ="cromwell">Cromwell</option>
<option value ="queenstown">Queenstown</option>
</select>
image
Input type=image
name=
src=
align=
border=
width=
height=
Example: <input type="image" src="[Link]" name="image" width="60" height="60">
Form Action
Usually when a user submits the form, you need the system to do something with the data. This is where the action page
comes in. The action page is the page that the form is submitted to. This page could contain advanced scripts or
programming that inserts the form data into a database or emails an administrator etc.
Creating an action page is outside the scope of this tutorial. In any case, many web hosts provide scripts that can be used for
action page functionality, such as emailing the webmaster whenever the form has been completed. For now, we will simply
look at how to submit the form to the action page.
You nominate an action page with the action attribute.
Example HTML Code:
<form name=myform action="[Link]" method="post">
First name:
<input type="text" name="first_name" value="" maxlength="100" />

115
Lecturer By: Biran Limbu, CODES Computer Consultant, Dharan, Nepal. Email:codes@[Link]

<br />
Last name:
<input type="text" name="last_name" value="" maxlength="100" />
<input type="submit" value="Submit" />
</form>
This attribute specifies the HTTP method to use when the form is submitted.
Possible values are:
get (the form data is appended to the URL when submitted)
post (the form data is not appended to the URL)
Providing this attribute is optional. If you don't provide it, the method will be post.

HTML Frames
In HTML, frames enable you present multiple HTML documents within the same window. For example, you can have a left
frame for navigation and a right frame for the main content. Frames are achieved by creating a frameset page, and defining
each frame from within that page. This frameset page doesn't actually contain any content - just a reference to each frame.
The HTML frame tag is used to specify each frame within the frameset. All frame tags are nested with a frameset tag.
So, in other words, if you want to create a web page with 2 frames, you would need to create 3 files - 1 file for each frame,
and 1 file to specify how they fit together.

Two Column Frameset


HTML Code:
The frameset (frame_example_frameset_1.html):
<html>
<head>
<title>Frameset page<title>
</head>
<frameset cols = "25%, *">
<frame src ="frame_example_left.html" />
<frame src ="frame_example_right.html" />
</frameset>
</html>
The left frame (frame_example_left.html):
<html>
<body style="background-color:green">
<p>This is the left frame (frame_example_left.html).</p>
</body>
</html>
The right frame (frame_example_right.html):
<html>
<body style="background-color:yellow">
<p>This is the right frame (frame_example_right.html).</p>
</body>
116
Lecturer By: Biran Limbu, CODES Computer Consultant, Dharan, Nepal. Email:codes@[Link]

</html>
Add a Top Frame
You can do this by "nesting" a frame within another frame.
HTML Code:
The frameset (frame_example_frameset_2.html):
<html>
<head>
<title>Frameset page</title>
</head>
<frameset rows="20%,*">
<frame src="/html/tutorial/frame_example_top.html">
<frameset cols = "25%, *">
<frame src ="/html/tutorial/frame_example_left.html" />
<frame src ="/html/tutorial/frame_example_right.html" />
</frameset>
</frameset>
</html>
The top frame (frame_example_top.html):
<html>
<body style="background-color:maroon">
<p>This is the Top frame (frame_example_top.html).</p>
</body>
</html>
(The left and right frames don't change)

Remove the Borders


You can get rid of the borders if you like. Officially, you do this using frameborder="0". I say, officially because this is
what the HTML specification specifies. Having said that, different browsers support different attributes, so for maximum
browser support, use the frameborder, border, and framespacing attributes.
HTML Code:
The frameset (frame_example_frameset_3.html):
<html>
<head>
<title>Frameset page</title>
</head>
<frameset border="0" frameborder="0" framespacing="0" rows="20%,*">
<frame src="/html/tutorial/frame_example_top.html">
<frameset cols = "25%, *">
<frame src ="/html/tutorial/frame_example_left.html" />
<frame src ="/html/tutorial/frame_example_right.html" />
</frameset>
</frameset>
</html>
(The left, right, and top frames don't change)

Load another Frame


Most websites using frames are configured so that clicking a link in one frame loads another frame. A common example of
this is having a menu in one frame, and the main body in the other (like our example).
This is achieved using the name attribute. You assign a name to the target frame, then in your links, you specify the name of
the target frame using the target attribute.
Tip: You could use base target="content" at the top of your menu file (assuming all links share the same target frame). This
would remove the need to specify a target frame in each individual link.
117
Lecturer By: Biran Limbu, CODES Computer Consultant, Dharan, Nepal. Email:codes@[Link]

HTML Code:
The frameset (frame_example_frameset_4.html):
<html>
<head>
<title>Frameset page</title>
</head>
<frameset border="0" frameborder="0" framespacing="0" cols = "25%, *">
<frame src ="/html/tutorial/frame_example_left_2.html" />
<frame name="content" src ="/html/tutorial/frame_example_yellow.html" />
</frameset>
</html>
The left frame (frame_example_left_2.html):
<html>
<body style="background-color:green">
<p>This is the left frame (frame_example_left_2.html).</p>
<p>
<a target="content" href="frame_example_yellow.html">Yellow</a><br />
<a target="content" href="frame_example_lime.html">Lime</a>
</p>
</body>
</html>
The yellow frame (frame_example_yellow.html):
<html>
<body style="background-color:yellow">
<p>This is the yellow frame (frame_example_yellow.html).</p>
</body>
</html>
The lime frame (frame_example_lime.html):
<html>
<body style="background-color:Lime">
<p>This is the lime frame (frame_example_lime.html).</p>
</body>
</html>

The frameset Tag


In your frameset tag, you specify either cols or rows, depending on whether you want frames to go vertically or horizontally.
Attribute Description
rows Specifies the number of rows and their height in either pixels, percentages, or relative lengths. Default is 100%
cols Specifies the number of columns and their width in either pixels, percentages, or relative lengths. Default is 100%

The frame Tag


For each frame you want to display, you specify a frame tag. You nest these within the frameset tag.
Attribute Description
name Assigns a name to a frame. This is useful for loading contents into one frame from another.
longdesc A long description - this can elaborate on a shorter description specified with the title attribute.
src Location of the frame contents (for example, the HTML page to be loaded into the frame).
noresize Specifies whether the frame is resizable or not (i.e. whether the user can resize the frame or not).
Whether the frame should be scrollable or not (i.e. should scrollbars appear). Possible values:
scrolling auto
yes
118
Lecturer By: Biran Limbu, CODES Computer Consultant, Dharan, Nepal. Email:codes@[Link]

no
Whether the frame should have a border or not. Possible values:
frameborder 1 (border)
0 (no border)
marginwidth Specifies the margin, in pixels, between the frame's contents and it's left and right margins.
marginheight Specifies the margin, in pixels, between the frame's contents and it's top and bottom margins.

The noframe Tag


The noframes tag is used if the user's browser doesn't support frames. Anything you type in between the noframes tags is
displayed in their browser.
HTML Code:
<html>
<head>
<title>Frameset page<title>
</head>
<frameset cols = "25%, *">
<noframes>
<body>Your browser doesn't support frames.
Therefore, this is the noframe version of the site.</body>
</noframes>
<frame src ="frame_example_left.html" />
<frame src ="frame_example_right.html" />
</frameset>
</html>

Concept of CSS
CSS is a language that you can use to define styles against any HTML element. These styles are set using CSS properties.
For example, you can set font properties (size, colors, style etc), background images, border styles, and much more.
Cascading Style Sheets, level 1 (CSS1) became a W3C Recommendation in December 1996. It describes the CSS language
as well as a simple visual formatting model. CSS2, which became a W3C recommendation in May 1998, builds on CSS1
and adds support for media-specific style sheets (e.g. printers and aural devices), downloadable fonts, element positioning
and tables.
CSS (Cascading Style Sheets) allows web authors to apply styles to their web pages. More importantly, CSS enables them
to do this independently of the HTML that makes up each web page.
Therefore, as a web author, you can code your HTML without having to be concerned with what each HTML element is
going to look like. You can change the look later using CSS.

CSS Advantages
HTML has its limitations when it comes to layout. Sure, you have 6 different levels of headings and 6 different sizes of
fonts. You also have tables, and you have control over alignment etc. These are good enough to get a reasonable looking
document that shows the true structure of information. However, it's a far cry from some of the excellent layout & design
that we see in magazines and printed brochures etc.
CSS helps us achieve such layouts.
With CSS, you have much better control over the layout of your web pages. You can specify exactly how big a font will be,
exactly where an element will be on a page, what the page will look like when printed, and much more.
CSS can also save you a lot of time, particularly when maintaining a large site. Also, the World Wide Web Consortium
(W3C) recommends that web developers use CSS tags instead of HTML tags wherever possible. The W3C are gradually
phasing out quite a few of these HTML tags.

Advantages of CSS
119
Lecturer By: Biran Limbu, CODES Computer Consultant, Dharan, Nepal. Email:codes@[Link]

• CSS saves time


When most of us first learn HTML, we get taught to set the font face, size, colour, style etc every time it occurs on
a page. This means we find ourselves typing (or copying & pasting) the same thing over and over again. With CSS,
you only have to specify these details once for any element. CSS will automatically apply the specified styles
whenever that element occurs.
• Pages load faster
Less code means faster download times.
• Easy maintenance
To change the style of an element, you only have to make an edit in one place.
• Superior styles to HTML
CSS has a much wider array of attributes than HTML.
Disadvantages of CSS
• Browser compatibility
Browsers have varying levels of compliance with Style Sheets. This means that some Style Sheet features are
supported and some aren't. To confuse things more, some browser manufacturers decide to come up with their
own proprietary tags.
Fortunately, browser compatibility is becoming less of an issue as the latest browser versions are much
more standards-compliant than their earlier counterparts.

Example:
<style type="text/css" media=screen>
p {color:#ff0000;}
h1{
color:blue;
font-family:arial,helvetica,"sans serif";
font-size:150%;
}
</style>
<head><title>css test</title></head>
<body>
<h1>CSS Test</h1>
<p>CSS Test</p>
</body>

Concept of Script Language

Programs written in scripting languages, called scripts, are not compiled ahead of time for specific computer systems like
many high-level languages. Instead, the plain text that constitutes a script gets interpreted into computer commands while a
program runs. Scripts are used to add interactivity to otherwise static Web pages. They also can perform repetitive tasks like
automatically filling out parts of Web-based forms, among other uses.
Scripting languages normally are interpreted by Web browsers like Microsoft Internet Explorer or Netscape Navigator. Web
browsers interpret scripts along with Hypertext Markup language (HTML), the language in which Web pages are written.
This can be done in one of two ways. In one scenario, programs written in scripting languages can run directly from a
server. Otherwise, a script can be included with or directly in an HTML Web page that someone downloads to a computer.
In either case, the Web browser is used to access the program.
Script Language

120
Lecturer By: Biran Limbu, CODES Computer Consultant, Dharan, Nepal. Email:codes@[Link]

JavaScript and Microsoft's Visual Basic Scripting Edition (VBScript) were two popular types of scripting languages.
JavaScript was created by Sun Microsystems and Netscape. It is based on the Java programming language, but was
developed independently. JavaScript has the ability to interact with HTML code, enabling developers to create more
interactive, appealing Web sites without having to learn a complicated programming language. The language can be used
for both client and server‐based programs. Similar in many regards to JavaScript, Microsoft's Visual Basic Scripting Edition
is based on the company's Visual Basic programming language. Among the benefits of Visual Basic Scripting Edition are its
portability and speed. Not only is the language used by Web browsers, it also is used for other kinds of applications.

JavaScript
JavaScript is a scripting language that enables web developers/designers to build more functional and interactive websites.
Common uses of JavaScript include:
• Alert messages
• Popup windows
• Dynamic dropdown menus
• Form validation
• Displaying date/time
JavaScript usually runs on the client‐side (the browser's side), as opposed to server‐side (on the web server). One benefit
of doing this is performance. On the client side, JavaScript is loaded into the browser and can run as soon as it is called.
Without running on the client side, the page would need to refresh each time you needed a script to run.
JavaScript syntax mean
What does JavaScript syntax mean? JavaScript syntax refers to a set of rules that determine how the language will
be written (by the programmer) and interpreted (by the browser).
The JavaScript syntax is loosely based on the Java syntax. Java is a full blown programming environment and
JavaScript could be seen as a sub-set of the Java syntax. Having said this, that is where the similarities end - Java
and JavaScript are two totally different things.
In learning JavaScript you will become familiar with terms such as variables, functions, statements, operators,
data types, objects etc.
Example:
<script type="text/javascript">
<!--
[Link]("Hello World");
alert('Hello World');
-->
</script>

Explanation of code
• The <script> tags tell the browser to expect a script in between them. You specify the language using the type
attribute. The most popular scripting language on the web is JavaScript.
• The bits that look like HTML comments tag (<‐‐ ‐‐>) are just that ‐ HTML comment tags. These are optional but
recommended. They tell browsers that don't support JavaScript (or with JavaScript disabled) to ignore the code in
between. This prevents the code from being written out to your website users.
• The part that writes the actual text is only 1 line ([Link]("JavaScript is not Java");). This is
how you write text to a web page in JavaScript. This is an example of using a JavaScript function (also known as
method).
Where to put your scripts?
You can place your scripts in any of the following locations:
121
Lecturer By: Biran Limbu, CODES Computer Consultant, Dharan, Nepal. Email:codes@[Link]

• Between the HTML document's head tags.


• Within the HTML document's body (i.e. between the body tags).
• In an external file (and link to it from your HTML document).
Example1:
<head><title>css test</title></head>
<body>
<input type="button" onClick="alert('Hello World');" value="Click Me!" />
</body></html>
Example2:
<head><title>css test</title>
<script type="text/javascript">
<!‐‐
function calc()
{
var a,b,c;
a=parseFloat([Link]);
b=parseFloat([Link]);
c=a+b;
alert('Total:' +c);
[Link]=c;
}
‐‐>
</script>
</head>
<body>
<form name=myform action="" method=post>
First Number:<input type=text name=txt1><br>
Second Number:<input type=text name=txt2><br>
<input type=button name=btn value="Addition" OnClick="calc()">
<input type=text name=txt3><br>
</body>

VBScript

VBScript (Visual Basic Script) is a scaled down version of Visual Basic. Visual Basic is a full blown programming language.
VBScript, on the other hand, is a scripting language that can be run client‐side (i.e. via your web browser), or server‐side
(i.e. on the web server). VBScript is the most common scripting language on websites that use ASP (Active Server Pages).
When VBScript is run on the client side, the user's browser needs to support VBScript. When run on the server side, the
server needs to support it. In this tutorial, our VBScript examples are on the client‐side, therefore, in order to get the most
out of this tutorial, you should use Internet Explorer, as most other browsers don't support VBScript.

122
Lecturer By: Biran Limbu, CODES Computer Consultant, Dharan, Nepal. Email:codes@[Link]

VBScript syntax
What VBScript syntax refers to, is a set of rules that determine how the language will be written (by the programmer) and
interpreted (by the browser or server). The VBScript syntax is based on the Visual Basic (VB) syntax. VB is a full blown
programming environment and VBScript is a scaled down version of VB.
You may also find the VBScript syntax similar to JavaScript in some ways. If you know JavaScript, or any other language for
that matter, you will be familiar with terms such as variables, functions, statements, operators, data types, objects etc.
VBScript includes these too.
Most of these will be covered throughout the rest of this tutorial. For now, we'll start with the basics.
Basic VBScript Code
Here's some basic VBScript that outputs some text to the browser. Again, if you know JavaScript, this will look familiar.
Example1:
<html>
<body>
<script type="text/vbscript">
[Link]("Hello World")
</script>
</body>
</html>
Example2:
<head><title>VBScript</title>
<SCRIPT LANGUAGE="VBScript">
<!‐‐
Sub mybtn_onClick()
Dim a,b,c
a=CInt([Link])
b=CInt([Link])
c=a+b
MsgBox "Total:" & c
[Link]=c
End Sub
‐‐>
</script>
</head>
<body>
<form name=myform action="" method=post>
First Number:<input type=text name=txt1><br>
Second Number:<input type=text name=txt2><br>
<input type=button name=mybtn value="Addition">
<input type=text name=txt3><br>
</body>

123
Lecturer By: Biran Limbu, CODES Computer Consultant, Dharan, Nepal. Email:codes@[Link]

Webpage Design and Editing Tools

Just like in most other professions, a web designer’s set of tools is what brings a concept into fruition. There are many
applications available to our disposal, but there are some that just stand out from the crowd. The tools in this regarded as
the most popular tools used for web design.

Fireworks
Adobe Fireworks is a commercial raster and vector graphics editor hybrid from Adobe that’s available for the Mac and
Windows operating systems. Designed specifically for web designers (unlike Photoshop), Fireworks brings you a plethora
of tools and options that make full web layout prototyping a breeze.

Dreamweaver
Adobe Dreamweaver is a commercial application for web development that’s available for the Mac and Windows
operating systems. Its featured‐packed suite of tools and options include: syntax highlighting and very smart Code Hinting,
a built‐in FTP client, project management and workflow options that make team work effortless, and Live View – which
shows you a preview of your source code. Dreamweaver tightly integrates with other popular Adobe products such as
Photoshop, allowing you to share Smart Objects for quick and easy updating and editing of graphics components.

Panic Coda
Panic Coda is a shareware web development application for the Mac OS X operating system. It seeks to reduce the amount
of applications (such as an FTP client, CSS editor, a version control system, etc.) you need to develop websites and to
improve your team’s workflow. Coda’s one‐window web development philosophy uses a tabbed interface for text editing,
file transfers, SVN, CSS, and even "Books" which embeds web books that are searchable (it comes with The Web
Programmer’s Desk Reference but you can add your own).

Photoshop
Adobe Photoshop is a very popular commercial graphics editor available for the Mac and Windows operating system.
Created for professional photographers and designers, it is the ideal application for manipulating images and creating web
graphics. Photoshop has all the necessary tools and options you need such as: Filters – which automatically adds effects to
your image or a selected section of your image, extensibility and automation with Brushes, Actions and Scripting, and
workflow enhancement features like Layer Comps and the Revert option.

Firebug
Firebug is a free, open source in‐browser web development tool for the Firefox web browser. It’s many features include:
on‐the‐fly HTML and CSS editing for tweaking or debugging, a Console for logging, analyzing and debugging JavaScript, and
an intuitive Document Object Model (DOM) inspection tool to help you quickly see how the elements of a web page
relates to one another.

124

You might also like