green computer

288
Lalitpur, Nepal, Tel: 977-1-5529899 E-mail: [email protected] www.greenbooks.com.np Computer Green Approved by Government of Nepal, Ministry of Education, Curriculum Development Centre, Sanothimi, Bhaktapur as an additional material 9 Editor Reg Bahadur Bhandari Author Prabhu Prasad Sah

Upload: others

Post on 05-Dec-2021

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Green Computer

Lalitpur, Nepal, Tel: 977-1-5529899E-mail: [email protected]

ComputerGreen

Approved by Government of Nepal, Ministry of Education, Curriculum Development Centre, Sanothimi, Bhaktapur as an additional material

9Editor

Reg Bahadur Bhandari

AuthorPrabhu Prasad Sah

Page 2: Green Computer

Publisher: Green Books

Copyright: Author (2074 BS)

Printed in Nepal

LayoutThe Focus [email protected]

EditionFirst : B.S. 2074 (2017 AD)Reprint : B.S. 2075 (2018 AD)Revised : B.S. 2076 (2019 AD)Revised : B.S. 2077 (2020 AD)

ComputerGreen

9

Page 3: Green Computer

Computer has become an integral part of human life. Computer is the greatest invention man has ever made. There are hardly any fields on this earth where computers have not been used. So, it has become a necessity for every individual to be computer literate. So, computer studies has been incorporated in curriculum in our country too. Green Computer series has been designed with a vision that it would help students address their general needs of word-processing and simple database management and also to orient their minds to IT to be able to contribute in the future. This series can be a great tutorial for novices who are really interested to learn the basics of computer. All our efforts have been put forth to make this series descriptive in order to make the contents understandable and communicate instructions easily. We have tried to use simple English for the convenience and easy understanding of instructions both in theory as well as in practical lessons. Varieties of theory based exercises and relevant lab sessions have been included in order to give concepts on different topics and evaluate students’ understanding.We would like to express our sincere gratitude to Green Books, Focus Computer Team, Mr. Ramesh Lamsal, Mr. Sudhat Pariyar, Mr. Birendra Manandhar, Mr. Bishal Ghimire, Mr. Manoj Pant and all our colleagues, friends and well wishers without whom, this series wouldn’t have taken is shape. We believe that this series is free of errors, yet there can be some slips. So, we would like to welcome from all our readers students, teachers, individuals and institutions valuable suggestions and feedback for revision in the upcoming editions.Finally, we are thankful to our parents for making us capable of contributing a little to the society and the country.

Author

Preface

Page 4: Green Computer

Content1. Introduction To Computer . . . . . . . . . . . . . . . . . . . . . 52. Types of Computer . . . . . . . . . . . . . . . . . . . . . . . . . . . 263. Computer System . . . . . . . . . . . . . . . . . . . . . . . . . . . . 344. Computer Hardware . . . . . . . . . . . . . . . . . . . . . . . . . 445. Types of Computer Software. . . . . . . . . . . . . . . . . . . 586. Operating System . . . . . . . . . . . . . . . . . . . . . . . . . . . . 667. Windows Environment . . . . . . . . . . . . . . . . . . . . . . . 888. Computer Graphics . . . . . . . . . . . . . . . . . . . . . . . . . . 959. Hyper Text Markup Language(HTML) . . . . . . . . . 11310. Internet and Web Technology . . . . . . . . . . . . . . . . . 17711. Programming Concept . . . . . . . . . . . . . . . . . . . . . . . 18912. Program Development Life Cycle (PDLC) . . . . . . 19713. Algorithm and Flowchart . . . . . . . . . . . . . . . . . . . . 20314. Introduction to QBASIC. . . . . . . . . . . . . . . . . . . . . . 21215. Constants, Variables And Data Types . . . . . . . . . . 22016. Operators Operands and Expressions . . . . . . . . . . 22817. QBASIC Statements . . . . . . . . . . . . . . . . . . . . . . . . . 23518. Looping in QBASIC . . . . . . . . . . . . . . . . . . . . . . . . . 25719. ARRAY in QBASIC . . . . . . . . . . . . . . . . . . . . . . . . . . 269

Page 5: Green Computer

Computer Book-9 5GREEN

Introduction To Computer1

IntroductionThis is the age of Information and Communication Technology (ICT). It has brought a huge revolution in our day-to-day life. It is an inseparable part of our daily life. It is believed that computer is the greatest invention man has ever made. There is hardly any field on this earth where computers have not been used. So, it has become a necessity for every individual to be computer literate in this era.The word “computer” is derived from the Latin word “computare” which means to calculate. Computer has become very popular among us due to its versatile characteristics. It saves our time, money, efforts and reduces the paper work. A computer is a tool and partner in every sphere of human life and activity. It works on the principle of IPO cycle (Input- processing- output). Input: It is raw data fed to the processor in different forms to be

processed.Process: It receives and processes the raw data (performs arithmetic

and logical operation).Information: It is the processed data that can be used for different purposes.

This information can be represented in textual, numerical, graphic, or audiovisual forms.

A computer is an electronic machine which accepts raw data, processes them and gives meaningful information to the user. It is capable of performing basic operations like addition, subtraction, multiplication, division, etc. The computer is also capable of storing information, which can be used later.

Page 6: Green Computer

GREEN Computer Book-96

Computer performs the following functions• Takes raw data as input.• Stores the data/instructions in its memory and uses them when required.• Processes the data and converts it into useful information.• Generates the output.• Controls and coordinates all the above operations.

Characteristics / Features of ComputerA computer can be used for performing various tasks which may be programming or simple calculations and for saving time. Every machine has its own features, so computer also has its own features. The most important features of computer are as follows:

1. Speed

2. Accuracy

3. Automatic operation

4. Diligence

5. Versatility

6. Reliability

7. Storage capacity

SpeedA computer is a device that basically processes information at the speed of light. It can accomplish very complex tasks at a very short time. All the operations of the computer are caused by electrical pulses. The speed of a computer for performing a single operation can be measured in terms of fractions of a second:• Millisecond (ms) = One thousandth of a second (1/1000) or 10-3

• Microsecond (ms) = One millionth of a second (1/1000000) or 10-6

• Nanosecond (ns) = One billionth of a second (1/1000000000) or 10-9

• Picoseconds (ps) = One trillionth of a second (1/1000000000000) or 10-12

Page 7: Green Computer

Computer Book-9 7GREEN

AccuracyThe degree of accuracy of computers is very high. They can perform calculations with great accuracy. Due to wrong inputs or due to the malfunctioning of the system, the computer gives wrong output. The term used to describe this type of error is GIGO (Garbage In Garbage Out).

Automatic OperationA computer is the machine that is able to perform all its tasks without any help once instruction is provided. So computer is called an automatic machine. It performs the task automatically but not in its own way.

DiligenceA computer has the capacity of doing the same task repeatedly for many times without suffering from tiredness and boredom. So it is called a diligent machine. It is capable of working at the same level of speed and accuracy even if it has to carry out the most voluminous and complex operations for an extended period of time. This feature of the computer is called diligence.

StorageA computer can store a huge amount of data and instructions temporarily or permanently in the RAM or secondary storage devices such as hard discs optical discs and magnetic tapes. The data stored permanently can be retrieved whenever needed. The storing capacity of a computer is measured in terms of Byte.

1Bit = 1 or 04 Bits = 1 Nibble8 Bits = 2 Nibbles = 1 Byte1024 Bytes = 1 Kilo Byte (KB)1024 Kilo Bytes = 1 Mega Byte (MB)1024 Mega Bytes = 1 Giga Byte (GB)1024 Giga Bytes = 1 Tera Byte (TB)1024 Tera Byte = 1 Peta Byte (PB)1024 Peta Byte = 1 Exa Byte (EB)1024 Exa Byte = 1 Zetta Byte (ZB)

Page 8: Green Computer

GREEN Computer Book-98

VersatilityA computer has the capacity to do multiple tasks at the same time. A computer can be used to prepare documents, modify photographs, process data, send and receive mails, etc. It is even used to measure physical variables. So a computer is called a versatile machine.

ReliabilityThe components of a computer have very high life span and its parts do not tear and wear out easily. So, the computer has a high level of reliability.

Limitations of Computer

No IQComputer is a dumb machine. It cannot do any work without instructions from the user. It is up to you to decide what you want to do and in what sequence. So a computer cannot take its own decision as you can.

No Feeling Computer does not have feeling or emotion, taste, knowledge and experience like human beings. Thus it does not get tired even after long hours of work. It does not distinguish between users.

Application of a ComputerComputers are being used almost everywhere in our day-to-day life. Some of the areas where they are widely used are:

HomeA computer is used at home by children and parents for various purposes like other electronic devices and gadgets such as smart phones, TV, radio, video games, etc. Computers are used at home for playing games, listening to music and watching movies, writing letters and storing addresses and phone numbers. Students use computer for drawing and painting cards, playing games, answering e-mails and chatting with friends, gathering information on any project or report. Parents use computer for communication, booking e-tickets, hotels and purchasing things online.

EducationComputers are used in the field of education to support teachers,

Page 9: Green Computer

Computer Book-9 9GREEN

students and management. Teachers use computers to teach and prepare lesson plans, report cards and timetables. They can use computer to explain difficult topics more clearly and easily to their students. Management use computer for prepare test papers, circulars, account details and many other things. Students use computers for preparing projects, learning different subjects. They can also use computer for playing games, online education and online examination. Open universities are launching their distance learning programs through computer. As we know Internet is the biggest library in the world, we can find our required piece of information easily and quickly. Many universities are using computer to recognize its responsibility for creating an institutional climate in which students with disabilities can flourish.

Health and MedicineComputers are widely used in medical field. They have become essential tools in managing different functions in hospitals, nursing homes or labs. Computers are used to maintain medical records and treatment details of patients. Nowadays, many critical operations are done with the help of computers. A lot of research works can be done in the medical field. They are used to find cure for various diseases. New viruses that affect human beings seriously, are being discovered with the help of computer. During the medical tests and checkups, some specific human body parts are examined. For example: CT scan, blood test, recording heart beat, etc.

EntertainmentComputers are commonly used in the field of entertainment whether it is film, television or any other multimedia programs. Nowadays, computer has become good means of entertainment. People use computer watching movie, playing game, using internet for downloading entertaining materials. They also use computer for digital art such as painting pictures and more. Computers help in making feature films, cartoon films or any animation films, etc. Musicians use computers to compose, arrange and record music at music studios. It can be used in animation to provide sense of virtual reality. Special effects are added in movies with the help of computers. Computers help to create special characters; scenes of flood, fire and storm. Films like Jurassic Park, Mottu Aur Patlu, Spider man, My Friend Ganesha, etc. are made with the help of computers.

Page 10: Green Computer

GREEN Computer Book-910

BusinessComputers are used in business and offices for making and keeping records of financial activities. It helps in maintaining employees personal records, communicating with clients and parties through emails and video conferencing. It helps in aking attractive advertisements for business promotion. It also helps in making presentation to discuss which determines business strategy and policy.

BankingComputers are used in banks for keeping record of account holders, including the details of money deposited or withdrawn from any account, operating ATM and providing Internet banking services, verifying the cheques of customers, updating the account balance and calculating interest. A computer can help to find out fake notes. It also helps in counting money.

Science and TechnologyThere are so many applications of computers in the field of science and technology. For complex and sensitive calculations, it provides faster, accurate and more flexible way of handling data. It helps in sending missiles and satellites and conducting experiments. It helps in research and innovation. It helps in making different equipment and weather forecasting. They are also using computers to create nuclear weapons to use them for the defense of world and mankind.

DesigningComputers help in graphic designing and fashion designing. A graphic designer is a skilled computer professional who is capable of presenting data and facts in an artistic way. Web designers use computers to design Websites so that they can present information on the Internet in an attractive way. Fashion designers use computers to design garments.

EngineeringComputers have played a vital role in the field of engineering. Engineers use computers in designing cars, different scientific kits and equipment. Architects use computers to design houses and buildings. Engineers use computers in petroleum engineering and aircraft for simulation and designing. Interior designers use computers for interior design of home, mall, complex, hall, etc.

Page 11: Green Computer

Computer Book-9 11GREEN

AgricultureComputers play a significant role in production and efficient use of crop varieties, seeds, fertilizers, pesticides, soil amendments, water, and farm machines. Farmers can get a lot of information regarding price, weather, temperature and agriculture topics by using various agricultures’ mobile App or surfing Internet.They can use computer for keeping financial record, production record, online banking, buy required resources through internet etc. By using computer in traditional field like agricultural field they can increase the productivity.

TravellingComputers are used for every aspect of travel and tourism. Computers are used in traveling for scheduling the railways and air flights. Computers can be used for booking our air tickets or railway tickets and reservation of hotel online. Computers can be used for determining any visit station in the world by using Internet. Computer can be used for storing data about passengers, who are travelling and in any case of accident we can easily trace any information about any passenger.

TransportationThe use of computer in transportation can give us many benefit such as on board communication and navigation systems which is very popular at this time. Beside that its also help in routes navigation systems that monitor and control movements to provide increased safety. Computer are used to control and manage the traffic of aviation and railway.

History of ComputerHumans have always needed to perform arithmetic operations like counting and adding. During the pre-historic period, they counted either on their fingers or by scratching marks on the bones and then with the help of stone, pebble and beads. The word ‘computing’ means ‘an act of calculating’. The evolution of computers has passed through a number of stages before arriving at the present state of development. In fact, the history of computer encompases a gradual development from simple abacus to the electronic computers we use today.

Page 12: Green Computer

GREEN Computer Book-912

a. Abacus Abacus was created

by the Chinese people about 3000 years ago as the first mechanical aid to do calculations. Calculations are performed by manipulating the beads. It is a rectangular box, divided into two parts by the mid bar. The upper part is called “heaven” which consists of two beads and each bead is equal to five and the lower part is called “earth” and consists of five beads and each bead is equal to one.

John Napier of Merchiston was born in and died in 1550 – 4 April 1617; also signed as Neper, Nepair; nicknamed Marvellous Merchiston). He was a Scottish landowner known as a mathematician, physicist, and astronomer. John Napier is best known as the inventor of logarithms. He also invented the so-called "Napier's bones" and made common the use of the decimal point in arithmetic and mathematics.

b. Napier’s Bone Napier's Bone was invented by John

Napier, a Scottish mathematician (1550-1617) in 1614. Multiplication tables were inscribed on strips of wood or bone. It was possible to perform calculations with two numbers. It is mainly used for multiplication.

c. Slide Rule Slide Rule was invented by William Oughtred, an English mathematician,

in 1620. It is an analog device that uses the principle of logarithms. It can perform simple multiplication and division problems. It consists of two graduated scales, devised in such a way that suitable alignment of one against other makes it possible to obtain products, quotients etc.

Heaven

Earth

Mid bar

BeadsString

Page 13: Green Computer

Computer Book-9 13GREEN

William Oughtred (5 March 1574 – 30 June 1660) was an English mathematician and Anglican Minister.After John Napier invented logarithms and Edmund Gunter created the logarithmic scales (lines, or rules) upon which slide rules are based, it was Oughtred who first used two such scales sliding by one another to perform direct multiplication and division; and he is credited as the inventor of the slide rule in 1622. Oughtred also introduced the "×" symbol for multiplication as well as the abbreviations "sin" and "cos" for the sine and cosine functions.

d. Pascaline Pascaline was developed by Blaise

Pascal (1623-1662) in 1642 to help his father in his tax works. It contains eight dials, gears and wheels. It was capable of performing additions and subtractions up to 8 digits. It could add and subtract by the movement of wheels and could not be used for division and multiplication.

In 1642, while still a teenager, Blaise Pascal started some pioneering work on calculating machines. After three years of effort and 50 prototypes, he built 20 finished machines (called Pascal's calculators and later Pascalines) over the following 10 years, of the first two inventors of the mechanical calculator.

e. Stepped Reckoner Stepped Reckoner was

developed by Gottfried Wilhelm Von Leibniz (1646-1716), a German mathematician

Page 14: Green Computer

GREEN Computer Book-914

and philosopher in 1694. It could evaluate square roots by a series of stepped additions. The centerpiece of this machine is its stepped drum gear design. It could perform all four of the basic arithmetic functions – addition, subtraction, multiplication and division.

Gottfried Wilhelm (von) Leibniz: 1 July 1646 – November 14, 1716) was a German polymath and philosopher who developed differential and integral calculus. Leibniz's notation has been widely used ever since it was published. While working on adding automatic multiplication and division to Pascal's calculator, he was the first to describe a pinwheel calculator in 1685 and invented the Leibniz wheel, used in the arithmometer, the first mass-produced mechanical calculator. He also refined the binary number system, which is the foundation of virtually all digital computers.

f. Difference Engine Difference Engine was designed by Charles

Babbage (1792 – 1871), an English mathematician, in 1822. It could solve equations. This project could not be completed due to lack of funds. It is housed in the Science Museum, London and is still in perfect working order.

g. Analytical Engine Analytical Engine was developed by

Charles Babbage in 1833. It had a ‘store’ for storing data and intermediate results. It had an output device to produce printed results. It had a unit for calculation called ‘mill’. All the modern computers are based on the working principle of analytical engine (input-process-output).

Page 15: Green Computer

Computer Book-9 15GREEN

Charles Babbage is known as the ‘Father of Modern Computer’ as his invention of Analytical Engine had more of the characteristics of modern computers.

h. Hollerith Tabulator Tabulator was developed by an

American, Dr. Herman Hollerith (1869-1926) in 1887. It used punched cards input, output and instructions. This machine was used by American Department of Census to compile the 1890 census.

1890: punched cards used by Herman Hollerith to automate census • Concept of programming the machine to

perform different tasks with punched cards was from Babbage.

• Punched cards based on Joseph Marie Jacquard’s device to automate weaving looms.

• In 1896, he founded the tabulating machine company which was renamed as IBM (International Business Machine).

Page 16: Green Computer

GREEN Computer Book-916

Lady Augusta Ada Lovelace (1816-1852)An English mathematician (daughter of English Poet Lord Byron) carried forward the work of Charles Babbage. She developed programs for performing mathematical calculation on the Analytical Engine.She was the first computer programer. One programming language ‘Ada’ was named after her.

George BooleOne of the greatest achievements of 19th century was the discovery of mathematical logic called Boolean Algebra. He studied and presented the symbolic logics, which constitute the foundation of modern computers. His logics provide basic idea of presenting the electric circuits with binary input and its output.

John Von Neumann (1903 – 1957)He was the doctorate in mathematics from the University of Budapest on set theory. He designed the EDVAC with a team of J.P. Eckert and J.W. Mauchly. He introduced the concept of having a stored program in memory in 1945. This concept led to the beginning of the first generation of computers.

Electro-Mechanical ComputersMark-I• Mark-I was designed by Howard Aiken (1900-

1973), a Harvard engineer in 1937. It was 51 ft. long, 8 ft. tall and 3 ft. wide having 18000 vacuum tubes. It was the first automatic electromechanical computer. It used instructions stored in paper tapes and punch cards. It consisted of 7 lakh 50 thousand parts.

Page 17: Green Computer

Computer Book-9 17GREEN

ABC (Atanasoff-Berry Computer)• First electromechanical digital computer built

in 1937-1942 at Iowa State University by John V. Atanasoff and Clifford Berry.

• It introduced the ideas of binary arithmetic and logic circuit.

• It used punch cards as secondary storage.

Electronic Computers

ENIAC (Electronic Numerical Integrator and Calculator)• ENIAC was designed by Dr. John W. Mauchly and Dr. J. P. Eckert,

completed in 1946.• It was built from 1,800 vacuum tubes and 70,000 resistors. Power

consumption – 160 kilowatt and floor space – 1,800 square feet.• It could add two numbers in 200 microseconds and multiply two numbers

in 2800 microseconds.

EDSAC (Electronic Delay Storage Automatic Computer)• EDSAC was designed by Maurice Wilkes at Cambridge University,

mathematical laboratory in 1947.• It was the first operational stored-program computer.• It contained 3000 vacuum tubes and operated with 30 kilowatt of power.• It used a mercury delay line storage system.

EDVAC (Electronic Discrete Variable Automatic Computer)• Designed by J. Mauchly and J.P. Eckert at Pennsylvania University and

was completed in 1950.• It included a stored program, a central processor and a memory for both

data and programs.

UNIVAC (Universal Automatic Computer)• Produced by Universal Accounting Company and set up by John Mauchly

and J.P. Eckert in 1951.

Page 18: Green Computer

GREEN Computer Book-918

• It consisted of magnetic tape for data input and output.• It was the first general purpose electronic digital computer designed for

commercial use.

History of Computer in Nepal• In 2018 BS an electronic calculator called "Facit" was used for census.• In 2028 BS (1972 AD) census IBM 1401, a second generation mainframe

computer was used.• In 2031 BS (1975 AD) a center for Electronic Data Processing , later renamed

an National Computer Center(NCC), was established for national data processing and computer training.

• In 2038 BS ( 1982 AD) ICL 2950/10 a second generation mainframe computer was used for census.

• Now-a-days probably each and every institution, business organization, communication center, ticket counter, etc. are using computers in Nepal.

Computer GenerationInitially, the generation term was used to distinguish between varying hardware technologies. But nowadays, generation includes both hardware and software, which together make up an entire computer system. The evolution of modern digital computing took place in five distinct phases known as computer generations, which are classified on the basis of their speed, capacity, reliability, components used, etc.

First Generation Computers (1945-1956)

• Vacuum Tubes: used as main component for memory and circuitry for CPU.

• Very slow, large in size, consumed a lot of electrical power.

• The operating speed was measured in terms of milliseconds.

Page 19: Green Computer

Computer Book-9 19GREEN

• Storage capacity was too small; only 1 to 4Kb.

• They used machine level programming language.

• Punch cards, paper tape, and magnetic tape were used as input and output devices.

• Batch processing operating system were used.

Some of first Generation Computers are: Mark – I, ENIAC, EDVAC, EDSAC, UNIVAC etc.

The vacuum tube was invented by Lee De Forest in 1907. It was a set of metal electrodes and grids contained in a glass or metal tube. It was formerly used for amplification and switching in electronic circuits, now used in CRT (Cathode Ray Tube).

Second Generation Computers (1956 – 1963)

• Transistors replaced vacuum tube.

• A transistor contained more than 18000 vacuum tubes due to which the second generation computer gets smaller in size.

• Smaller, faster and reliable than first generation computers.

• The operating speed was measured in terms of microseconds.

• Magnetic tapes were used as secondary storage media.

• High-level programming languages were also being developed at this time, such as early versions of COBOL and FORTRAN.

Page 20: Green Computer

GREEN Computer Book-920

Some of second Generation Computers are: LEO Mark III, ATLAC, UNIVAC I, ICL 1901 etc.

Transistor is short form of transfer resistor. It is a solid state semi-conductor device which can be used for amplification, switching, voltage stabilization, signal modulation, etc. It transfers signals from a low resistance to high resistance. It was invented in 1947 by three Bell Lab scientists John Bardeen, Walter Brattain, and William Shockley. Used in the second generation computers as major components.

Third Generation Computers (1964-1971)• IC (Integrated Circuits) made the

computers smaller, more efficient and more reliable than previous computers.

• The operating speed was measured in terms of nanoseconds.

• In the beginning, magnetic core memories were used. Later they were replaced by semiconductor memories (RAM & ROM)

• They have input and output devices such as keyboard and monitors instead of punch card

• High level language (FORTRAN-II TO IV, COBOL, PASCAL PL/1, BASIC, ALGOL -68 etc.) were used during this generation.

Some of third Generation Computers are: IBM 360 Series, ICL 1900 Series, VAX 1/780 etc.

An IC is a circuit consisting of a large number of electronic components placed on a single silicon chip by a photolithographic process. Jack Kilby invented it in 1958. IC is used for a variety of devices, including microprocessor, audio and video equipment and automobiles

Page 21: Green Computer

Computer Book-9 21GREEN

Fourth Generation Computers – (1971 – Present)• Microprocessor/Large Scale Integrated

Circuit (LSIC) and Very Large Scale Integrated Circuit (VLSIC) was the main component that included 5000 transistors

• Due to the use of LSIC and VLSIC, size was greatly reduced.

• The operating speed increased beyond picoseconds.

• Many sophisticated programs for special application were available.

• Magnetic and optical storage devices with capacity of more than 500GB were used as secondary memory.

• All the higher level languages like C and C++, DBASE etc. were used in this generation.

Some of fourth Generation Computers are: Pentium I/II/III/IV, HP 3033, APPLE II etc.

The microprocessor is a computer processor built onto a single piece of silicon, known as a wafer or chip. The first microprocessor is Intel 4004 developed by American Intel Corporation in 1971.

Fifth Generation Computers – (Present and Beyond)• Major components – ULSI (Ultra Large Scale Integration)• The concept of AI (Artificial Intelligence) has been introduced which

enables the computers to take decisions on their own. • Bio chips and Gallium Arsenide ( Ga As) are used as memory devices.• Extremely high-speed parallel processing capability. • Large use of natural language processing and user friendly.• Programming computers for robotics to see, hear and react to other sensory

stimuli.• More user friendly interfaces with multimedia features.• Portable note book computers introduced.

Page 22: Green Computer

GREEN Computer Book-922

Some of Fifth Generation Computer Projects are: ICOT program in Japan, MCC project in the USA etc.

The future device that will be used in the 5th generation computers, made of large organic molecules and a genetically engineered protein is called “Biochip”

Quick Review

1. Computer is an electronic device.2. Raw facts and instructions are called data that are fed to the processor.3. The meaningful processed data is called information.4. Computers can be used in different fields like education, research,

business, engineering, etc.5. A computer consists of different characteristics: Speed, Accuracy, Automatic operation, Diligence, Storage, Versatility.6. Computers have capacity to perform a variety of tasks.7. Computers are used to give special effects in movies called simulation.8. A computer has no intelligence of its own.9. Computer saves our time, money and efforts.10. Abacus was created by the Chinese about 3000 years ago as the first

mechanical aid to calculations.11. Napier’s Bone can perform calculations with two numbers.12. MARK-I is the first electromechanical computer.13. The vacuum tube was used in the first generation computers.14. ABC (Atanasoff-Berry Computer) is the first electromechanical digital

computer.15. William Oughtred also introduced the “×” symbol for multiplication

as well as the abbreviations “sin” and “cos” for the sine and cosine functions.

16. Pascaline was capable of performing additions and subtractions up to 8 digits.

17. UNIVAC consisted of magnetic tape for data input and output.18. EDSAC used a mercury delay line storage system.19. Lady Augusta Ada developed programs for performing mathematical

calculation on the Analytical Engine.

Page 23: Green Computer

Computer Book-9 23GREEN

Exercise1. Answer the following questions.

a. What is a computer?b. What are the characteristics of a computer.c. Why is a computer called a versatile machine?d. What are the limitations of a computer?e. List out the application areas of computer.f. What are the advantages of a computer?g. What is Abacus? Draw a neat and clean figure of abacus.h. Why is Charles Babbage called the father of computer? i. Who is known as the first computer programer? Why?j. Who developed Napier’s Bone and when?k. What do you know about Hollerith Tabulating machine?l. Who developed Pascaline and when? What type of calculation could

it perform?m. What is the history of computer in Nepal?n. What is computer generation?

2. Match the following:

a. 8 bits i. Giga byteb. GB ii. is equal to 2 nibblec. Microsecond iii. performs multi tasks at the same timed. Versatile iv. gives special effects in moviese. Simulation v. One millionth of a secondf. ABC EDVACg. Charles Babbage vi. Howard Aikenh. MARK-I vii. John V. Atanasoff and Clifford Berryi. UNIVAC viii. father of computer

3. Write the Full Forms of the following:

a. ABC b. UNIVAC c. EDVAC d. EDSACe. ENIAC f. PB g. TB h. KB

Page 24: Green Computer

GREEN Computer Book-924

i. MB j. GB k. GIGO l. Bitm. IC n. LSIC o. VLSIC p. ULSIC

4. Write short notes on:

a. ABC computer b. ENIACc. Mark-I d. Analytical Engine

5. State whether the following statements are ‘True’ or ‘False’.

a. Computers are used in graphics designing.b. The meaningful processed data is called information.c. 7 bits in combination is called a byte.d. Computers are able to think like human beings.e. A computer has the capacity to do same task for a long time at the

same speed.f. The storing capacity of a computer is measured in terms of byte.g. Architects use computers to design cars.h. Computer is not applicable in the field of entertainment.i. Abacus is the first electronic computer.j. UNIVAC was the first general-purpose electronic digital computer

designed for commercial use.k. EDSAC used a mercury delay line storage system.l. Difference engine was developed by Howard Aiken.m. Napier’s Bone can perform calculations with two numbers.

6. Who and when developed the following devices and when?

Devices Invented by Date of InventionENIACEDSACEDVACUNIVACABCMARK-IANALYTICAL ENGINE

Page 25: Green Computer

Computer Book-9 25GREEN

PASCALINESTEPPED RECKONERSLIDE RULENAPIER’S BONE

7. Choose the best answer.a. One bit is equal to .............. i. 1 or 0 ii. 1024 byte iii. 1024 MBb. Computer is a .............. i. electronic machine ii. mechanical machine iii. nonec. Hard disc is the .............. i. secondary storage ii. primary storage iii. noned. 8 bits is equal to ………. i.1 byte ii.1 kilo byte iii. nonee. Computers are used to compose, arrange and record music by ……...... i. designer ii. musician iii. engineerf. Computers are used to design houses and buildings by ……...... i. programer ii. architect iii. none

8. Complete the given table.

Generation Main component

Duration of generation

Computers developed

1st generation2nd generation3rd generation4th generation5th generation

Project work1. Collect picture of the computer/devices and inventors of various

generation of computer.2. Write about the invention of Charles Babbage in detail with figure.

Page 26: Green Computer

GREEN Computer Book-926

Types of Computer2

IntroductionThe computer kept on the desk in your computer lab is a microcomputer. The power of the microcomputer is not enough for most large organizations. Computer can be used in different sectors like school, hospital, offices, resource centers, music, movies, etc. Computers used in different sectors may not be of same type. They may differ in processing speed, storage capacity, size and nature of tasks that they can perform. A computer can be as big as an entire room or as small as a microcontroller found in mobiles and embedded systems.Computers may be special purpose computer and general purpose computer. Special purpose computers are designed to perform specific tasks and general purpose computers are versatile, designed to perform various tasks.Computers can be divided into different categories on the basis of processing speed, size and work.

On the basis of workThere are three types of computers on the basis of work. They are:1. Analog computer2. Digital computer3. Hybrid computer

1. Analog computer: Analog computer is a computing device that works on continuous range of values. The analog computers give approximate results since they deal with quantities that changes continuously. It generally deals with physical variables such as voltage, pressure, temperature, speed, etc. ECG (Electro Cardio Graph) is an example of analog computer.

Page 27: Green Computer

Computer Book-9 27GREEN

2. Digital computer:Our PC is a digital computer which operates on discrete data. Its operation is based on binary system. i.e. 0 and 1 digits. Digital computers can give the results with more accuracy and at a faster rate. Digital computers are mostly used in different sectors for performing variety of jobs. They are able to save the data for future use also.On the basis of size and processing speed, digital computers are classified into four types:a. Super computersb. Mini computersc. Mainframe computersd. Micro computers

a. Super computer:Supercomputer is the most powerful, fastest, and also very expensive. It was developed in the 1980s. It is used to process large amount of data and to solve the complicated scientific problems. It can perform more than one trillion calculations per second. It has a large number of processors connected parallely. So parallel processing is done by this computer. In a single supercomputer, thousands of users can be connected at the same time and the supercomputer handles the work of each user separately.

Supercomputers are mainly used for:• Weather forecasting• Nuclear energy research• Aircraft design• Automotive design• Online banking• Controlling industrial unitsSome of the super computers are: Cray-1, Cray-2, Control Data Cyber 205, ETA, etc

Page 28: Green Computer

GREEN Computer Book-928

b. Mini computers:Mini computers are the medium sized computers which are larger than micro computers and smaller than mainframe computers. They have larger storage capacity and higher speed than micro computers. Minicomputers may contain one or more processors, support multiprocessing and tasking that can support up to 200 users simultaneously, and are generally resilient to high workloads. Minicomputers are commonly used as servers in network environment and hundreds of personal computers can be connected to the network with a minicomputer. Acting as server like mainframes, minicomputers are used as web servers. The first minicomputer was introduced in the mid-1960s by Digital Equipment Corporation (DEC). After this, IBM Corporation (AS/400 computers) Data General Corporation and Prime Computer also designed the minicomputers.Some of the Mini Computers are: IBM AS/400, IBM SYSTEM 360, HP 3000, PRIME 9755

c. Mainframe computers:It is a very large and expensive computer that requires a very large clean room with air-conditioner capable of supporting hundreds, or even thousands, of users simultaneously. It also has multiple processors. Their performance speed and storage capacity is higher than the mini computers. Some of the obvious customers are banks, airlines and railway reservation systems, aerospace companies doing complex aircraft design, etc. Some of the Mainframe Computers are - IBM S/390, Amdahl 580, Control Data Cyber 176. There are basically two types of terminals used with mainframe systems

Page 29: Green Computer

Computer Book-9 29GREEN

i. Dumb TerminalDumb terminal does not have its own CPU and storage device. This type of terminal uses the CPU and storage devices of mainframe system. Typically, a dumb terminal consists of monitor and a keyboard (or mouse).

ii. Intelligent TerminalIntelligent terminal has its own processor and can perform some processing operations. Usually, this type of terminal does not have its own storage.

d. Micro Computers:The invention of microprocessor (single chip CPU) gave birth to the micro computers. Official and household computers are micro computers. Micro computers are also known as personal computers. They are small in size. Some of the micro computers can be held on palm and on the lap. They are called palmtop and laptop computers. Personal computers are categorized as:

Desktop computersDesktop computers are designed for use at a desk or table. They are typically larger and more powerful than other types of personal computers.

Tower PCsThey are those microcomputers in which the case sits as a "tower," often on the floor beside a desk, thus freeing up desk surface space.

Laptops and notebooksThey are also called notebook computers. They are light weight portable computers with built-in monitor, keyboard, hard-disc drive, battery, and AC adapter that can be plugged into an electrical outlet. You can put them in your lap and work.

Page 30: Green Computer

GREEN Computer Book-930

Personal digital assistants (PDAs) PDA is also called handheld computer or palmtop that combines personal organization tools-schedule planners, address books, to-do lists. Some are able to send e-mail and faxes. Some PDAs have touch-sensitive screens. Some PDAs also connect to desktop computers for sending or receiving information.

Smart phonesSmart phones are mobile phones that have some of the same capabilities as a computer. You can use a smart phone to make telephone calls, access the Internet, organize contact information, send e-mail and text messages, play games, and take pictures. Smart phones usually have a keyboard and a large screen.

Tablet PCsTablet PCs are mobile PCs that combine features of laptops and handheld computers. Like laptops, they're powerful and have a built-in screen. Like handheld computers, they allow you to write notes or draw pictures on the screen, usually with a tablet pen instead of a stylus. They can also convert your handwriting into typed text. Some tablet PCs are “convertibles” with a screen that swivels and unfolds to reveal a keyboard underneath.WorkstationsWorkstations are special single user computers having the same features as personal computer but have the processing speed equivalent to minicomputer or mainframe computer. A workstation computer can be fitted on a desktop. Scientists, engineers, architects and graphic designers mostly use these computers. Workstation computers are expensive and

Page 31: Green Computer

Computer Book-9 31GREEN

powerful computers. These computers have advanced processors, more RAM and storage capacity than personal computers. These are usually used as single-user applications but these are used as servers on computer network and web servers as well.

3. Hybrid computerA hybrid computing system is a combination of desirable features of analog and digital computers. Hybrid computers can process both the continuous (analog) and discrete (digital) data. These are special purpose computers. It is mostly used for automated and complex operations such as ultra sound and equipment of ICU (Intensive Care Unit) in hospital. (ECG) Electrocardiogram, Halter Monitoring Machine.

Quick Review

1. Micro computers are also known as personal computers.2. Analog computer is a computing device that works on continuous

range of values.3. Our PC is a digital computer which operates on discrete data.4. Hybrid computer is the fusion of analog and digital computer.5. Super computer is the fastest computer used in scientific research.6. Minicomputers may contain one or more processors, support

multiprocessing and tasking that can support up to 200 users simultaneously.

7. Laptop is also called notebook computer.8. The computers on the basis of size are digital computers.

Exercise1. Answer the following questions:

a. Write any two differences between analog computer and digital computer.

b. What do you mean by hybrid computer? Give some examples.c. What is super computer? Where is it used?d. List out the computers on the basis of size.

Page 32: Green Computer

GREEN Computer Book-932

e. What is micro computer? List out the types of microcomputer.f. Write the differences between minicomputer and mainframe

computer.g. Write the differences between personal computer and work station.

2. Write short notes on :

a. Desktop b. Tablet c. PDA d. Workstation e. Laptop

3. State whether these statements are 'True' or 'False':a. Personal computers are also called digital computers.b. Desktop computer can be kept up into lap and work.c. Smart phones are mobile phones that have some of the same

capabilities as a computer.d. Super computers are used in scientific research.e. Analog computers represent the data in discrete variable.

4. Fill in the blanks:

a. Temperature, voltage, etc. can be measured by........................computer.b. ............................ computers are generally connected in network.c. ............................ can support up to thousand users simultaneously. d. ............................ is used in research and whether forecast.e. Hybrid computers use features both .......................and .....................

5. Choose the best answer:

a. ..............computer is used in scientific research. i. Hybrid computer ii. Analog computer iii. Super computer b. Computer used in server is called .............. i. analog computer ii. super computer iii. minicomputer c. Computer that is mostly used in hospital.............. i. analog computer ii. hybrid computer iii. digital computer d. Digital computer displays the output as.............. i. discrete data ii. continuous data iii. None

Page 33: Green Computer

Computer Book-9 33GREEN

e. Analog computer displays the output as.............. i. discrete data ii. continuous data iii. none

6. Match the following:

a. Laptop i. combine features of laptops and handheld computers

b. Analog computer ii. middle size computerc. Workstation iii. works on continuous flow of datad. Minicomputer iv. small portable computere. Tablet v. built in network support

7. Write technical terms for the following statement. a. A computer can process both analog and digital data. b. The computer also known as personal computer. c. A single user computer having the sdame feature as personal computer. d. A terminal does not have its own CPU ad storage device. e. A computer which operates on discrete data.

Project workHow hand held devices help people smartly? List out the name of some hand held devices and explain them in your classroom.

Page 34: Green Computer

GREEN Computer Book-934

Computer System3

IntroductionComputers are often compared to human beings since both have the ability to accept data, store, work with it, retrieve and provide information. The main difference is that human beings have the ability to perform all of these actions independently. Human beings also think and control their own activities. The computer, however, requires a program (a predefined set of instructions) to perform an assigned task.A system is a group of interrelated or interacting elements forming a unified whole, or a group. It is a collection of interrelated components working together toward a common goal by accepting inputs and producing outputs in an organized transformation process (dynamic system). A subsystem is one part of a system where the products of more than one system are combined to reach an ultimate goal. A large system can be decomposed into small subsystems.A computer system is the integration of physical entities called hardware and non-physical entities called software. The hardware components include input devices, processor, storage devices and output devices. The software items are programs and operating aids (systems) so that the computer can process the data.The computer along with various units and software that performs different activities in data processing is collectively known as Computer System. A computer system is divided into two sub-systems:

Computer SoftwareA set of instructions given to the computer in machine code that tells the computer what to do and how to perform the given task of the user is known as computer software.

Hardware + =Software Computer System

Page 35: Green Computer

Computer Book-9 35GREEN

Computer HardwareThe physical parts of a computer are known as computer hardware. You can touch, see and feel the hardware. The hardware consists of electronic circuits and mechanical equipment, etc. used to perform various functions in the computer.

CPU

ArithmaticLogic Unit (ALU)

PrimaryStorage Unit

Secondary Storage Unit

InputUnit

OutputUnit

Control flowData flow

Control Unit (CU)

Input unit: It allows the user to enter data and give instruction to the processing unit. Keyboard, mouse, joystick, scanner, microphone, etc are the commonly used input devices.

Output Unit: It displays data and information of different forms. Monitor, speaker and printer are the commonly used output devices.

Processing Unit: The central processing unit (CPU) performs the actual computation or “number crunching” inside any computer. The CPU is also called microprocessor. The CPU, or central processing unit is the heart and soul of every computer. This is the part which does the work of executing machine instructions. Traditionally, it is just one microprocessor with lots of pins to connect it to memory and devices - usually identifiable by being the largest chip. In modern machines, there may be several CPUs which can work parallelly. VLSI (very large scale integration) technology has made it possible to put many separate processors and memory into a single package, so the physical distinction between the CPU and its supporting chips is getting blurred. Nevertheless, the CPU is still logically separate from the memory and devices. The CPU is driven by a `clock' or pulse generator. Each instruction completes in a certain number of `clock cycles'.

Page 36: Green Computer

GREEN Computer Book-936

CPU is divided into three units:• Control Unit• Arithmetic and Logic Unit • Memory Unit

a. Control Unit This unit controls the operations of all parts of computer but does not carry

out any actual data processing operations. Functions of this unit are:• It is responsible for controlling the transfer of data and instructions among

other units of a computer.• It manages and coordinates all the units of the computer.• It obtains the instructions from the memory, interprets them, and directs

the operation of the computer.• It communicates with Input/ Output devices for transfer of data or results

from storage.

b. ALU(Arithmetic Logic Unit) ALU is the unit of CPU which performs arithmetic and logic operations like

addition, subtraction, multiplication and division. Data to be arithmetically manipulated are copied from main memory and placed in registers(memory unit) for processing. The result can be transferred from the register to the main memory. Upon completion of the arithmetic operation, it performs logical operations like comparing, selecting, matching and merging of data. All complex operations are done by making repetitive use of above operations.

c. Memory Unit The third part of the processor is memory unit. This includes all the

program instructions and all the data needed to carry out those instructions. Memory unit can store instructions, data and intermediate results. This unit supplies information to the other units of the computer when needed. One of the jobs of control unit is to be able to find the information stored there when it is to be used.

Page 37: Green Computer

Computer Book-9 37GREEN

There are two types of computer memory1. Primary memory 2. Secondary memory

1 nibble = 4 bits Eg : 1011 is one nibble1 byte = 8 bits Eg. 10101110 is one byte1 kilobyte = 210 bytes = 1024 bytes 1 megabyte = 210 KB = 1024 KB1 gigabyte = 210 MB = 1024 MB1 terabyte = 210 GB = 1024 GB1 Petabyte = 210 TB = 1024 TB

1. Primary Memory Primary Memory is the main memory of the computer which is attached

directly to the motherboard. So, it is fast in computer operation. Generally, primary memory holds only those data and instructions on which computer is currently working. It is more expensive than secondary memory. There are two types of primary memory and they are:

• Random Access Memory (RAM)• Read Only Memory (ROM)

Cache memory is a very high speed semiconductor memory which can speed up the CPU. It acts as a buffer between the CPU and main memory. It is used to hold those parts of data and program which are most frequently used by CPU.

Random Access Memory (RAM)RAM stands for Random Access Memory. When we boot the computer, it starts to load system file of operating system into the RAM. It holds only those data and instructions which the computer is currently working on. It is called volatile and temporary memory because its data is lost when computer is turned off. It is re-writeable memory. It is of two types: Static RAM (SRAM) and Dynamic RAM (DRAM)

Page 38: Green Computer

GREEN Computer Book-938

Read Only Memory (ROM)ROM stands for Read Only Memory. The data/ program stored on the ROM are permanent and non-volatile. The program stored on ROM is called firmware The data remains the same when computer is turned off. We are only able to read the data but unable to write on it. It is of three types:PROM (Programmable Read Only Memory): It is a memory chip on which we can store a program. But once the PROM has been used, we cannot wipe it clean and use it to store something else. It can be programd under special conditions.EPROM (Erasable Programmable Read Only Memory): We can erase its stored program by exposing it to ultraviolet light. EPROMs are cheap, reliable and hence they are widely used.EEPROM (Electrically Erasable Programmable Read Only Memory): The program written on it can be erased using electrical signals.Cache MemoryCache memory is a type of very fast memory that is used to improve the speed of a computer. It acts as an intermediate store between the CPU and main memory, and works by storing the most frequently and recently used instructions and data so that it will be very fast to retrieve them again. Thus when an item of data is required, a whole block of data will be read into cache in the expectation that the next piece of data required is likely to be in the same block. The amount of memory is generally between 1 kb to 1 GB.Register MemoryRegister is a special, high-speed storage area within the CPU. All data must be represented in a register before it can be processed. For example, if two numbers are to be multiplied, both numbers must be in registers, and the result is also placed in a register. (The register can contain the address of a memory location where data is stored rather than the actual data itself.)The number of registers that a CPU has and the size of each (number of bits) help determine the power and speed of a CPU. For example, a 32-bit CPU is one in which each register is 32 bits wide. Therefore, each CPU instruction can manipulate 32 bits of data.

2. Secondary Memory (Storage Unit) Secondary memory is the permanent type memory having large storage

capacity. It is slower than main memory. It is connected to the motherboard

Page 39: Green Computer

Computer Book-9 39GREEN

through cables. In this memory we can store the data which is used for future. It uses the magnetic technology to store the data. For example:- hard disk, CD-ROM, pen drive, floppy disk, etc. It is also known as auxiliary memory.

Magnetic DiskMagnetic storage or magnetic recording is the storage of data on a magnetized medium. Magnetic storage uses different patterns of magnetisation in a magnetisable material to store data and is a form of non-volatile memory. Some of the popular magnetic disks are:

Hard DiskA hard disk is fixed inside the cabinet of CPU-casing. It is made up of many rigid metal plates coated to store data magnetically. The hard disk rotates while recording data. Its rotation speed is measured in the unit of revolutions per minute (rpm). It has high storage capacity and data retrieval is very fast.

Primary memory Secondary memory1. Directly attached with mother

board2. Expensive3. Less storage capacity4. Fast5. Eg. RAM, ROM, Cache memory

etc

1. Indirectly connected to the processor.

2. Cheap3. High storage capacity4. Slow5. Hard disc, pen drive, CD, DVD

etc

Floppy DiskA floppy disk commonly came in three sizes, 8 inches, 5.5 inches and 3.5 inches, becoming smaller as the technology advanced. The newer, 3.5-inch version used more cutting-edge technology and held more data than previous models, while the original 8-inch floppy drive was developed to load hardware-level instructions and/or data structures called microcode into the IBM System/370 mainframe. The 8-inch flexible discette was read-only, held 80 kilobytes of memory and was referred to as a memory disk.

514 inch

write protect notch312 inch

write protect switch

Page 40: Green Computer

GREEN Computer Book-940

Using a floppy disk to exchange data between PCs was a standard method for many computer technicians. The floppy disk was one of the most common ways to store adequate amount of data outside of a computer's hard drive for personal use because they were inexpensive and easy to carry.

Optical DiscAn optical disc is any disc that uses optical storage techniques and technology to read and write data. It is a computer storage disc that stores data digitally and uses laser beams (transmitted from a laser head mounted on an optical disc drive) to read and write data. It is primarily used as a portable and secondary storage device. It can store more data than the previous generation of magnetic storage media, and has a relatively longer lifespan. Compact discs (CD), digital versatile/video discs (DVD) and Blu-ray discs are currently the most commonly used forms of optical discs. These discs are generally used to: • Distribute software to customers• Store large amounts of data such as music, images and videos• Transfer data to different computers or devices• Back up data from a local machine

Some of the popularly used optical discs are discussed below:

CD-ROM (Compact Disc Read Only Memory)It is the popularly known storage device. A CD can store 600 to 750 MB data on it. Laser is used to read data of common CDs. The data may be in the form of text, image, sound, video clips, animated movies or their combinations. There are two kinds of CDs:CD-R : It stands for Compact Disc-Readable. In this type of CD, data once

written cannot be changed or deleted.CD-RW: It stands for Compact Disc-Rewritable. Data in this CD can be

erased or rewritten.

DVD (Digital Versatile Disc or Digital Video Disc)It is very similar to a CD but can store much more data. It is an optical disc storage device. It can be recorded on one or both sides. Its capacity may range from 4.7GB to 8.5 GB.

Page 41: Green Computer

Computer Book-9 41GREEN

Blu-ray (not Blue-ray) also known as Blu-ray Disc (BD), is the name of a new optical disc format. The format was developed to enable recording, rewriting and playback of high-definition video (HD), as well as storing large amounts of data. The format offers more than five times the storage capacity of traditional DVDs and can hold up to 25GB on a single-layer disc and 50GB on a dual-layer disc.

Pen DriveIt is a small pen-like device. It can be connected outside the computer at a place called USB port. It can store large amount of data, 2 GB, 4 GB, 8 GB, 16 GB, 32 GB or more. It is the most convenient device to carry data from one place to another as we can put it inside our pockets. It is also known as flash drive.

Magnetic TapeMagnetic tape is one of the older types of magnetic storage media. The magnetic tape recorder was invented in 1928 and was primarily used for analog audio recordings. Before music CDs were introduced in 1980s people were using magnetic tape called cassettes for portable music player. Early computers adapted this technology to store digital information. One of the major weaknesses is that information on a tape can only be accessed in a very sequential fashion. This is fine if you want to listen to the whole music album in sequence, but computer systems typically need to access data in a non-sequential manner. For magnetic tape, this means you may need to fast forward through a lot of tape to get to a specific piece of data. While magnetic tape is a very cheap way to store data, the very slow access to the data meant that it was primarily used for creating backups of data in case older forms of storage failed. Tape backup systems are still in use today, but their importance has greatly declined with the advancement of cheap, large capacity hard-disk drives.

Page 42: Green Computer

GREEN Computer Book-942

Quick Review

1. A computer system is the integration of physical entities called hardware and non-physical entities called software.

2. Secondary storage is the permanent type memory having a large storage capacity.

3. An optical disc is any computer disk that uses optical storage techniques and technology to read and write data.

4. CPU is also called micro processor or chip.5. Control unit controls the operations of all parts of the computer.6. Memory unit can store instructions, data and intermediate results.7. The floppy disc was one of the most common ways to store adequate

amounts of data outside of a computer's hard drive for personal use because they were inexpensive and easy to carry.

8. Computer stores data and instructions temporarily and permanently.9. RAM is called volatile and temporary memory.10. The data stored on the ROM is permanent and non-volatile.11. Bits means binary digits i.e. 0 and 1.12. RAM refers to read write memory.13. Blu-ray disc can store up to 50 GB data.14. Magnetic tape is a sequential storage device.15. Cache memory is a type of very fast memory that is used to improve the

speed of a computer.

Exercise1. Answer the following questions:

a. What is a computer system?b. Draw a neat and clean figure of computer system architecture.c. What is CPU? Explain its three units.d. What is memory? Write its functions.e. Write the differences between primary memory and secondary

memory.f. What is magnetic tape? How does it store data?g. Compare and contrast DVD and Blu-ray disc.h. What is optical disc? Give some examples.i. What is floppy disc? Explain in brief.

2. Give full form of the following:a. CPU b. ALU c. MU d. RAM e. DVDf. CD-RW g. EPROM h. SRAM i. DRAM j. BD

Page 43: Green Computer

Computer Book-9 43GREEN

3. State whether the following statements are true or false.a. Computer system includes hardware components only. b. Read Only Memory (ROM) is volatile.c. Blu-ray disc only stores 500 to 800 MB data.d. Floppy disc is a sequential access storage medium.e. Hard disc is an optical disc.f. The data stored on the ROM is permanent and non-volatile.g. Data stored on magnetic tape unit can be accessed randomly.

4. Fill in the blanks.a. CPU is also called…………..b. …………….. controls the operations of all parts of a computer.c. ………….. stores data and instructions.d. ……………performs arithmetic and logic operations.e. Computer system is integration of ……………..and software.

5. Write technical terms for the following:a. It is a sequential storage device.b. It is a non-volatile memory.c. It is an optical disc.d. 0 and 1 refers to.:e. It is a 4 bits in combination.

6. Write short notes on the following:a. Cache memoryb. Register memoryc. CD-ROMd. ALU( Arithmetic Logic Unit)e. CU (Control Unit)

7. Multiple choice question:a. RAM is als called: i. non-volatile ii. permanent iii. volatileb. The disk which uses optical storage techniques i. Flopy disk ii. Hard disk iii. Optical diskc. The program written in this memory can be erased using electrical

signals. i. ROM ii. EEPROM iii. EPROMd. The unit of CPU which prefer antumetic and logic i. ALU ii. CLI iii. CU

Page 44: Green Computer

GREEN Computer Book-944

Computer Hardware4

IntroductionComputer hardware refers to the physical parts of a computer and related devices. Internal hardware devices include motherboards, hard drives, and RAM. External hardware devices include monitors, keyboards, printers and scanners.The internal hardware parts of a computer are often referred to as components, while external hardware devices are usually called peripherals. Together, they all fall under the category of computer hardware. Software, on the other hand, consists of the programs and applications that run on computers. Because software runs on computer hardware, software programs often have at least the minimum hardware required for the software to run.

The internal hardware parts of a computer

MotherboardA motherboard is one of the most essential parts of a computer system. It holds together many of the crucial components of a computer and some components are built in it. It includes the central processing unit (CPU), memory and connectors for input and output devices. The base of a motherboard consists of a very hard sheet of non-conductive material, typically some sort of rigid plastic. Thin layers of copper or aluminum foil, referred to as traces, are printed onto this sheet. These traces are very narrow and form the circuits between the various components. In addition to circuits, a motherboard contains a number of sockets and slots to connect the other components. Many internal devices - such as video cards, sound cards, disc controller and other devices are housed on their own smaller circuit board, which is attached to mother board.

Page 45: Green Computer

Computer Book-9 45GREEN

“The board is the 'mother' of all components - that's why it gets its name.”

• A CPU socket, the actual CPU is directly soldered onto this socket. Since high speed CPUs generate a lot of heat, there are heat sinks and mounting points for fans right next to the CPU socket.

• A power connector to distribute power to the CPU and other components. • Slots for the system's main memory, typically in the form of DRAM chips. • A chip forms an interface between the CPU, the main memory and other

components. On many types of motherboards this is referred to as the Northbridge. This chip also contains a large heat sink.

• A second chip controls the input and output (I/O) functions. It is not connected directly to the CPU but to the Northbridge. This I/O controller is referred to as the Southbridge. The Northbridge and Southbridge combined are referred to as the chipset.

• Several connectors (ports) provide the physical interface between input and output devices and the motherboard. The Southbridge handles these connections.

• Slots for one or more hard drives to store files. The most common types of connections are Integrated Drive Electronics (IDE) and Serial Advanced Technology Attachment (SATA).

Page 46: Green Computer

GREEN Computer Book-946

• A Read-only memory (ROM) chip, contains the firmware, or startup instructions for the computer system. This is also called the BIOS.

• A slot for a video or graphics card. There are a number of different types of slots, including Accelerated Graphics Port (AGP) and Peripheral Component Interconnect Express (PCI).

• Additional slots to connect hardware in the form of Peripheral Component Interconnect (PCI) slots. This is also called expansion slot which helps to enhance the computer performance.

• The CPU clock synchronizes the operation of all parts of the PC and provides the basic timing signal for the CPU. Using a quartz crystal, the CPU clock breathes life into the microprocessor by feeding it a constant flow of pulses. For example, a 200 MHz CPU receives 200 million pulses per second from the clock. A 2 GHz CPU gets two billion pulses per second. Similarly, in any communications device a clock may be used to synchronize the data pulses between sender and receiver.

• Motherboards also include a small separate block of memory made from CMOS RAM chips which is kept alive by a battery (known as a CMOS battery) even when the PC’s power is off. This prevents reconfiguration when the PC is powered on.

MicroprocessorThe microprocessor performs the actual computation or “number crunching” inside any computer. The CPU is also called microprocessor. The central processing unit (CPU) is the heart and soul of every computer. This is the part which does the work of executing machine instructions. Traditionally, it is just one microprocessor with lots of pins to connect it to memory and devices - usually identifiable by being the largest chip. The CPU is driven by a `clock' or pulse generator. Each instruction completes in a certain number of `clock cycles'.

CPU is divided into three units:• Control Unit• Arithmetic and Logic Unit • Memory UnitControl Unit: This unit controls the operations of all parts of computer but does not carry out any actual data processing operations.

Page 47: Green Computer

Computer Book-9 47GREEN

ALU (Arithmetic Logic Unit): ALU is the unit of CPU which performs arithmetic and logic operations like addition, subtraction, multiplication and division. Data to be arithmetically manipulated are copied from main memory and placed in registers(memory unit) for processing. Memory Unit: It is the third part of CPU. This includes all the program instructions and all the data needed to carry out those instructions. Memory unit can store instructions, data and intermediate results. RAM, ROM, cache memory, register memory, hard disk comes under this category.

BusA bus, in computing, is a set of physical connections (cables, printed circuits, etc.) which can be shared by multiple hardware components in order to communicate with one another. You can think of a bus as a highway on which data travels within a computer. There's also an expansion bus that enables expansion boards to access the CPU and memory. Buses are divided into three parts. They are as follows:

CPU

Control bus

Address bus

Data bus

Memory Input and Output

Syst

em b

us

• The address bus (sometimes called the memory bus) transports memory addresses which the processor wants to access in order to read or write data. It is a unidirectional bus.

• The data bus transfers instructions coming from or going to the processor. It is a bidirectional bus.

Page 48: Green Computer

GREEN Computer Book-948

• The control bus (or command bus) transports orders and synchronization signals coming from the control unit and travelling to all other hardware components. It is a bidirectional bus, as it also transmits response signals from the hardware.

The External Hardware Parts of a Computer

Input DevicesIt is the computer hardware that allows the user to enter the program and data and send it to the processing unit. The device used to feed the data, instructions and commands to the computer is called an input device. It is the media through which users can interact with the computer. The commonly used input devices are keyboard, mouse, joystick, digital camera, microphone, scanner, track ball, etc.

KeyboardIt is the most commonly used input device. It is used mainly for typing text, numbers and characters that can be seen on the screen. We can also give some commands to the computer by pressing shortcut keys. It looks like a typewriter. When we press the keys of the keyboard, keys touch the circuit present on it and is passed to the processing unit. Generally, keyboard consists of 104 keys on QWETRY layout. The keys of the computer are divided into five groups:a) Alphabet keys (Refers to the alphabet A-Z)b) Numeric keys (Refers to the numbers 0-9)c) Special keys (Space bar, Enter key, Backspace key, etc.)d) Functional keys (Refers to the F1-F12 keys)e) Arrow keys (Refers toup, down, left and right keys)

MouseA mouse is the small pointing device that contains one or more buttons for pointing and selecting the computer screen items. The mouse pointer moves according to the movement of the mouse. The pointer of the mouse is called cursor. There are two types of mouse found in the market. They are scroll mouse and optical mouse.

Page 49: Green Computer

Computer Book-9 49GREEN

i. Optical Mouse: It is based on the light sensor. The movement of the cursor is based on the reflection of the light from the object.

ii. Scroll Mouse: It is based on the mechanical movement of the ball present at the bottom. The movement of the cursor is based on the movement of the ball under the mouse.

Different actions of a mousea. Clickingb. Draggingc. Droppingd. Double click and right click

Digital CameraA Digital camera is an input device that captures pictures of an object and transfers them to the computer digitally. It uses the memory card to save the images. The images can be viewed and erased. The data saved on it is in binary form. The resolution of pictures depends on the pixel power of the that camera

Joystick A Jouystick is a pointing input device. It moves in all directions and controls the movement of a pointer or some other display symbol. A joystick is similar to a mouse. Most joysticks include two buttons called triggers.Joysticks are used mostly for computer games, but they are also used occasionally for computer aided design (CAD) and computer aided manufacturing (CAM) systems and other applications

ScannerA scanner is used to scan documents, pictures and drawings to the computer. It converts the hard copy into digital form and saves into the computer. It is of different types according to its shape and size. It consists of the illumination part to illuminate the images and another part to convert the image into digital form to save it digitally. It is of two types:

Page 50: Green Computer

GREEN Computer Book-950

1. Handheld scanner: A scanner that is moved by hand over the material being captured. Handheld scanners are small and less expensive than their desktop counterparts but partially rely on the user's dexterity to move the unit across the paper.

2. Flatbed scanner: A scanner provides a flat, glass surface to hold a sheet of paper, book or other object for scanning. The scan head is moved under the glass. Flatbed scanners often come with sheet feeders for scanning multiple sheets of paper rather than one at a time.

MicrophoneA microphone is an input device used to take the voice or sound as an input to the computer. It converts our voice into the digital form. It is usually used for chatting and video conferencing through Internet. Nowadays wireless microphone is also available.

Track BallA track ball looks like a mouse but it is fixed to the computer system. It consists of a ball at its upper part and three buttons. If you want to move the cursor, then you move the ball with your finger. It occupies a small area so is useful for laptops.

Touch PadA touch pad is a touch sensitive part used as an input device. To move the cursor in the screen, you can move the finger on the pad. It substitutes the mouse and is inbuilt in the keyboard of the laptop.

Light PenA light pen is an input device that utilizes a light-sensitive detector to select objects on a display screen. A light pen is similar to a mouse, except that with a light pen you can move the pointer and select objects on the display screen by directly pointing to the objects with the pen.

Page 51: Green Computer

Computer Book-9 51GREEN

Output DeviceProcessed data are called output or information. They can be used for different purposes. Output can be in different forms: text, image, audio, video hard copy, etc. Output devices are the devices which display output of computer in different forms. Some of the important output devices are: Monitor, speaker, printer, etc. They are categorized into two parts: a. Softcopy Output b. Hardcopy Output

a. Softcopy Output The information such as text, pictures, video and sound displayed on monitor and speaker is called softcopy output. It displays data and information as soon as power is supplied to the devices. Some of the softcopy output devices are: Monitor and speaker.

MonitorIt is the softcopy output device which looks like a television screen and is used to display text and graphics. According to the technology used, it is of two types. They are CRT monitors and flat panel display monitors.CRT monitors Cathode Ray Tube technology consumes more power as well as heavier in weight. Monochrome monitors display a single colour on black background white character or white background black character. The resolution or clarity of the image on the monitor depends on the number of individual dots displayed.Flat-panel displayThe flat-panel display refers to a class of video devices. It reduces volume, weight and power requirement in comparison to the CRT monitor. There are two types of flat-panel display: LCD (Liquid- crystal display): The non-emissive displays use optical effects to convert sunlight or light from some other source into graphics patterns. Example is LCD, Liquid – Crystal Display.

Page 52: Green Computer

GREEN Computer Book-952

LED ( Light- emitting Diode): The emissive displays are devices that convert electrical energy into light. Plasma panel and LED, Light – Emitting Diodes are the examples of LED.

SpeakerA speaker is an output device used to play sound generated by the computer. They may be built into the system unit or connected with cables. Speakers allow you to listen to music from your computer. They are also softcopy output devices.

b. Hard Copy OutputThe output which is in the printed form is called hard copy. The device used to generate the hardcopy is called hardcopy output device. Generally, a printer is considered as a hardcopy output device.

PrinterA printer is an output device that gives permanent copy of output produced from a computer. The output in the permanent form or printed form is called hard copy. On the basis of the technology used, printers can be categorized into two. They are Impact printers and Non-impact printers.

i. Impact PrinterImpact printer is a type of printer that uses tiny hammers that strike against the ink ribbon and paper to produce characters on the sheet of paper. The output which is in the printed form is called hard copy. The device used to generate the hardcopy is called hardcopy output device. Generally, a printer is considered as a hardcopy output device.Daisy Wheel PrinterIt is a low quality printer which prints one character at a time. It contains wheel with spokes which contain characters which hit on the ribbon. It produces a noise and its performance is low.Dot Matrix PrinterThe dot matrix printer is formed by arranging a number of small dots in a specific number of rows and columns. It is either line or serial printer.

i. Non-Impact PrinterNon-impact printers are those in which the printing is done with ink-jet, electrostatic, chemical and thermal technology. The quality of printing is higher

Page 53: Green Computer

Computer Book-9 53GREEN

than that of the impact printer. Inkjet printer and laser printer are examples of non-impact printers.Ink Jet PrinterInk jet printer sprays the ink onto the paper during the time of printing. It produces less noise and gives higher quality of print than Daisy Wheel Printer. The printing can be done in wide varieties of colours.

Laser PrinterIt produces a very high quality output of text and document. It uses the laser beam to print the output. It is a high speed printer.

Computer PortsA port is a physical docking point using which an external device can be connected to the computer. It can also be programmatic docking point through which information flows from a program to computer or over the internet.

Page 54: Green Computer

GREEN Computer Book-954

Following are few important types of ports:

Serial PortIt is used for external modems and older computer mouse. Two versions : 9 pin, 25 pin model Data travels at 115 kilobits per second.

Parallel PortIt is used for scanners and printers. It is also called printer port 25 pin model It is also known as IEEE 1284-compliant Getronics port.

PS/2 PortUsed for old computer keyboard and mouse. Most of the old computers provide two PS/2 port, each for mouse and keyboard. It is also known as IEEE 1284-compliant centronics port.

Universal Serial Bus (USB Port)It can connect all kinds of external USB devices such as external hard disc, printer, scanner, mouse, keyboard, etc. It was introduced in 1997. Most of the computers provide two USB ports as minimum. Data travels at 12 megabits per second. USB compliant devices can get power from a USB port.

VGA PortConnects monitor to a computer's video card. It has 15 holes and similar to serial port connector but serial port connector has pins, it has holes.

Power ConnectorThree-pronged plug, connects to the computer's power cable that plugs into a power bar or wall socket.

Fire wire PortTransfers large amount of data at very fast speed. It connects camcorders and video equipment to the computer. Data travels at 400 to 800 megabits per second.

MODEM PortConnects a PC's modem to the telephone network.

Page 55: Green Computer

Computer Book-9 55GREEN

Ethernet PortConnects to a network and high speed Internet. It connects network cable to a computer.This port resides on an Ethernet Card. Data travels at 10 megabits to 1000 megabits per second depending upon the network bandwidth.

Game PortIt connects a joystick to a PC, now replaced by USB.

Digital Video Interface (DVI) portConnects flat panel LCD monitor to the computer's high end video graphic cards. It is very popular among video card manufacturers.

SocketsConnect microphone, speakers to sound card of CPU.

Quick Review

1. Computer hardware refers to the physical parts of a computer and related devices.

2. A scanner is used to scan documents, pictures and drawings.3. A motherboard is one of the most essential parts of a computer system

which holds together many of the crucial components of a computer and some components are built in it.

4. The microprocessor performs the actual computation or “number crunching” inside any computer.

5. A microphone is an input device used to take the voice or sound.6. A bus, in computing, is a set of physical connections (cables, printed

circuits, etc.) which can be shared by multiple hardware components in order to communicate with one another.

7. A joystick is a pointing input device usually used for playing games.8. A mouse is a small input device which is used to point and select items.9. Monitor is the softcopy output device.10. Printer is the hardcopy output device.

Page 56: Green Computer

GREEN Computer Book-956

11. LCD monitor consumes less power.12. CRT monitor consumes more power.13. Laser printer produces very high quality output of text and document.14. CPU is also called micro processor or chip.15. Control unit controls the operations of all parts of computer.16. A port is a physical docking point using which an external device can

be connected to the computer.

Exercise1. Answer the following questions:

a. What is hardware? List the internal components of computer.b. What is motherboard? List out the components of motherboard.c. What is processor? Write three parts of a processor.d. In how many groups is keyboard divided?e. What is bus? Describe its types.f. What is a mouse? Write different functions of a mouse.g. What is a scanner? How many types of scanners are there?h. Differentiate between soft copy and hard copy output. i. What is a monitor? Explain its types.j. What is a printer? Write down the differences between impact and

non-impact printer.k. What is CPU? Explain its three units.l. What is computer port? List out the types of ports.

2. Give full form of the following:a. LED b. LCD c. CPU d. ALU e. CADf. AGP g. PCI h. CMOS i. DVI j. SATA

3. State whether the following statements are true or false.a. Track ball occupies a small area so is useful for laptops.b. Joystick is a pointing input device usually used for playing games. c. Touch pad is a touch sensitive part used as an input device.d. Digital camera is used to scan the documents.e. Buses are the group of wires.f. The control bus transfers instructions coming from or going to the

processor.

Page 57: Green Computer

Computer Book-9 57GREEN

g. Printer is the hardcopy output device.h. Daisy wheel printer is a high quality printer. i. Laser printer uses ink technology.

4. Match the following:a. Scanner i. permanent storageb. Microphone ii. optical discc. Joystick iii. hard copy change into soft copyd. Digital camera iv. hardcopy outpute. Printer v. primary memoryf. CD vi. play gamesg. Hard disc vii. soundh. RAM viii. capture images

5. Fill in the blanks.a. CPU is also called…………..b. Light pen helps to directly select an ……………..c. ……………perform arithmetic and logic operations.d. The ………………. transports orders and synchronization signals

coming from the control unit and travelling to all other hardware components.

e. The…………………transports memory addresses which the processor wants to access in order to read or write data.

6. Label the figure.

Page 58: Green Computer

GREEN Computer Book-958

Types of Computer Software

5

IntroductionSoftware is a set of programs, which is designed to perform a well-defined function. A program is a sequence of instructions written to solve a particular problem. It is the soul of a computer. Computer cannot do anything without software. Software instructs the hardware parts to perform certain task. Basically, there are two types of software:• System Software• Application Software

Tailored Software

Packaged Software

System Development

Sotware

System Management

Sotware

Utility Software

Device Driver

Language Processor

Operating Software

Programming Language

Application Software

System Software

software

System SoftwareThe system software is collection of programs designed to operate, control, and extend the processing capabilities of the computer itself. System softwares are generally prepared by computer manufactures. These software products comprise of programs written in low-level languages which interact with the hardware at a very basic level. System software serves as the interface between hardware and the end users.

Page 59: Green Computer

Computer Book-9 59GREEN

Features of system software are as follows:• Close to system hardware component• Fast in speed• Difficult to design• Difficult to understand • Less interactive• Generally written in low-level language

Types of system software:

1. System Management Software: System management software is responsible for the management and

accurate functioning of the computer system. It includes resource management, memory management, file management, process management and control over the system performance. It also provides routine service functions to the other computer programs & computer users: E.g. Utilities, libraries, performance monitors & job accounting. System management software are:

a. Operating system softwareb. Device driverc. Utility software

a. Operating system:The software which controls and coordinates overall functions of computer is called operating system software. An operating system is a program that acts as an interface between the software and the computer hardware. It manages overall resources and operations of the computer. It helps to run application program. Some of the popular operating systems are: Windows 7, windows10, Unix, Linux, etc.

Functions of Operating System• Memory Management: keeps track of primary memory i.e. what part of it

is in use by whom, what part is not in use, etc. and allocates the memory when a process or program requests it.

• Processor Management: allocates the processor (CPU) to a process and de-allocates processor when it is no longer required.

Page 60: Green Computer

GREEN Computer Book-960

• Device Management: keeps track of all devices. This is also called I/O controller that decides which process gets the device, when, and for how long.

• File Management: allocates and de-allocates the resources and decides who gets the resources.

• Security: Prevents unauthorized access to programs and data by means of passwords.

• Control Over System Performance: records delays between request for a service and from the system.

• Helps to Run Application Program : It provides platform to run application programs.

b. Device DriverA device driver is a small piece of software that tells the operating system and other software how to communicate with a piece of hardware. Some of the device driver comes with an operating system. More commonly known as a driver, a device driver or hardware driver is a group of files that enable one or more hardware devices to communicate with the computer's operating system. Without drivers, the computer would not be able to send and receive data correctly to hardware devices, such as a printer.

c. Utility SoftwareUtility software is a part of system software that enhances the operations of computer or specific program. It manages memory, scans viruses, compress files, speeds up computer processing, etc.Utility software helps the user to control, manage, and maintain a computer's operating system, hardware and application software. These programs are designed to perform specific functions like finding files, backing up data, playing multimedia files, viewing images and so on. Unlike system software, utility software can be set up, controlled or initiated by the user. Many utility software programs are built into a computer's operating system.

2. System Development Software

a. Programming Language A programming language is a set of commands, instructions, and other

syntax used to create a software program. Languages that programers use

Page 61: Green Computer

Computer Book-9 61GREEN

to write code are called "high-level languages." This code can be compiled into a "low-level language," which is recognized directly by the computer hardware. Some of the examples of programming language are C, C++, Java, QBASIC, dBASE, etc.

b. Language Processor A language processor is a special type of a computer software that has the

capacity to translate the source code or program codes into machine codes. It is also called language translator. There are three types of language processors:

i. Interpreter: It translates program written in high level language into machine language. It translates the program code one after another. It takes less amount of time to analyze the source code but the overall execution time is slower. Programming language like Python, Ruby use interpreters.

Source code Interpreter Object code

ii. Compiler: It translates program written in high level language into machine language. It translates the whole program at once. It takes a large amount of time to analyze the source code but the overall execution time is comparatively faster. Programming language like C, C++ use compilers.

Source code Compiler Object code

iii. Assembler : It translates the program written in assembly language into machine language. An assembler is a type of computer program that interprets software programs written in assembly language into machine language, codes and instructions that can be executed by a computer. An assembler enables software and application developers to access, operate and manage a computer's hardware architecture and components. An assembler is sometimes referred to as the compiler of assembly language. It also provides the services of an interpreter.

Source code Assembler Object code

Page 62: Green Computer

GREEN Computer Book-962

Differences between Interpreter and CompilerInterpreter Compiler

1. It translate one line or single statement of a program of object code at a time

1. It translate the whol program into object code at a time.

2. Translating process is slower. 2. Translating process is faster.3. It does not save object code. 3. It saves the object code for future

reference.4. It traps error after translating a

line of program at a time.4. It traps athe error after compiling

the complete program.5. It requires less memory space. 5. It requires large memory space6. New programming language use

interpreter.6. New programming language

does not use compiler.7. It is easy to code and debug. 7. It is difficult to code and debug.8. Interpreter based programming

language are: VB, C#, PHP, etc.8. Compiler bus programming

language are C, C++, Javam COBOC, etc.

Application SoftwareApplication software are designed to satisfy a particular need of users. It is directly designed for the users. They can solve their problems. Examples of Application software are following: Payroll Software, Inventory Management Software, Microsoft Office , Microsoft Excel etc.

Features of application software are as follows:• Close to user• Easy to design• More interactive• Slow in operation• Generally written in high-level language• Easy to understand• Bigger in size and requires large storage space

Page 63: Green Computer

Computer Book-9 63GREEN

There are two types of application software:Customized or Tailored Software: It is the software designed to address the user's need. It is developed on the demand of users to perform the user specific task. It is very expensive. It is written in the high level language. Some of the examples of customized software are library management system, payroll system, etc.Packaged Software: It is user friendly software consisting of one or more programs created to perform a particular type of work. It is developed to fulfill the common requirement of users. Some examples are Microsoft PowerPoint, Microsoft Page Maker, Adobe Reader, etc.

Open Source SoftwareOpen source software (OSS) refers to the software that is developed, tested, or improved through public collaboration and distributed with the idea that they must be shared with others, ensuring an open future collaboration. The collaborative experience of many developers, especially those in the academic environment, is developing various versions of the UNIX operating system, Richard Stallman's idea of Free Software Foundation, and the desire of users to freely choose from among a number of products - all of these led to the Open Source movement and the approach to developing and distributing programs as open source software.

Quick Review

1. Computer software is a set of programs that instruct computer to perform a certain task.

2. A device driver is a small piece of software that tells the operating system and other software how to communicate with a piece of hardware.

3. A programming language is a set of commands, instructions, and other syntax used to create a software program.

4. System software is the collection of programs designed to operate, control and manage the actual operation of the computer equipment.

5. Operating system software allows the computer to manage resources and control the overall functions of a computer.

6. Application software are those software which are designed for specific function directly for the user.

7. There are two types of application softwares: Customized software and Packaged software.

8. Utility software is a part of system software that enhances the operations of computer or specific program.

Page 64: Green Computer

GREEN Computer Book-964

9. A language processor is a special type of a computer software that has the capacity to translate the source codes or program codes into machine codes.

10. Open source software (OSS) refers to software that is developed, tested, or improved through public collaboration and distributed with the idea that they must be shared with others, ensuring an open future collaboration.

Exercise1. Answer the following questions:

a. Define software. Write its types.b. Introduce the system software. List out the features of system

software.c. Define O/S. List out the system management software.d. Write the functions of operating software.e. What is application software? What are the features of computer?f. Why is customized software developed?g. Write a difference between packaged software and tailored software.h. What is language processor? Name different types of language

processors.i. What is open source software?j. Write any five differences between Interpreter and Compiler.

2. Fill in the blanks:

a. ............................ software is very close to the system.b. ............................ software organizes and manages memory.c. ............................ software is close to the user.d. Unix is an example of ............................ e. ............................ is written in high level language.f. ............................ translates high level language into machine language

one after another.g. ............................ software is designed to address the user's need.

Page 65: Green Computer

Computer Book-9 65GREEN

3. State whether these statements are 'True' or 'False':a. Packaged software manages files and folders. b. Linux is the application software.c. Computer is a dead machine without software.d. Unix is an example of open source software.e. Packaged software is used to coordinate the hardware of the computer.f. Source code is written in low level language.

4. Match the following: a. Tailored software i. Set of programsb. Utility software ii. Library management systemc. Operating system iii. Scan virusesd. Software iv. Microsoft Officee. Packaged software v. Used to coordinate the hardware of the computer

5. Write short notes on the following:i. Device driver ii. Utility software iii. Compiler iv. Interpreter v. Assembler

6. Classification of software.software

Page 66: Green Computer

GREEN Computer Book-966

IntroductionThe software which controls and coordinates overall functions of a computer is called operating system software. An operating system is a program that acts as an interface between the software and the computer hardware. An operating system is a software which performs all the basic tasks like file management, memory management, process management, handling input and output, and controlling peripheral devices such as disc drives and printers. It helps to run application program. Some of the popular operating systems are: Windows7, Windows 8, windows10, Unix, Linux, VMS, OS/400, AIX, z/OS, etc.

Following are some of the important functions of an operating system:

1. Memory Management: • Keeps tracks of primary memory, i.e., what parts of it are in use by whom,

what parts are not in use.• In multiprogramming, the OS decides which process will get memory

when and how much.• Allocates the memory when a process requests it to do so.• De-allocates the memory when a process no longer needs it or has been

terminated.

Operating System6

User

Hardware

Internal and external physical parts of a

computer

Provides platform to install and run various application program

User solve their problems using application software

Computer user

Application Software

Operating System

Page 67: Green Computer

Computer Book-9 67GREEN

2. Processor Management• Keeps track of processor and status of process. The program responsible

for this task is known as traffic controller.• Allocates the processor (CPU) to a process.• De-allocates processor when a process is no longer required.

3. Device Management• Keeps track of all devices. Program responsible for this task is known as

the I/O controller.• Decides which process gets the device when and for how much time.• Allocates and de-allocates the device in an efficient way.

4. File Management• Keeps track of information, location, uses, status etc. The collective facilities

are often known as file system.• Decides who gets the resources.• Allocates and de-allocates the resources.5. Security: By means of password and similar other techniques, it prevents

unauthorized access to programs and data.6. Control over system performance: Recording delays between request for

a service and response from the system.7. Job accounting: Keeping track of time and resources used by various jobs

and users.8. Error detecting aids: Production of dumps, traces, error messages, and

other debugging and error detecting aids.9. Coordination between other software: Coordination and assignment of

compilers, interpreters, assemblers and other software to the various users of the computer systems.

10. Install and run application program: Operating system provides platform to install and run the various application programs.

Mainly there are two types of operating system:1. On the basis of Mode of User2. On the basis of Interface

Page 68: Green Computer

GREEN Computer Book-968

1. On the basis of Mode of User

Following operating systems are categorized on the basis of mode of user.

Batch Operating System The users of a batch operating system do not interact with the computer directly. Each user prepares his job on an off-line device like punch cards and submits it to the computer operator. To speed up processing, jobs with similar needs are batched together and run as a group. The programers leave their programs with the operator and the operator then sorts the programs with similar requirements into batches.

The problems with Batch Systems are as follows:• Lack of interaction between the user and the job. • CPU is often idle, because the speed of the mechanical I/O devices is slower

than the CPU.• Difficult to provide the desired priority.

Time-sharing Operating Systems Time-sharing is a technique which enables many people, located at various terminals, to use a particular computer system at the same time. Time-sharing or multitasking is a logical extension of multiprogramming. Processor's time which is shared among multiple users simultaneously is termed as time-sharing.The main difference between Multi-programd Batch Systems and Time-Sharing Systems is that Multi-programd batch systems, maximize processor use but Time-Sharing Systems minimize response time.

Advantages of Time sharing operating systems are as follows:• Provides the advantage of quick response • Avoids duplication of software• Reduces CPU idle time

Disadvantages of Time-sharing operating systems are as follows: • Problem of reliability• Question of security and integrity of user programs and data• Problem of data communication

Page 69: Green Computer

Computer Book-9 69GREEN

Distributed Operating System Distributed systems use multiple central processors to serve multiple real-time applications and multiple users. Data processing jobs are distributed among the processors accordingly. The processors communicate with one another through various communication lines (such as high-speed buses or telephone lines). These are referred as loosely coupled systems or distributed systems. Processors in a distributed system may vary in size and function.These processors are referred as sites, nodes, computers, and so on.

The advantages of distributed systems are as follows:• With resource sharing facility, a user at one site may be able to use the

resources available at another.• Speedup the exchange of data with one another via electronic mail.• If one site fails in a distributed system, the remaining sites can potentially

continue operating.• Better service to the customers.• Reduction of the load on the host computer.• Reduction of delays in data processing.

Network Operating System A Network Operating System runs on a server and provides the server the capability to manage data, users, groups, security, applications, and other networking functions. The primary purpose of the network operating system is to allow shared file and printer access among multiple computers in a network, typically a local area network (LAN), a private network or to other networks. Examples of network operating systems include Microsoft Windows Server 2003, Microsoft Windows Server 2008, UNIX, Linux, Mac OS X, Novell NetWare, and BSD.

The advantages of network operating systems are as follows:• Centralized servers are highly stable. • Security is server managed.

Page 70: Green Computer

GREEN Computer Book-970

• Upgrades to new technologies and hardware can be easily integrated into the system.

• Remote access to servers is possible from different locations and types of systems.

The disadvantages of network operating systems are as follows: • High cost of buying and running a server.• Dependency on a central location for most operations.• Regular maintenance and updates are required.

Real-Time Operating System A real-time system is defined as a data processing system in which the time interval required to process and respond to inputs is so small that it controls the environment. The time taken by the system to respond to an input and display of required updated information is termed as the response time. So in this method, the response time is very less as compared to online processing. Real-time systems are used when there are rigid time requirements on the operation of a processor or the flow of data and real-time systems can be used as a control device in a dedicated application. A real-time operating system must have well-defined, fixed time constraints, otherwise the system will fail. For example, scientific experiments, medical imaging systems, industrial control systems, weapon systems, robots, air traffic control systems, etc. There are two types of real-time operating systems. Hard real-time systems: Hard real-time systems guarantee that critical tasks complete on time. In hard real-time systems, secondary storage is limited or missing and the data is stored in ROM. In these systems, virtual memory is almost never found. Soft real-time systems: Soft real-time systems are less restrictive. A critical real-time task gets priority over other tasks and retains the priority until it completes. Soft real-time systems have more limited utility than hard real-time systems. For example, multimedia, virtual reality, Advanced scientific projects like undersea exploration and planetary rovers, etc.

Page 71: Green Computer

Computer Book-9 71GREEN

2. On the basis of InterfaceThere are two types of operating systems on the basis of interface

a. Character User Interface A Character User Interface (CUI) is a text based interface where instructions

are given to the computer by typing commands. In CUI, a user interacts with application software through the commands. It is also known as Command Line Interface (CLI). Novell Netware Server, MS-DOS, etc. are the CLI operating systems.

b. Graphical User Interface A Graphical User Interface (GUI) based operating system allows a user

to interact with the computer system by pointing and selecting graphical symbols. Some of the GUI operating systems are: Windows 2007, Windows 2008, Vista, Windows XP, etc.

Microsoft Disc Operating System (MS-DOS)MS-DOS is a Disc Operating System developed by Microsoft Corporation. It is a Command Line Interface operating system. In MS-DOS, instructions are given to the computer by typing commands so it is also called Character Line Operating System. It enables the user to organize data files, load and execute (run) program files, and controls the input and output devices attached to the computer. MS-DOS is a single user, single tasking operating system. Single user means only one person can use the system at a time. Single tasking means it is capable of doing only one action at a time, and is not supported for doing more than one work at the same time.The main system part of MS-DOS consists of three files without which you won’t be able to run MS-DOS.

1. IO.SYS This is a hidden file that handles input/output operations of your devices

like monitor, keyboard, printer, etc.

2. MSDOS.SYS This is also a hidden file that is used by application programs for different

purposes like file management, memory management, execution of other programs and access to a real-time clock.

Page 72: Green Computer

GREEN Computer Book-972

3. COMMAND.COM This is the file which interprets user’s commands.

BootingTo make your computer work, there must be an operating system which is mostly large. Computer can load a large operating system into its memory by first loading small programs then pulling the entire operating system.The process of loading small programs by which your computer becomes operational is called booting. The most important small programs are IO.SYS and MSDOS.SYS which are called system files and COMMAND.COM which is a command interpreter. You can boot the computer in two ways.1. Cold Boot 2. Warm Boot

1. Cold Boot When you switch on the computer from its off state then computer performs

different self tests like it checks the display, hardware and then checks for the free space in the memory (RAM). As soon as it reads the free space it starts searching for the system files in different locations like your floppy disc or hard disk or CD-ROM. When it finds the system files from any of the location mentioned above, it loads all the system files into the computer memory. Once the system files are loaded, you can use your operating system. If the computer couldn’t find the system files then the operating system won't be loaded in your computer. This process of transferring system files into the working memory of computer and making it ready to work is known as Cold Boot.

2. Warm Boot When you are working with your computer and suddenly you had to

restart it for some reason, then you can do it by pressing CTRL+ALT+DEL together at the same time. When you press them together then the contents in the memory (RAM) will be cleared and the system files will be again searched and loaded into the memory. This way of booting the computer is called warm booting.

Terms Used in MS-DOS

1. File A file is a collection of related information. There may be thousands of

files in a computer hence to identify and differentiate each file, a name is

Page 73: Green Computer

Computer Book-9 73GREEN

given to each, called filename. A filename contains two parts which are separated by a period (.).

The part before period is called filename or primary filename and the part after the period is called extension or secondary filename. The extension helps to identify the type of the file. In other words, we can say primary filename helps us to identify the file whereas secondary filename helps computer to identify the type of files. Rules For Naming a File:• Generally, a filename should start with an alphabet.• While giving a filename, it should reflect some information about its

contents.• The primary name can take a maximum of 8 characters.• The secondary name can take a maximum of 3 characters.• The primary name and secondary names are separated by a period (.).• There should not be any space in the filename.

Some of the common extensions used by MS-DOS are listed below:a. EXE or COM: The file names ending with either COM or EXE are called

executable files. These are program files.b. SYS: The files that end with .SYS are called system files. These files generally

contain information on different hardware. For example: IO.SYS, MSDOS.SYS etc.

c. BAT: The files that end with .BAT are called batch files. A batch file is a text file that contains a list of instructions that the computer should carry out. Batch file allows you to assign repetitive tasks to a small file which once created can be run whenever you wish. For example autoexec.bat.

2. Directory It is the area in the computer's memory (secondary) to store a particular

class of files as well as directory. It is very helpful to have directories for file management which allows the user to find the files easily. In the same way in the library the racks are made for an easy access to books.

Root Directory: In DOS file hierarchical system, the first level of directory (top most directory) is called root directory. It is the main directory that is defined by the FORMAT command when we format a disc. e.g. A:\, C:\ etc.

Page 74: Green Computer

GREEN Computer Book-974

Current Directory: The directory in which the user is currently working or issuing the commands is called current directory.Sub Directory: The directory under another directory is called a sub-directory.

file 2. txt file 3. txtSub

directoryfile 1. txtSub directory

Directory 2 Directory 3Directory 1

RootDirectory

Role of CONFIG.SYS AND AUTOEXEC.BAT

AUTOEXEC.BATAUTOEXEC.BAT is the file found on the MS-DOS operating system. It is a plain-text batch file that is located in the root directory of the boot device.

UsageAUTOEXEC.BAT is only used on MS-DOS or Microsoft Windows versions based on MSDOS, such as Windows 3.x, Windows 95 and Windows 98. The file is executed once the operating system has booted and after the CONFIG.SYS file has been processed. On Windows, this occurs before the graphical environment has been started. AUTOEXEC.BAT is most often used to set environment variables and run virus scanners, system enhancements, utilities, and driver handlers that must operate at the lowest level possible. Applications that run within the Windows environment upon its loading are listed in the Windows registry.

CONFIG.SYSCONFIG.SYS is the primary configuration file for the MS-DOS and OS/2 operating systems.It is a special file that contains set up or configuration instructions for the computer system.The commands in this file configure DOS for use with devices and applications in the system. The commands also set up the memory managers in the system. After processing the CONFIG.SYS file, DOS proceeds to load and execute the command shell specified in the shell= line of CONFIG.SYS, or COMMAND.COM if there is no such line. The command shell in turn is responsible for

Page 75: Green Computer

Computer Book-9 75GREEN

processing the AUTOEXEC.BAT file. The system can still boot if these files are missing or corrupted.In DOS, CONFIG.SYS is located in the root directory of the drive from which DOS was booted. In some versions of DOS it may have an alternate filename, e.g. FDCONFIG.SYS in Free DOS, or DCONFIG.SYS in some versions of DR-DOS. Both CONFIG.SYS and AUTOEXEC.BAT can still be found included in the system files of the later Microsoft Windows operating systems. Usually, these are empty files, with no content. OS/2 did not use the autoexec.bat file, instead it used startup.cmd. In the OS/2 subsystem of Windows NT, what appeared as CONFIG.SYS to OS/2 programs was actually stored in the registry.Example: CONFIG.SYS file for DOSdevice = c:\dos\himem.sysdevice = c:\dos\emm386.exe umbdos = high, umb

3. Command Prompt Command prompt is an environment in MS-DOS which states that the

computer is ready to accept any valid commands. You can type different commands to perform specific task from here. E.g.: D:\Class9\>

Wild CardsThe symbols such as Asterisk “*” and question mark “?” that represent one or more characters are called wild cards. They help us to indicate a particular category of files. * representing any name and? Represent any one character.E.g. *.* represents all files (no condition at all)R*.* represents all files whose primary name starts with R with any extension (one condition)RI*.DOC represents all files whose primary name starts with RI and having extension as DOC (two conditions)B?????.HTM represents all files whose primary name starts with B and having a maximum of 6 characters in primary name (may be less than 6 as well) and having extension as HTM.

Page 76: Green Computer

GREEN Computer Book-976

MS-DOS CommandsCommands are the set of instructions given to computer to perform certain tasks. The valid instructions input by the users are understood and operations are carried out accordingly. Finally, we get the desired output from the commands.

The DOS commands are categorized as below:a. Internal Commands b. External Commandsa. Internal Commands The commands that reside in the memory of the computer after the DOS

is loaded completely are known as Internal DOS Commands. In other words, Internal Commands are those which are recognized by the DOS interpreter file COMMAND.COM. Some DOS Internal Commands are:

DATE TIME DIR CLS DEL ERASE COPY CON VOL COPY REN MD CD RD TYPE VERb. External Commands External Commands are those which are stored in a separate disc as program

files. They must be copied to the hard disc before they are executed. Some of the DOS External Commands are:

Starting DOS from WindowsEarlier, Windows Operating System used to run on top of DOS but these days DOS runs on top of Windows.1. Click on Start button2. Go to Run3. Type cmd or command.comYou will get a DOS environment with DOS prompt on your screen as below:

Now, let's work with some DOS Internal Commands.

Page 77: Green Computer

Computer Book-9 77GREEN

DATEThis command displays the current system date and lets the user change as per the necessity.Syntax: DATEEx: C:\> DATE The current date is: Fri 8/25/2016Enter the new date: <mm/dd/yy> Change the date as per the given format if necessary. Otherwise, press Enter key for no change.

TIMEThis command displays the system time and lets user modify it. Syntax: TIMEEx: C:\>TIME The current time is: 7:21 p (evening)Enter the new time: Change the time as per the given format if required. Otherwise, press Enter key for no change.

CLSThis command clears the screen if there is any information displayed previously.Syntax: CLS Ex: C:\> CLS This command displays the list of files and directories present in the drive.Syntax: DIR (options)C:\> DIR It displays all files and directories present in C: drive at a

time.C:\> DIR/p It displays all files and directories present in C: drive page

wise and allows you to continue displaying by pressing any key.

C:\> DIR/w It displays all files and directories of C: drive widthwise in five columns and lets the user continue displaying by pressing any key.

C:\> DIR/AD It displays list of directories only.C:\> DIR/A-D It displays the list of files only.

Page 78: Green Computer

GREEN Computer Book-978

TYPEThis command displays the contents of the given text file. Syntax: TYPE <filename>Ex: C:\>TYPE ram This will display the information written inside the file "ram".

RENThis command allows you to rename the existing file with a new name supplied. The contents in the new file name remain the same.Syntax: REN <old filename> <new filename> Ex: C:\> REN ram hari This will rename the file "ram" with new file name i.e. "hari".

DEL or ERASEThis command allows user to delete or erase the existing files. Syntax: DEL or ERASE <filename>Ex: C:\> DEL or ERASE ram This will delete the file "ram" from the disc.

COPYThis command allows user to copy one or more files from one location to another or at the same location using a different name.Syntax: COPY <old filename> <new filename>COPY <old filename with location> <new filename with location> Ex: C:\> COPY ram school

COPY CONThis command lets you create a new text file. Syntax: COPY CON <filename>Ex: C:\>COPY CON raman Type the required information inside the file. (Ex: My country, My pride)Press CTRL + Z or F6 key to save the file. Finally, press Enter key to get the prompt.

Page 79: Green Computer

Computer Book-9 79GREEN

You can check whether the file is created or not by using DIR command

MD (Make Directory)This command is used to create a directory. Syntax: MD <directory name>Ex: C:\> MD Class9 This will create a directory named "Class9".

CD (Change Directory)This command is used to change the directory to another existing directory. Syntax: CD <directory name> Ex: C:\> CD Class9 The result after the execution of this command will be C:\Class9\> CD.. or CD\CD.. command helps to change the directory, back one step to the previous directory.CD\ command changes the directory directly to the root directory as C:\>, D:\>, E:\> etc.

RD (Remove Directory)This command is used to delete or remove directory which is empty. Syntax: RD <directory name>Ex: C:\> RD Class9 This command will remove the directory "Class9".

VERThis command is used to display the current version of MS-DOS. Syntax: VEREx: C:\>VER

EXITThis command is used to exit from DOS environment to Windows mode. It works only if DOS is loaded from Windows mode.Syntax: EXITEx: C:\>EXIT

Page 80: Green Computer

GREEN Computer Book-980

PROMPTIt allows to change the command prompt.Syntax: PROMPT [text]Text specifies a new command prompt.Prompt can be made up of normal characters and the following special codes:$A & (Ampersand)$B | (Pipe)$C (Left parenthesis)$D Date$F ) (Right parenthesis)$G > (Greater-than sign)$L < (Less-than sign)$N c:\> Current drive$P Current drive and path$Q = (Equal sign)$T Time$V Operating system version number

EXTERNAL COMMANDSExternal commands are the commands which do not get executed with the help of COMMAND.COM. They need separate files for individual commands. E.g. FORMAT command needs FORMAT.COM file for execution.(UNDELETE, DELTREE, XCOPY, DiscCOPY, DiscCOMP, SCANDisc, CHKDSK, EDIT, ATTRIB, BACKUP/RESTORE OR MSBACKUP, FORMAT, (/S, /V), MOVE)

ATTRIBIt allows us to give or remove an attribute form file or files as well as to see the attribute of a file or files.ATTRIB [+R | -R] [+A | -A ] [+S | -S] [+H | -H] [drive:][path][filename][/S [/D]]

Page 81: Green Computer

Computer Book-9 81GREEN

+ Sets an attribute.- Clears an attribute.R Read-only file attribute.A Archive file attribute.S System file attribute.H Hidden file attribute.[drive:][path][filename] Specifies a file or files for attrib to process./S Processes matching files in the current folder and all subfolders./D Processes folders as well.

CHKDSKThis command checks the disc drive including directories, sub-directories and files for errors, and provides a disc and memory status report.Syntax: CHKDSK <drive name> Ex: C:\>CHKDSK C: /F/V /F: checks and fixes errors on the disc./V: provides report.

LABELThis command displays and allows changing the volume label of the disc drive.Syntax: LABEL <drive name> LABEL <label name> <drive name>Ex: XCOPY C:\Class9 D: This will copy all files and subdirectories of directory "Class9" of C: drive to D: drive.

EDITThis command allows you to modify the contents of an existing text file. You can also create a new text file using this command.Syntax: EDIT <file name>Ex:C:\> EDIT Raju This will open an edit window for the text file "Raju". Make changes and save the contents in the same file.C:\>EDIT

Page 82: Green Computer

GREEN Computer Book-982

This will open an edit window and let you type the information and save file with a new filename.

SCANDiscThis command is used to check and repair a disc. Syntax: SCANDisc <drive name> Ex: C:\>SCANDisc D: This will scan the disc drive D:, fix errors if any and display a status report.

FORMATThis command deletes all files and directories from the disc and makes the disc clean.Syntax: FORMAT <drive name/options>Ex: C:\> FORMAT/Q/S F: Suppose, F: drive is removable disc i.e. pen drive./Q - Performs a quick format./S - Copies System files into the formatted disc.

MOVEMoves files and renames files and directories.To move one or more files or to rename a directory:MOVE [/Y | /-Y] [drive:][path]filename1[,...] destination[drive:][path]filename1 Specifies the location and name of the file or files you want to move.Destination specifies the new location of the file. Destination can consist of a drive letter and colon, a directory name, or a combination. If you are moving only one file, you can also include a filename if you want to rename the file when you move it.[drive:][path]dirname1 Specifies the directory you want to rename. dirname2 Specifies the new name of the directory./Y Suppresses prompting to confirm you want to overwrite an existing destination file./-Y Causes prompting to confirm you want to overwrite an existing destination file.

Page 83: Green Computer

Computer Book-9 83GREEN

The switch /Y may be present in the COPYCMD environment variable. This may be overridden with /-Y on the command line. Default is to prompt on overwrites unless MOVE command is being executed from within a batch script.

XCOPYCopies files and directory trees but it won't copy hidden and system files.Syntax: XCOPY source [destination] [/S] [/V].Source Specifies the file(s) to copy.Destination Specifies the location and/or name of new files./S Copies directories and subdirectories except empty ones./V Verifies each new file.A:\>XCOPY C:\*.* /S It copies all the files as well as subdirectories which are under the root directory of drive.C under the root directory of drive A, excluding the empty directories.C:\> FORMAT A: /S /V:Rohan It formats the disc in drive A and transfers the system files on it and gives a volume name as Rohan.DELTREE A:\DOS\NEW\*.* It deletes all the files and subdirectories which are under subdirectory NEW; it prompts the user for confirmation before deletion.ATTRIB +H +R C:\DOS\*.BAS /SIt gives hidden attribute (+H) as well as read only (+R) attribute to all the files whose extension name is BAS and they are under the sub directory DOS as well as all the sub directories under sub directory DOS.C:\> BACKUP C:\QBASIC\PROGRAM\*.BAS A:\ /S It makes a backup copy of all the files having BAS as their extension which are under the sub directory PROGRAM which is under the sub directory QBASIC under the root directory of drive C including all the sub directories of PROGRAM to the root directory of drive A.

BACKUPIt is used to create a backup copy of files from one location to another location.

Page 84: Green Computer

GREEN Computer Book-984

Syntax: BACKUP source destination-drive:[/S][/M][/A][/F[:size]][/D:date][T:time] [/L:[drive:][path] logfile]]source: Specifies the file(s), drive or directory to back up.destination-drive: Specifies the drive to save backup copies./S Backs up contents of subdirectories as well./M Backs up only files that have changed since the last

backup./A Adds backup files to an existing backup disc./F:[size] Specifies the size of the disc to be formatted if an unformatted disc is used for backup copy./D:date Backs up only files changed on or after the specified

date./T Backs up only files changed at or after the specified

time./l[Drive:][path][logfile] Creates a log file and stores the information about

the files which are being backed up.

RESTOREIt restores the backup files with BACKUP command.Syntax: RESTORE <drive1:> <drive2:> [path][filename][/S][/P]/S Restores all sub directories./P Prompts for permission to restore files having read only attribute.

Quick Review

1. An operating system manages environment for running programs, handling errors, controlling devices, configuring the computer system, and managing the resources of a computer.

2. MS-DOS is a command line Disk Operating System developed by Microsoft Corporation.

3. Time-sharing is a technique which enables many people, located at various terminals, to use a particular computer system at the same time.

Page 85: Green Computer

Computer Book-9 85GREEN

4. Single tasking means the system runs only one application program at a time, and is not supported for running more than one application program at the same time.

5. MS-DOS is a single tasking operating system whereas Windows is a multitasking operating system.

6. The process of loading small programs by which your computer becomes operational is called booting.

7. The most important small programs are IO.SYS and MSDOS.SYS which are called system files and COMMAND.COM which is a command interpreter.

8. CONFIG.SYS is the primary configuration file for the MS-DOS and OS/2 operating systems.

9. The process of transferring system files into the working memory of computer and making the computer work from its off state is known as Cold Boot.

10. External commands are the commands which do not get executed with the help of COMMAND.COM.

11. Filename is a name given to a file for its easy identification. Filename consists of two parts: Filename or primary filename and Extension.

12. Part of filename before a period (.) sign is primary filename which can be up to 8 characters long and part of filename after the period (.) sign is Extension which should not exceed 3 characters.

13. Commands are a set of instructions given to computer to perform a certain task.

14. External commands are those which are stored in a separate disc as program files.

15. The commands that reside in the memory of the computer after the DOS is loaded completely are known as Internal DOS commands.

Exercise1. State whether the following statements are TRUE or FALSE:

a. Operating system makes the computer workable.b. MS-DOS is an operating system developed by Microsoft Corporation. c. Internal commands are stored separately on a disc.

Page 86: Green Computer

GREEN Computer Book-986

d. The process of loading system files by switching on the computer is known as warm booting.

e. External commands are the commands which do not get executed with the help of COMMAND.COM.

f. Directories and sub-directories can be stored in a file.g. XCOPY copies files and directory trees which copy hidden and

system files.

2. Choose the correct option:

a. Which of the following is single tasking operating system? i. MS-Word ii. MS-Windows iii. MS-DOS iv. Noneb. Internal Commands are the parts of DOS interpreter file called i. IO.SYS ii. MSDOS.SYS iii. COMMAND.COM iv. All of abovec. Which of the following is called the working memory of computer? i. RAM ii. ROM iii. CD-ROM iv. Hard discd. Which of the following Internal Commands displays list of files and folders? i. COPY ii. DIR iii. DATE iv. TIMEe. Which of the following External Commands checks disc for errors? i. FORMAT ii. LABEL iii. CHKDSK iv. SCANDisc

3. Fill in the blanks:

a. Microsoft DOS is ................... operating system.b. DATE command displays current system date in ................... format. c. The part of filename after a period (.) is known as ....................d. COPY is an ................... DOS command.e. DIR/P displays list of files and folders ...................

Page 87: Green Computer

Computer Book-9 87GREEN

4. Write down the function of the following DOS commands:

a. CD b. MD c. COPY CONd. VER e. EXIT f. DIRg. LABEL h. SCANDisc i. DELj. FORMAT

5. Perform the following actions in MS-DOS:

a. Create a directory named "NARAYANI" in D: drive.b. Type the drive letter ending with colon to change the drive. Ex: C:\My Documents and Settings\Desktop\>D:c. Create a sub directory named "RAUTAHAT" in the folder "GAUR". d. Now, create a text file of your own name and type some information

in it and save the file.e. Rename the created file of your name with the name of your best

friend.f. Create another file "Jhapa" and type some information in it and save.g. Now, exit the DOS environment and check the work by opening D: drive from My Computer

6. Answer the following questions:

a. What is an operating system?b. What do you mean by single user operating system?c. What is single tasking?d. What are the essential DOS system files?e. What is booting? State its types.f. Differentiate between a file and a directory. g. Define Internal and External Commands.h. List out the wild card characters and write their functions.i. Describe the function of AUTOEXEC.BAT and CONFIG.SYS.j. What is real time operating system? Mention its types.

Page 88: Green Computer

GREEN Computer Book-988

Windows Environment7

Windows 10Windows 10 is the most recent version of the Microsoft Windows operating system. There have been many different versions of Windows over the years, including Windows 8 (released in 2012), Windows 7 (2009), Windows Vista (2006), and Windows XP (2001). While older versions of Windows mainly ran on desktop and laptop computers, Windows 10 is also designed to run equally well on tablets.

DesktopThe desktop is the screen that displays once you have turned on the computer and responded to prompts for your user name and password. This is your workspace. It is where you manage tasks on the computer. Your software opens on the desktop. You can manipulate your files and folders on the desktop.

Task barIt provides you with access to the software applications, enables you to move between the applications, and gives you access to system resources. It is a horizontal bar that appears at the bottom of the screen.

start button taskbar clock

quick launch icons quick launch icons

WindowA window is a separate viewing area on a computer display screen in a system that allows multiple viewing areas as part of a graphical user interface ( GUI ). It is a space on the desktop representing a program, system resource, or data.

Page 89: Green Computer

Computer Book-9 89GREEN

Multiple windows can be open at one time, working independently as well as together. There are two types of window:a. Application window: Application window displays the executable

windows program in GUI (Graphical User Interface) platform. These types of windows can be resized and moved within the desktop. MS Excel, MS Word, etc. are the application window.

b. Document window: A document window which comes inside an application window is called document window. It is created by the application window or application program. Such type of window can be moved just within an application window.

IconsThey are small pictures that represent programs, files, folders, or other things on the desktop. Objects with the same characteristics, like file folders, have the same icon.

Tab Menu Tab menus are often present in dialogue boxes. They are menus that represent many different “pages” of information. To access each “page,” click on the tab at the top of the dialogue box.

Dialogue BoxWhen you ask the computer to do certain commands, such as to save your work, the computer will need more information from you, and this will appear in a dialogue box. These boxes contain options and commands for the computer to execute.

Features of Windows10

Start menuWhereas Windows 8 uses the Start screen to launch applications, Windows 10 has reintroduced a more traditional Start menu. It’s also been expanded to make it easier to find important apps.

Page 90: Green Computer

GREEN Computer Book-990

Microsoft EdgeThis new browser is designed to give Windows users a better experience on the Web. It’s faster, more secure, and includes a lot of new features. Microsoft Edge is meant to replace Internet Explorer as your default web browser.

CortanaSimilar to Siri and Google Now, you can talk to this virtual assistant with your computer’s microphone. Cortana can answer questions like What’s the weather like today?, perform simple tasks like remind you to take out the trash, and much more.

Multiple desktops and Task viewInstead of keeping everything open on the same desktop, you can move some of your windows to a virtual desktop to get them out of the way. And the new Task view feature makes it easy to manage all of your open windows.

Page 91: Green Computer

Computer Book-9 91GREEN

Action CenterThe new Action Center is pretty different from previous versions of Windows. For example, it’s been expanded to let you access frequently used settings, such as Wi-Fi connectivity and tablet mode. It’s also where you’ll see important notifications, so if your computer receives an update you’ll get a notification about it here.

Tablet modeUnlike Windows 8, Windows 10 makes a clear distinction between desktops and tablets. If you’re using a keyboard and mouse with Windows 10, you’ll be in desktop mode by default. If your computer also has a touchscreen, you can go into tablet mode at any time. Tablet users can also switch back to desktop mode if they prefer.

Main Icons of Windows 10 Desktop

This PCWindows 10 has just replaced My computer and rename it as This Pc, this is the place where all the main and essential content is saved as windows itself is saved in This Pc distribution. Here you can access all your saved content and add up new content according to your space.

Page 92: Green Computer

GREEN Computer Book-992

Recycle BinThe Recycle Bin, that wastebasket icon in the upper-left corner of your Windows 10 desktop, works much like a real recycle bin. Shown here, it lets you retrieve the discarded desktop files you thought you’d never need.

DocumentWe have seen people asking about this “My Documents” folder. I remember when using Windows XP and Windows 7, this used to be the folder where we kept all our documents. The other side of the question could be that you are looking where you saved your documents in Windows 10. In this post meant for beginners, we will answer the questions Where are “My Documents” in Windows 10 from both points.

Adding new icons on desktopYour desktop icons may be hidden. To view them, right-click the desktop, select View, and then select Show desktop icons. To add icons to your desktop such as This PC, Recycle Bin and more:1. Select the Start button, and then select Settings > Personalization > Themes.2. Under Themes >

Related Settings, select Desktop icon settings.

3. Choose the icons you would like to have on your desktop, then select Apply and OK

4. Note: If you are in tablet mode, you may not be able to see your desktop icons properly. You can find the program by searching for the program name in File Explorer. To turn off tablet mode, select action center on the taskbar (next to date and time), and then select Tablet mode to turn it on or off.

Page 93: Green Computer

Computer Book-9 93GREEN

Or,1. Right click (or tap and

hold) on Desktop and choose Personalize.

2. Select Themes from the left sidebar.

3. Click/tap Desktop icon settings.

4. Check the system icons which you want on your desktop and uncheck the ones not needed. To add This PC, check Computer.

5. Click OK.

Windows keyboard shortcutClose CTRL+WCopy CTRL+CCut CTRL+XDelete DELExit ESCFind CTRL+F3Help F1Minimize Window Windows Key*+MMove to Recycling CTRL+DELNew Folder/Document CTRL+NOpen CTRL+OOpen Start Menu Windows Key*Paste CTRL+VPage Up/Down Page Up/Down KeysPrint CTRL+PPrint Screen ALT+Print Screen KeyQuit ALT+F4Reboot/Restart CTRL+ALT+DELSave CTRL+SSelect All CTRL+AUndo CTRL+Z

Page 94: Green Computer

GREEN Computer Book-994

Quick Review

1. An operating system controls and coordinates overall functions of computer system.

2. Search box is below the left pane, which enables you to type keywords to complete searches for files or folders on your computer.

3. A window is a space on the desktop representing a program, system resource, or data.

4. Maximize function allows you to concentrate on one application by making its window cover the entire screen.

5. Tab menus are often present in dialogue boxes. 6. The Start menu, accessed with a click on the Start button, lists the

programs, folders and utility applications that are available on your computer.

7. With an operating system you see and interact with a set of items on the screen.

8. Icons are small pictures that represent programs, files, folders, or other things.

9. Application window displays the executable windows program in GUI (Graphical User Interface) platform.

10. A document window that comes inside an application window is called document window.

Exercise1. Answer the following questions.

a. What are the main features of windows 10.b. Write the steps for adding new icons on desktop in widows 10.c. What is icon? Write any two icons of desktop.d. What is recycle bin?

2. Write technical terms for the following:a. It is a storage are used to store deleted file.b. A small picture that represent, program, files, folders other thing on

the desktop.c. The bar which display the name o/s/ document or program at top of

the screen.d. A window which comes inside an application window.

Page 95: Green Computer

Computer Book-9 95GREEN

Computer Graphics8

The term Graphics is derived from the greek word “graphikos“ which means belonging to drawing”. In general, the term graphic refers to a design or visual image displayed on a variety of surfaces, including canvas, paper, a wall, a sign, or a computer monitor. They are created for the purposes of entertainment, branding, or providing information.Computer graphics is an art of drawing pictures, lines, charts, etc using computers with the help of programming. Computer graphics (CG) is any image media, usually movies and pictures that are created through the use of hardware and software. It concerns with the pictorial synthesis of real or imaginary objects from their computer-based models. It is made up of number of pixels. Pixel is the smallest graphical picture or unit represented on the computer screen. In 1960, William Fetter of Boeing coins the term “computer graphics” for his human factors cockpit drawings.

Computer Graphics can be broadly divided into two types:

Non-interactive Computer Graphics:In non interactive computer graphics also known as passive computer graphics, the observer has no control over the image. Familiar examples of this type of computer graphics include the titles shown on TV and other forms of computer art.

Page 96: Green Computer

GREEN Computer Book-996

Interactive Computer Graphics:Interactive Computer Graphics involves a two way communication between computer and user. Here the observer is given some control over the image by providing him with an input device for example the video game controller of the ping pong game.

Applications of Computer GraphicsComputer graphics deals with creation, manipulation and storage of different type of images and objects. Some of the applications of computer graphics are:

Computer ArtWe can create fine and commercial art which include animation packages, paint packages. Cartoon drawing, paintings, logo design can also be done using computer graphics.

Computer Aided DrawingDesigning of buildings, automobile, aircraft is done with the help of computer aided drawing.

Presentation GraphicsFor the preparation of reports or summarising the financial, statistical, mathematical, scientific, economic data for research reports, managerial reports, moreover creation of bar graphs, pie charts, time chart, can be done using the tools present in computer graphics.

EntertainmentComputer graphics can be used in the movie industry and game industry. It is used for creating motion pictures, music video, television shows, cartoon animation films. In the game industry where focus and interactivity are the key players, computer graphics helps in providing such features in the efficient way.

EducationComputer generated models are extremely useful for teaching huge number of concepts and fundamentals in an easy to understand and learn manner. Using computer graphics many educational models can be created through which more interest can be generated among the students regarding the subject.

Page 97: Green Computer

Computer Book-9 97GREEN

TrainingSpecialised system for training like simulators can be used for training the candidates in a way that can be grasped in a short span of time with better understanding. Creation of training modules using computer graphics is simple and very useful.

Image ProcessingVarious kinds of photographs or images require editing in order to be used in different places. Processing of existing images into refined ones for better interpretation is one of the many applications of computer graphics.

Graphical User InterfaceThe use of pictures, images, icons, pop-up menus, graphical objects helps in creating a user friendly environment where working is easy and pleasant.

VisualizationIt is used for visualization of scientists, engineers, medical personnel, business analysts for the study of a large amount of information.

Virtual RealityVirtual reality (VR) is a technology which allows a user to interact with a computer-simulated environment. The simulated environment can be similar to the real world, for example, simulations for pilot or combat training,

Graphics SoftwareGraphics software refers to a program or collection of programs that enable a person to manipulate images or models visually on a computer.Some of the popular graphics software are: Adobe Photoshop, Adobe Fireworks, Adobe Illustrate CorelDraw, Microsoft Paint and Picasa, Auto CAD, Autodesk Maya, GIMP (GNU Image Manipulation Program).

Dsimension of graphicsComputer graphics can be either two or three-dimensional. Early computers only supported 2D monochrome graphics. They were black and white (or black and green, depending on the monitor). Eventually, computers began to support color images. While the first machines only supported 16 or 256 colors, most computers can now display graphics in millions of colors.

Page 98: Green Computer

GREEN Computer Book-998

2D Graphics 2D graphics come in two flavors: Raster graphics and Vector graphics.

Raster graphicsRaster graphics are the most common and are used for digital photos, Web graphics, icons, and other types of images. They are composed of a simple grid of pixels, which can each be a different color.

Vector graphicsVector graphics, are made up of paths, which may be lines, shapes, letters, or other scalable objects. They are often used for creating logos, signs, and other types of drawings.

3D Graphics 3D graphics started to become popular in the 1990s, along with 3D rendering software such as CAD and 3D animation programs. By the year 2000, many video games had begun incorporating 3D graphics, since computers had enough processing power to support them. Now most computers now come with a 3D video card that handles all the 3D processing. This allows even basic home systems to support advanced 3D games and applications.

Graphics FilesA graphics file is a computer file that contains an image or picture in digital format. Graphic images are stored digitally using a small number of standardized graphic file formats, including bit map, TIFF, JPEG, GIF, PNG; they can also be stored as raw, unprocessed data.There are two types of graphics file:

1. Raster Image FileA raster graphics or bitmap image is a dot matrix data structure that represents a generally rectangular grid of pixels (points of color). Raster graphics, also known as bitmaps, store image data as fixed pixels. It is viewable via a monitor, paper, or other display medium. Raster images are stored in image files with various formats. Some of the popular formats are:• JPEG/JPG- Joint Photographic Expert Group • GIF- Graphics Interchange Format• TIFF- Tagged Image Format File• BMP- Bitmap• PNG- Portable Network Graphics• RAW images

Page 99: Green Computer

Computer Book-9 99GREEN

JPEG(Joint Photographic Expert Group)JPEG is the most common image format on World Wide Web and most of the digital cameras produce built-in JPEG image. The compression degree of JPEG image can be adjusted and typically, it gains 10:1 compression and you can feel the loss of quality in image. This filename extension is usually .JPEG or .JPG. A JPEG image is easily editable or compressible, but once you edit a high quality jpeg image, you cannot regain that quality again by reversing.

GIF(Graphic Interchange Format)GIF is has been quite popular in web for lightweight animations. Currently, they a re also used instead of emoticons in various chat apps. But, for scanned images containing text and for general images with texts also render clear visibility on web.

TIFF(Tagged Image File Format)TIFF is a short form of Tagged Image File Format for storing raster graphics images. This format is popular among graphic artists, photographers, and print media. Scanning, word processing, faxing, optical character recognition, desktop publishing, image manipulation, and page-layout applications. TIFF is flexible, adaptable, and capable of storing image data in a lossless format.

BMP (Bitmap)BMP is also known as bitmap image file or raster graphics file which is a dot matrix data structure. It is used to store bitmap digital images free from display device barrier. This file format is capable to store two dimensional digital images. It can store data of r aw images. One of the many advantages of Bitmap formats is it can keep its quality while saving in multiple other raster formats. It is supported by most of the virtual devices. Before JPEG, BMP was quite popular.

Page 100: Green Computer

GREEN Computer Book-9100

PNG(Portable Network Graphics)PNG It is an acronym of Portable Network Graphics. It is a raster image format which supports lossless data compression and also background transparency. In fact, for having transparent effects, PNG images are best options for professionals who are related to web. PNG image format supports palette-based images, grayscale images, and full color RGB images. Its file extension is .png.

RAW imagesRAW images are not processed and so, they are not ready to be printed. The images of this format is also called digital negative as they preserve all information like old negative and some cases, they keep more information than that of with minimum loss of data or metadata.

2. Vector Image fileVector Graphics are computer graphics images that are defined in terms of 2D points, which are connected by lines and curves to form polygons and other shapes.Each of these points has a definite position on the x- and y-axis of the work plane and determines the direction of the path; further, each path may have various properties including values for stroke color, shape, curve, thickness, and fill Vector graphics are commonly found today in the SVG, EPS, PDF or AI graphic file formats.• SVG- Scalable Vector Graphics• EPS- Encapsulated Post Script• PDF- Portable Document Format• AI- Adobe Illustrator

Vector Image File Formats

SVG (Scalable Vector Graphics)The W3C standard vector image format is called SVG (Scalable Vector Graphics). Inkscape and recent versions of Adobe Illustrator and CorelDRAW have good support for reading and writing SVG.

Page 101: Green Computer

Computer Book-9 101GREEN

EPS(Encapsulated PostScript)Adobe’s EPS format (Encapsulated PostScript) is perhaps the most common vector image format. It is the standard interchange format in the print industry. It is widely supported as an export format, but due to the complexity of the full format specification, not all programs that claim to support EPS are able to import all variants of it.

PDF (Portable Document Format)Adobe’s PDF format (Portable Document Format) is very widely used as a general purpose platform-independent document format.

AI (Adobe Illustrator)The native format of Adobe Illustrator is the AI format (Adobe Illustrator Artwork), a modified version of the older EPS format. The AI format is fairly widely supported, but is less ubiquitous than the EPS format, and most programs that read AI can also read EPS.

Raster Graphics Vector Graphics• They are composed of pixels. • They are composed of paths.• In Raster Graphics, refresh process

is independent of the complexity of the image.

• Vector displays flicker when the number of primitives in the image become too large.

• Graphic primitives are specified in terms of end points and must be scan converted into corresponding pixels.

• Scan conversion is not required.

• Raster graphics can draw mathematical curves, polygons and boundaries of curved primitives only by pixel approximation.

• Vector graphics draw continuous and smooth lines.

• Raster graphics cost less. • Vector graphics cost more as compared to raster graphics.

• They occupy more space which depends on image quality.

• They occupy less space.

• File extensions: .BMP. .TIF. .GIF, .JPG

• File Extensions: .SVG, .EPS, .PDF, .Al. .DXF

Page 102: Green Computer

GREEN Computer Book-9102

Use of Graphics in WebThe Web is about more than text and information. It is also a medium for expressing artistic creativity, data visualization, and optimizing the presentation of information for different audiences with different needs and expectations. The use of graphics on Web sites enhances the experience for users. Web graphics are visual representations used on a Web site to enhance or enable the representation of an idea or feeling, in order to reach the Web site user. Graphics may entertain, educate, or emotionally impact the user, and are crucial to strength of branding, clarity of illustration, and ease of use for interfaces. Graphics are used for everything from enhancing the appearance of Web pages to serving as the presentation and user interaction layer for full-fledged Web Applications.

Purpose of graphics in web design1. Graphics add visual/aesthetic appeal to the information on the web page,

helping to maintain viewer interest and attention.2. Help to create visual structure for information and links on the page.3. Communicate or explain ideas visually.

Guidelines for effective use of web graphics1. Graphics should fit in with the purpose, organization, and style of the

page. They should enhance the design, structure, or informative content of the web page without distracting attention.

2. Avoid using graphics with large file sizes that add to the load time of the page. Also, consider the cumulative file size of all images on the page. Excessive “page weight” caused by poor image use can result in slow load times for pages.

3. Graphics should help to guide the viewers’ focus to the important content on the page. Using visually strong graphic elements on a page can be useful in directing viewers’ attention and providing structure for the page.

4. Avoid repetitive use of overly bright or potentially “horrible” images. These types of “eye catching” images may be attractive at first, but after the novelty wears off, they may cause viewers to lose patience with the site. While an animation of a dancing monkey may seem interesting and funny at first, over time it may become annoying and drive viewers away.

5. Avoid the use of graphics to convey textual content information. While

Page 103: Green Computer

Computer Book-9 103GREEN

it may be tempting from a design standpoint to use images for textual information because of the greater number of design options such as font choices and text effects, graphic based text presents a variety of problems.

6. Provide textual equivalent alternatives for graphic content. Remember that not all users are able to see the images on your web page. Whenever images are used, it is important to provide equivalent content or descriptions of the image in a textual format.

7. When using text in graphics, make sure there is sufficient contrast between the text and the background color. Design graphic elements so that users can easily distinguish the text from its background. Also, be sure to avoid color combinations (reds and greens for example) that color blind users will not be able to distinguish apart from one another.

Web Graphics Basics

PixelsComputer based images are comprised of thousands of tiny dots of colour called pixels. These are the small dots you see if you put your face too close to your television or computer screen. Each digital image is comprised of thousands or millions of individual pixels, each with its own color. When these groups of pixels are viewed as a whole, we see the entire image. Most computer monitors have display sizes of 800x600 pixels, 1024x768 pixels, or 1280x1024 pixels.

ResolutionResolution indicates the number of pixels that are displayed per inch for an image (or pixels per centimeter). Most computer monitors display at resolutions of 72 pixels per inch or 96 pixels per inch. If an image is 72 pixels wide, then it will display as 1 inch big on a monitor that is set to a resolution of 72 pixels/inch. It is important to remember that for computer graphics, a higher resolution (pixels/inch) does not mean a higher quality image. What is important is the total size, in pixels, of the image. Resolution can be measured in PPI (Pixel Per Inch) or DPI (Dots Per Inch).

Resolution for PrintingGraphics for print and graphics for display on computer monitors use different resolutions. While monitors are constrained by the 72 or 96 pixel per inch limitation, standard deskjet printers currently print in the range of 4800x1200

Page 104: Green Computer

GREEN Computer Book-9104

dpi (dots per inch) and pictures in magazines typically print at a resolution of 150 dpi.

Graphics and File SizeWeb designers are always caught in a constant compromise between image quality and file size. Generally speaking, the higher the quality of the image, the greater the file size will be. Also, the larger the image, the larger the file size will be.It is important to consider the file size of images when using them on a web page. Images with large file sizes take longer to load. Long load times can be an annoyance to your audience and may render pages essentially unusable for those with slow Internet connections.

Graphics Editing

Changing the image size:Size of image depends upon the number of pixels. Increasing or decreasing number of pixel determine the size of image.Using Adobe Photoshop to demonstrate graphics editing tasks• Open Adobe Photoshop.• Open the image in Photoshop which you want to resize. Or, press ALT + CTRL+I Keys together• Image size dialog box

appear on the screen.• Now you can change

the pixel dimension, document size and resolution of image according to the requirement.

• Click OK button.

Page 105: Green Computer

Computer Book-9 105GREEN

Changing the image format:• Open the image in

Photoshop.• Go to file menu and click

on Save As .Or, • Press Shift+Ctrl+S keys

together.• Save As dialog Box

appears on the screen.• Click on format box to select required fromat.• Write name of the file in file name box.• Select the folder in which you want to store the file• Click on Save button.

Using Text ToolText tool can be used to type text on any image• Open image file in Photoshop.Or, • Open Photoshop, go to file menu, click on new to open new file.• Click on text tool from the tools.• Click on the required place of image to type text image.

Text formating

• Select the layer of text that you want to format.• Click on the text layer from the Layer Panel.• Click on the text tools from the tools and select the text on the image.• Goto option bar under the menu bar.• Select the required Font, Font Size, Font color.

Page 106: Green Computer

GREEN Computer Book-9106

Selection Tools

Marquee:The Marquee Tools are used for selecting objects such as rectangles, squares, and ellipses.• Click the tool button, choose a rectangular or an

elliptical marquee. • Drag the marquee over the area of the image you

wish to select.

Move:The Move Tool is used to move selections, objects, and layers.• Click the tool button, then click on

any object on the page you wish to move.

Lasso:There are several Lasso Tools which are used to make irregular selections. There is a polygonal lasso tool for polygon selections, and a magnetic lasso tool which automatically follows edges of objects.

Magic Wand:The Magic Wand Tool selects an area of similar colors in single click (such as the white in the cloud logo and here in duck picture).• Click the tool button, then• click on the area of the image you wish to select

Crop and Slice Tools

Crop Tool:The Crop Tool allows users to redefine their active image. It’s sort of like

Page 107: Green Computer

Computer Book-9 107GREEN

cutting out a smaller photo with a pair of scissors. • Select and cut parts of an image. • Click the tool button, then click and drag the tool over that you want to

keep. Resize the selected area• dragging the squares at the sides and corners. Click when your crop box is

sized correctly.

Slice Tool:The slice tool is used to cut images into slices, which can be exported to a web page.

Retouch Tools

Healing tools:There are several healing tools in Photoshop which are used to repair imperfections in images, or handle blemishes and red-eye.

Clone Stamp Tool:With the Clone Stamp Tool, a user may select a source starting point somewhere on an image, and then paint elsewhere using that starting point as a reference, effectively cloning the source.

Eraser Tool:The Eraser Tool can be used to erase parts of an image, selection, or layer.

Page 108: Green Computer

GREEN Computer Book-9108

Sharpen Tool:The Sharpen Tool is used to sharpen edges in an image, while the Blur Tool blurs edges. The Smudge Tool smudges an image, similar to using the finger paint.

Dodge Tool:The Dodge Tool lightens parts of an image while the Burn Tool darkens. The Sponge Tool is used to saturate, or de-saturate parts of an image.

Painting Tools

Brush and Pencil:The Brush and Pencil tools are used to paint strokes in graphics. These tools can be highly customized for very effective painting.

Fill Tools:The Fill Tools are used to fill entire layselections and areas with a solid color, gradient.

Page 109: Green Computer

Computer Book-9 109GREEN

Drawing & Type Tools

Type Tools:The Type Tools are used for creating and setting type in an image. Both vertical and horizontal type can be created.

Pen Tools:The Pen Tools are used to create clear shapes and paths which can be used as vector objects that can be scaled to any size.

Custom Shapes:Custom Shapes are vector objects that can be created from a list of presets (including user created shapes).

Foreground / Background ColorA foreground color and background color can be set to be used to paint with, color text, and fill objects among other things. This view provides an easy way to see what colors are currently selected, and allows for easy switching between two different colors.

Quick Review

1. Computer graphics is an art of drawing pictures, lines, charts, etc using computers with the help of programming.

2. Graphic refers to a design or visual image displayed on a variety of surfaces, including canvas, paper, a wall, a sign, or a computer monitor.

3. In non-interactive computer graphics, the observer has no control over the image.

Page 110: Green Computer

GREEN Computer Book-9110

4. In interactive Computer Graphics; the observer is given some control over the image by providing him with an input device.

5. Graphics software refers to a program or collection of programs that enable a person to manipulate images or models visually on a computer.

6. 2D monochrome graphics were black and white (or black and green, depending on the monitor).

7. Raster graphics are the most common and are used for digital photos, Web graphics, icons, and other types of images.

8. Vector graphics, are made up of paths, which may be lines, shapes, letters, or other scalable objects.

9. Computer based images are comprised of thousands of tiny dots of colour called pixels.

10. Resolution is the number of pixels that are displayed per inch for an image (or pixels per centimeter).

Exercise1. Answer the following questions. a. What is graphics? Give some examples. b. Define computer graphics. Explain its types. c. List out the applications of computer graphics. d. How computer graphics can be used in entertainment. Give an example. e. What is computer graphics? f. Write diffeernces between raster image and vector image. g. List out the raster gaphics file format and explain any two. h. List out the vector graphics file format and explain any two. i. Define the terms pixels and resolution. j. What is graphics software? Give some examples. k. What are the purposes of graphics in web design. l. Write down the guidelines for effective use of web graphics.

2. Write short notes on the following terms: a. 2D graphics b. 3D graphics c. Image processing

Page 111: Green Computer

Computer Book-9 111GREEN

d. Graphics file e. Virtual reality f. BMP g. JPEG/JPG

3. Fill in the blanks:

a. The ......................... are used to create clear shapes and paths which can be used as vector objects that can be scaled to any size.

b. ......................... are vector objects that can be created from a list of presets.

c. The Type Tools are used for creating and setting type in .........................d. The ......................... tools are used to paint strokes in graphics.e. The ......................... Tool lightens parts of an image while the

......................... Tool darkens.f. The ......................... Tool can be used to erase parts of an image,

selection, or layer. g. The ......................... Tool is used to sharpen edges inan image, while

the ......................... Tool blurs edges.h. The ......................... is used to cut images into slices, which can be

exported to a web page.i. The ......................... Tools are used for selecting objects such as

rectangles, squares, and ellipses.j. The ......................... tools which are used to make irregular selections.

4. Write techical terms for the following statements:

a. The Tool selects an area of similar colors in single click.b. The Tool can be used to erase parts of an image, selection, or layer. c. They are of thousands of tiny dots which make computer based

images.d. It indicates the number of pixels that are displayed per inch for an .

Page 112: Green Computer

GREEN Computer Book-9112

e. They are made up of paths, which may be lines, shapes, letters, or other scalable objects.

f. It refers to a design or visual image displayed on a variety of surfaces, including canvas, paper, a wall, a sign, or a computer monitor.

5. Write True or false for the following statements.

a. Graphics should fit in with the purpose, organization, and style of the page.

b. RAW images are processed and so, they are not ready to be printed.c. Graphics should help to guide the viewers’ focus to the important

content on the page. d. SVG is the raster image file format.e. Raster graphics is also known as bitmaps, store image data as fixed

pixels.f. Virtual reality is a technology which allows a user to interact with a

computer-simulated environment.

6. Write full form of the following: BMP JPEG TIFF PNG PPI DPI PDF EPS CG GIF SVG AI 3D 2D

LAB PRACTICEa. Open any image file in Photoshop and chage in different sizes.b. Open any image file in Photoshop and change the file format in PNG

format.c. Open any image file in Photoshop and cut out the unwanted part of the

image.d. Open any image file in Photoshop and practice the selection tools.e. Open any image file in Photoshop and type some text on the image.f. Open any image file in Photoshop and erase unwanted part of the image

using eraser tool.

Page 113: Green Computer

Computer Book-9 113GREEN

Hyper Text Markup Language(HTML)

9

IntroductionHTML has been developed with the vision that all manner of devices should be able to use information on the Web; PCs with graphics displays of varying resolution and colour depths, cellular telephones, hand held devices, devices for speech for output and input, computers with high or low bandwidth, and so on.HTML stands for Hypertext Markup Language, and it is the most widely used language to write Web Pages of a website. Hypertext refers to the way in which Web pages HTML documents are linked together. Thus the link available on a webpage is called Hypertext.As its name suggests, HTML is a Markup Language which means you use HTML to simply "mark up" a text document with tags that tell a Web browser how to structure it to display.Originally, HTML was developed with the intent of defining the structure of documents like headings, paragraphs, lists, and so forth to facilitate the sharing of scientific information between researchers. Now, HTML is being widely used to format web pages with the help of different tags available in HTML language.HTML was developed by Tim Berners-Lee, a researcher at CERN, an international scientific organization based in Geneva, Switzerland in 1990 for presenting information on the internet. There are different versions of HTML available. HTML, HTML+, HTML 3 are some of them.

Page 114: Green Computer

GREEN Computer Book-9114

Some More Common Terms Related to HTML

Hyperlinks A hyperlink is a graphic or a piece of text in an Internet document that connects readers to another webpage, or another portion of a document.

Web serverA web server is a computer that is connected to the Internet and stores all the web sites to be available to everyone. The web server is also the program or machine that responds to the request, and delivers the content of the page back to the user.

Web pages and home pagesA web page is a collection of text, images, graphics, videos and animations arranged in systematic way and provides the information about a subject. The very first page which we get while visiting the website is known as home page. All the links are provided from the home page to other pages.

Web browserA web browser is a software application that people use in order to view web pages on the Internet. A web browser allows us to travel through the Internet and visit our favorite websites. Some of the popular Web browsers are: Mozilla Firefox, Internet explorer, Opera, Google Chrome, etc.

Web clientA web client is a program capable of communicating with Web servers, requesting and receiving information from them, and processing it for display or other uses. A web browser is one kind of Web client.

Page 115: Green Computer

Computer Book-9 115GREEN

URLURL provides the location of the browser. A URL (Uniform Resource Locator) is a form of URL and is a standardized naming convention for addressing documents accessible over the Internet and Intranet. An example that makes clear about URL. Eg. https//nb.beanstalksapp.com, https//www.google.com.

Hyper Text Transfer Protocol (HTTP)HTTP specifies the protocol which the computer will use to get information from the site. This protocol is called Hyper Text Transfer Protocol. Computer protocol is a set of rules that enables computers to connect with one another to exchange and share resources.

Web HostingWeb Hosting is the service providing space on the Internet for websites. When you make a website and want other people to see it, you will need to publish (or upload) it with a web hosting service.

World Wide Web (WWW): WWW is the important service of Internet. It was created in 1990 by European Particle Physics Laboratory in Geneva Switzerland to exchange and share data through the Internet using a protocol known as hypertext transfer protocol (HTTP).

Searching Information Internet is one of the biggest libraries in the word. You can find any piece of information on Internet. Search engine helps you to search a piece of information. When you are looking for a site whose address you don’t know, you can search for it using a search engine. A search engine will scan through thousands of websites and web pages on the Internet and collect and organize the information it thinks is most relevant to you. It is a tool that searches documents for specific keyword, phrase, data, etc. via WWW.Some of the most popular search engines are: • Google www.google.com • Yahoo www.yahoo.com • Bing www.bing.com

Page 116: Green Computer

GREEN Computer Book-9116

Uploading and DownloadingUploading means data is being sent from your computer to the Internet. Examples of uploading include sending email, posting photos on a social media site and using your webcam. Downloading means your computer is receiving data from the Internet. It is a process of copying file from Internet to your computer.

Tags and ElementsHTML Tags are the instructions which are used to create HTML document that can be opened by the browsers and by other agents worldwide if uploaded in WWW. They are also termed as Elements. A tag begins with a ‘<’ and ends with ‘>’ which are known as angular brackets and looks like this <tag>.These tags are not case sensitive; you can use either upper case or lower case when typing the identifier for a tag. Tag consists of three parts:• Element• Attribute• Value

AttributesAttributes are the additional instructions that further define the behavior of the element.They enhance the text by providing a wide range of formatting for better look and layout while opened by the browsers. A tag name is followed by the attributes with values in them.They should be enclosed within the angular brackets.Ex: <BODY BGColour="#FFFFAA" TEXT="black">

Tag attributes valuesIn this example, BGColour and TEXT are the attributes of BODY element. "#FFFFAA" and "black" are the values for BGColour and TEXT attribute respectively.Now, let's review some parts of the lesson that we had learnt in our previous class.There are two types of HTML tages.

Page 117: Green Computer

Computer Book-9 117GREEN

1. Container tagsThese tags are also called paired tags. They include Start tag and End tag. The End tag is preceded with (/) slash sign inside the angular brackets.Example:a. <HTML> ………. </HTML>b. <BODY> ……….. </BODY>

2. Empty tagsEmpty tags are complete on themselves. They have only Start tag.For Example: <HR> for inserting horizontal line.<BR> for line break.The first thing you’ll notice about the code is that every html command or ‘tag’ is actually a pair of tags, an opening tag and a closing tag preceded by a forward slash. However, there are certain exceptions to this rule. Many tags also include attributes, in the form attribute = "value" which add options to that particular tag. Tags may be in either uppercase or lowercase. Tags must also be properly nested, failing which, you will encounter unexpected problems.

HTML ComponentsEvery HTML document should look basically as follows:<html><head><title>This is document title</title></head><body><h1>This is a heading</h1><p>Document content goes here.....</p></body></html>

Page 118: Green Computer

GREEN Computer Book-9118

HTML TagsHTML is a markup language that makes use of various tags to format the content.These tags are enclosed within angle braces <Tag Name>. Except few tags, most of the tags have their corresponding closing tags. For example <html> has its closing tag </html> and <body> tag has its closing tag </body> tag, etc.Tag Description<html> This tag encloses the complete HTML document and mainly

comprises of document header which is represented by <head>...</head> and document body which is represented by <body>...</body> tags.

<head> This tag represents the document's header which can keep other HTML tags like <title>, <link>, etc.

<title> The <title> tag is used inside the <head> tag to mention the document title.

<body> This tag represents the document's body which keeps other HTML tags like <h1>, <div>, <p> etc.

<h1> This tag represents the heading.<p> This tag represents a paragraph. Above example of HTML document

uses following tags:

BODY TagThe BODY of the document contains the actual information. All the contents that are to appear in the web page should be put in between <BODY> and </BODY> tags. There may be only one BODY statement in the document.We’ll now create a simple "Start" page in order to illustrate the fundamentals of HTML.Try typing the following code into your HTML editor. You can simply open Notepad text editor and type the following codes of HTML.<html><head><title> This is first html Page</title></head><body> This is my first page see the description of body.</body></html>

Page 119: Green Computer

Computer Book-9 119GREEN

Attributes of <BODY> tagAttributes FunctionsBGColour = " " Changes the colour of the body background.BACKGROUND = " " Sets a picture as body background.TOPMARGIN = " " Sets the top margin of a page.BOTTOMMARGIN = " " Sets the bottom margin of a page.BOTTOMMARGIN = " " Sets the bottom margin of a page.LEFTMARGIN = " " Sets the left margin of a page.<html><head><title>HTML Attributes and Colours by Nam e</title></head><body text="blue" bgcolour="green" background="pic1.jpg” ><p>Use different colour names for body and see the result.</p></body></html>Where, • Background sets background image. Image file name is pic1.jpg• Bgcolour sets background colour.• Text sets text colour

W3C Standard 16 ColoursHere is the list of W3C (World Wide Web Consortium) Standard 16 Colours names with their hex codeand it is recommended to use them.

Example Black #000000 Gray #808080 Silver #C0C0C0White #FFFFFF Yellow #FFFF00 Lime #00FF00Aqua # 00FFFF Fuchsia XFF00FF Red #FF0000Green #008080 Blue #0000FF Purple #800080Maroon #8000000 Olive #808000 Navy #000080Teal #008080

Page 120: Green Computer

GREEN Computer Book-9120

HTML Document StructureA typical HTML document will have following structure:Document declaration tag <html> <head> Document header related tags </head> <body> Document body related tags </body></html>

Creating and Saving HTML DocumentAn HTML document can be created in any plain text editor like Notepad or Textpad. After the completion of document, you need to save it with .htm or .html as an extension after the file name. You need to use browser to view the HTML documents.

<html>

Page 121: Green Computer

Computer Book-9 121GREEN

<head> <title>The title is Search Engine </title></head><body> <h1>This is a heading</h1> <p>Internet is one of the biggest libraries in the word. It can provide any piece of information. Search engine helps you to search a piece of information. When you are looking for a site whose address you don’t know, you can search for it using a search engine.A search engine will scan through thousands of websites and web pages on the Internet and collect and organize the information it thinks is most relevant to you. It is a tool that searches documents for specific keyword, phrase, data, etc. via WWW.</p></body></html>

How to view a web page:• Open the Internet Explorer or any other browser.• Click on the file menu and choose Open command. The Open dialogue

box appears on the screen.• Click on browser

button.• Select a web page

that you want to view on the browser. For example, test1.html.

• Click on Open button. The open dialog box reappears with the path of the file that is to be opened.

Page 122: Green Computer

GREEN Computer Book-9122

• Click on OK button. • Then you can see the following webpage.

Viewing the Source CodesYou can view the source codes of the opened web page.

• Click on the view menu of the browser and select source button. OR,

• Right click on any part of the web page and select View Source option.

The source code of HTML document appears on the Notepad program. Now, you can change or modify the contents and save it.

ParagraphOn a web page, text flows continuously across the page regardless of carriage returns or white spaces in the html code. Thus, paragraph and line breaks need to be explicitly specified in html.The <P> tag is used to indicate the beginning of a new paragraph. It doesn't need to be closed with a </P> tag. So, it is also an empty tag.The <p> tag may also be used to align the blocks of text with the align attribute, which takes the values left, center and right.Example:1. <P ALIGN = "LEFT">

The text of the paragraph is aligned to the left.

2. <P ALIGN = "CENTER">

The text of the paragraph is aligned to the center.

3. <P ALIGN = "RIGHT">

The text of the paragraph is aligned to the right.

Page 123: Green Computer

Computer Book-9 123GREEN

<CENTER> TAGWe’re on the topic of alignment. So, let’s learn about the <CENTER> ………….. </CENTER> tag combination which aligns all elements between the opening and closing tags in the center of the page.Example:<CENTER>This text is aligned in the center.</CENTER>

Line breaksCreating line breaks is important element that can make the words on the screen make sense and convey information more clearly. If you want a sentence to begin on a new line then you could use the line break using <BR> tag.Solved Example:<html> <HEAD> <TITLE>Using BR</TITLE> </HEAD> <BODY> The line breaks here <BR> another line starts <BR> another <BR>

another. </BODY></HTML>In the browser the document appears as :

Page 124: Green Computer

GREEN Computer Book-9124

Heading TagsAny document starts with a heading. You can use different sizes for your headings. HTML also hassix levels of headings, which use the elements <h1>, <h2>, <h3>, <h4>, <h5>, and <h6>.While displaying any heading, browser adds one line before and one line after that heading.Example:<html> <head> <title>Heading Example</title> </head> <body> <h1>This is heading 1</h1> <h2>This is heading 2</h2> <h3>This is heading 3</h3> <h4>This is heading 4</h4> <h5>This is heading 5</h5> <h6>This is heading 6</h6> </body></html>This will produce the following result:

This is heading 1This is heading 2This is heading 3This is heading 4This is heading 5This is heading 6

Page 125: Green Computer

Computer Book-9 125GREEN

<HR> tagA horizontal rule is a dividing line placed across the page of the document. The <HR> tag is used to insert a horizontal line in a web document. Like the paragraph and the line break elements, the horizontal rule is an empty element. You can include the attributes WIDTH in percentage, ALIGN as left, center or right and SIZE in number as 1, 2 etc.Solved Example:<html> <HEAD> <TITLE>Horizontal Rule</TITLE> </HEAD> <BODY> A horizontal rule looks like <P> <HR size=8px colour="red"> This. </BODY></HTML>Here’s how it would look on your screen when browsed.

The exact appearance of a horizontal rule is dependent on the implementation by your browser. In every browser, however the <HR> tag will generate a separating line of some sort.If you use a word processor, you must be familiar with the ability to make text bold, italicized, or underlined; these are just three of the ten options available to indicate how text can appear in HTML and XHTML.

Page 126: Green Computer

GREEN Computer Book-9126

Bold TextAnything that appears within <b>...</b> element, is displayed in bold as shown below:Example:<html> <head> <title>Bold Text Example</title> </head> <body> <p>The following word uses a <b>bold</b> typeface.</p> </body></html>This will produce following result:The following word uses a bold typeface.

Italic TextAnything that appears within <i>...</i> element is displayed in italicized as shown below:Example:<html> <head> <title>Italic Text Example</title> </head> <body> <p>The following word uses a <i>italicized</i> typeface.</p> </body></html>This will produce following result:The following word uses a italicized typeface.

Page 127: Green Computer

Computer Book-9 127GREEN

Underlined TextAnything that appears within <u>...</u> element, is displayed with underline as shown below:Example:<html> <head> <title>Underlined Text Example</title> </head> <body> <p>The following word uses a <u>underlined</u> typeface.</p> </body></html>This will produce following result:The following word uses an underlined typeface.

Strike TextAnything that appears within <strike>...</strike> element is displayed with strikethrough, which is a thin line through the text as shown below:Example:<html> <head> <title>Strike Text Example</title> </head> <body> <p>The following word uses a <strike>strikethrough</strike>

typeface.</p> </body></html>This will produce following result:The following word uses a strikethrough typeface.

Superscript TextThe content of a <sup>...</sup> element is written in superscript; the font size used is the same size as the characters surrounding it but is displayed half a character's height above the other characters.

Page 128: Green Computer

GREEN Computer Book-9128

Example:<html> <head> <title>Superscript Text Example</title> </head> <body> <p>The following word uses a <sup>superscript</sup> typeface.</p> </body></html>

Subscript TextThe content of a <sub>...</sub> element is written in subscript; the font size used is the same as the characters surrounding it, but is displayed half a character's height beneath the other characters.Example:<html> <head> <title>Subscript Text Example</title> </head> <body> <p>The following word uses a <sub>subscript</sub> typeface.</p> </body></html>This will produce following result:The following word uses a subscript typeface.

Page 129: Green Computer

Computer Book-9 129GREEN

Inserted TextAnything that appears within <ins>...</ins> element is displayed as inserted text.Example:<html> <head> <title>Inserted Text Example</title> </head> <body> <p>I want to drink <del>cola</del> <ins>wine</ins></p> </body></html>This will produce following result:I want to drink cola water.

Deleted TextAnything that appears within <del>...</del> element, is displayed as deleted text.Example:<html> <head> <title>Deleted Text Example</title> </head> <body> <p>I want to drink <del>cola</del> <ins>Cold drink</ins></p> </body></html>This will produce following result:I want to drink cold drink

Larger TextThe content of the <big>...</big> element is displayed one font size larger than the rest of the text surrounding it as shown below:Example:<html> <head> <title>Larger Text Example</title> </head> <body>

Page 130: Green Computer

GREEN Computer Book-9130

<p>The following word uses a <big>big</big> typeface.</p> </body></html>This will produce following result:

The following word uses a big typeface.

Smaller TextThe content of the <small>...</small> element is displayed one font size smaller than the rest of the text surrounding it as shown below:

Example:<html> <head> <title>Smaller Text Example</title> </head> <body> <p>The following word uses a <small>small</small> typeface.</p> </body></html>This will produce following result:The following word uses a small typeface.

Grouping ContentThe <div> and <span> elements allow you to group together several elements to create sections or subsections of a page. For example, you might want to put all of the footnotes on a page within a <div> element to indicate that all of the elements within that <div> element relate to the footnotes. You might then attach a style to this <div> element so that they appear using a special set of style rules.

Example:

<html> <head> <title>Div Tag Example</title> </head> <body> <div id="menu" align="middle" > <a href="/index.htm">HOME</a> |

Page 131: Green Computer

Computer Book-9 131GREEN

<a href="/about/contact_us.htm">CONTACT</a> | <a href="/about/index.htm">ABOUT</a> </div> <div id="content" align="left" bgcolour="white"> <h5>Content Articles</h5> <p>Actual content goes here.....</p> </div> </body></html>This will produce following result:

HOME | CONTACT | ABOUT

HTML Phrase TagsThe phrase tags have been designed for specific purposes, though they are displayed in a similar way as other basic tags like <b>, <i>, <pre>, and <tt>, you have seen in previous chapter. This chapter will take you through all the important phrase tags, so let's start seeing them one by one.

Emphasized TextAnything that appears within <em>...</em> element is displayed as emphasized text.Example:

Page 132: Green Computer

GREEN Computer Book-9132

Marked TextAnything that appears with-in <mark>...</mark> element, is displayed as marked with yellow ink.Example:<html> <head> <title>Marked Text Example</title> </head> <body> <p>The following word has been <mark>marked</mark> with yellow</p> </body></html>This will produce following result:The following word has been marked with yellow colour.

HTML CommentsComment is a piece of code which is ignored by any web browser. It is a good practice to add comments into your HTML code, especially in complex documents, to indicate sections of a document, and any other notes to anyone looking at the code. Comments help you and others understand your code and increase code readability.HTML comments are placed in between <!-- ... --> tags. So any content placed with-in <!-- ... --> tags will be treated as comment and will be completely ignored by the browser.Example:<html> <head> <!-- Document Header Starts --> <title>This is document title</title> </head> <!-- Document Header Ends --> <body> <p>Document content goes here.....</p> </body></html>This will produce following result without displaying the content given as a part of comments:Document content goes here.....

Page 133: Green Computer

Computer Book-9 133GREEN

FONT TagFonts play very important role in making a website more user friendly and increasing content readability. Font face and colour depends entirely on the computer and browser that is being used to view your page but you can use HTML <font> tag to add style, size, and colour to the text on your website. You can use a <basefont> tag to set all of your text to the same size, face, and colour.The font tag is having three attributes called size, colour, and face to customize your fonts. To change any of the font attributes at any time within your webpage, simply use the <font> tag. The text that follows will remain changed until you close with the </font> tag. You can change one or all of the font attributes within one <font> tag.

Attributes of <FONT> tagAttributes FunctionsFACE = " " Sets the font style of text.SIZE = " " Sets the font size of textColour = " " Sets the font colour of text.

Set Font SizeYou can set content font size using size attribute. The range of accepted values is from 1smallest to 7largest. The default size of a font is 3.Example:<html> <head> <title>Setting Font Size</title> </head> <body> <font size="1">Font size="1"</font><br /> <font size="2">Font size="2"</font><br /> <font size="3">Font size="3"</font><br /> <font size="4">Font size="4"</font><br /> <font size="5">Font size="5"</font><br /> <font size="6">Font size="6"</font><br /> <font size="7">Font size="7"</font> </body></html>

Page 134: Green Computer

GREEN Computer Book-9134

This will produce following result:Font size="1"

Font size="2"

Font size="3"

Font size="4"

Font size="5"

Font size="6"

Font size="7"Relative Font SizeYou can specify how many sizes larger or how many sizes smaller than the preset font size should be. You can specify it like <font size="+n"> or <font size="-n">Example:<html> <head> <title>Relative Font Size</title> </head> <body> <font size="-1">Font size="-1"</font><br /> <font size="+1">Font size="+1"</font><br /> <font size="+2">Font size="+2"</font><br /> <font size="+3">Font size="+3"</font><br /> <font size="+4">Font size="+4"</font> </body></html>

This will produce following result:Font size="-1"

Font size="+1"

Page 135: Green Computer

Computer Book-9 135GREEN

Font size="+2"

Font size="+3"

Font size="+4"Setting Font FaceYou can set font face using face attribute but be aware that if the user viewing the page doesn't have the font installed, they will not be able to see it. Instead user will see the default font face applicable to the user's computer.Example:<html> <head> <title>Font Face</title> </head> <body> <font face="Times New Rom an" size="5">Tim es New Rom an</

font><br /> <font face="Verdana" size="5">Verdana</font><br /> <font face="Com ic sans MS" size="5">Com ic Sans MS</font><br /> <font face="WildWest" size="5">WildWest</font><br /> <font face="Bedrock" size="5">Bedrock</font><br /></body></html>

This will produce following result:

Times New RomanVerdanaComic Sans MSWildWest

Bedrock

Page 136: Green Computer

GREEN Computer Book-9136

Setting Font ColourYou can set any font colour you like using colour attribute. You can specify the colour that you want by either the colour name or hexadecimal code for that colour.Example:<html> <head> <title>Setting Font Colour</title> </head> <body> <font colour="#FF00FF">This text is in pink</font><br /> <font colour="red">This text is red</font></body></html>This will produce following result:This text is in pinkThis text is red

The <basefont> Element:The <basefont> element is supposed to set a default font size, colour, and typeface for any parts of the document that are not otherwise contained within a <font> tag. You can use the <font> elements to override the <basefont> settings.The <basefont> tag also takes colour, size and face attributes and it will support relative font setting by giving size a value of +1 for a size larger or -2 for two sizes smaller.Example:<html> <head> <title>Setting Base font Colour</title> </head> <body> <basefont face="arial, verdana, sans-serif" size="2" colour="#ff0000"> <p>This is the page's default font.</p> <h2>Example of the &lt;basefont&gt; Element</h2> <p><font size="+2" colour="darkgray"> This is darkgray text with two sizes larger </font></p>

Page 137: Green Computer

Computer Book-9 137GREEN

<p><font face="courier" size="-1" colour="#000000"> It is a courier font, a size smaller and black in colour. </font></p> </body></html>This will produce following result:This is the page's default font.

Example of the <basefont> Element

This is darkgray text with two sizes larger

ListsHTML has several types of lists that allow you to display groups of information in different ways. There are three separate types of lists generally used in HTML. They are:1. Unordered List (<UL></UL>)2. Ordered List (<OL> <OL>)3. Description List (<DL></DL>)

1. Unordered ListAn unordered list can be termed as bulleted list. It is used for those items in which the ordering is not specific. The type of bullets "Circle", "Disc" and "Square" are used as the values for TYPE attribute of <UL> tag. The item list is defined by <LI> tag. It is used in between <UL> and </UL> tag.

The type AttributeYou can use type attribute for <ul> tag to specify the type of bullet you like. By default it is a disc.Following are the possible options:<ul type="square"><ul type="disc"><ul type="circle">

Page 138: Green Computer

GREEN Computer Book-9138

Example:<html> <head> <title>unordered list</title></head> <body> <h3>this is an unordered list</h3> <font size=10 face="arial"> <ul type= "circle"> <li> unordered list element 1 <li> unordered list element 2 <li> unordered list element 3 </ul> </font> </body></html>Example:Following is an example where we used <ul type="square"><html> <head> <title>HTML Unordered List</title> </head> <body> <ul type="square"> <li>Banana</li> <li>Papaya</li> <li>Apple</li> <li>Mango</li> </ul> </body></html>

Page 139: Green Computer

Computer Book-9 139GREEN

This will produce following result: Banana Papaya Apple Mango

Example:Following is an example where we used <ul type="disc"> :<html> <head> <title>HTML Unordered List</title> </head> <body> <ul type="disc"> <li>Banana</li> <li>Papaya</li> <li>Apple</li> <li>Mango</li> </ul> </body></html>This will produce following result:• Banana • Papaya • Apple• Mango

2. Ordered ListAn ordered list is also called a numbered list. The list is ordered by a numbering scheme using Arabic numbers, letters or Roman numerals. The list items are enclosed in between <OL> and </OL>. The types of numbering are "A", "a", "i", "I" and "1". The type "A" gives numbering as A, B, C, D … for the list items. The type "a" gives numbering as a, b, c, d…. to the list items. The "i" gives numbering as i, ii, iii, iv …. to the list items. The type "I" gives numbering as I, II, III, IV …. to the list items. The type "1" gives numbering as 1, 2, 3, 4 ….. to the list items. The typical syntax of a list is to have a tag for the beginning and then an <LI> or list tag, for each list element. Let’s learn to create a few lists.

Page 140: Green Computer

GREEN Computer Book-9140

The type AttributeYou can use type attribute for <ol> tag to specify the type of numbering you like. By default it is a number. Following are the possible options:<ol type="1"> - Default-Case Num erals.<ol type="I"> - Upper-Case Num erals.<ol type="i"> - Lower-Case Num erals.<ol type="a"> - Lower-Case Letters.<ol type="A"> - Upper-Case Letters.

Solved Example1:<html> <head> <title>ordered list</title></head> <body> <u>this is an ordered list </u> <ol type="i"> <li> ordered list element 1 <li> ordered list element 2 <li> ordered list element 3 <li> ordered list element 3 </ol> </body></html>Example:Following is an example where we used <ol type="1"><html> <head> <title>HTML Ordered List</title> </head> <body> <ol type="1"> <li>Onion</li> <li>Chilly</li>

Page 141: Green Computer

Computer Book-9 141GREEN

<li>Potato</li> <li>Carrot</li> </ol> </body></html>

This will produce following result:1. Onion2. Chilly3. Potato4. CarrotExample:Following is an example where we used <ol type="I"><html> <head> <title>HTML Ordered List</title> </head> <body> <ol type="I"> <li>Onion</li> <li>Chilly</li> <li>Potato</li> <li>Carrot</li> </ol> </body></html>

This will produce following result:I. OnionII. ChillyIII. PotatoIV. Carrot

Page 142: Green Computer

GREEN Computer Book-9142

Example:Following is an example where we used <ol type="A"><html> <head> <title>HTML Ordered List</title> </head> <body> <ol type="A"> <li>Beetroot</li> <li>Ginger</li> <li>Potato</li> <li>Radish</li> </ol> </body></html>

This will produce following result:A. BeetrootB. GingerC. PotatoD. RadishExample:Following is an example where we used <ol type="a"><html> <head> <title>HTML Ordered List</title> </head> <body> <ol type="a"> <li>Onion</li> <li>Chilly</li> <li>Potato</li> <li>Carrot</li> </ol> </body></html>

Page 143: Green Computer

Computer Book-9 143GREEN

This will produce following result:a. Onion b. Chillyc. Potato d. Carrot

The start AttributeYou can use start attribute for <ol> tag to specify the starting point of numbering you need.Following are the possible options:<ol type="1" start="4"> - Numerals starts with 4.<ol type="I" start="4"> - Numerals starts with IV.<ol type="i" start="4"> - Numerals starts with iv.<ol type="a" start="4"> - Letters starts with d.<ol type="A" start="4"> - Letters starts with D.Example:Following is an example where we used <ol type="i" start="4" ><html> <head> <title>HTML Ordered List</title> </head> <body> <ol type="i" start="4"> <li>Onion</li> <li>Chilly</li> <li>Potato</li> <li>Carrot</li> </ol> </body></html>

This will produce following result:iv. Onionv. Chillyvi. Potatovii. Carrot

Page 144: Green Computer

GREEN Computer Book-9144

3. Description ListsThere are also description lists in which a word and their associated definitions are paired together, as in a glossary, each with its own tag. Thus each entry into a description list has two elements: the description term, which uses a <DT> tag, and the description definition, which uses a <DD> tag. Usually browsers depict the description title and the description definition on separate lines, allowing the full width of the display for the description title.A description list would look like as given below:Solved Example:<html> <head> <title>description list</title></head> <body> <b><u>this is a description list.</b></u> <dl> <dt> first prize <dd> toshiba laptop with i7 processor <dt> second prize <dd> iphone <dt> third prize <dd> ipods </dl> </body></html>

Page 145: Green Computer

Computer Book-9 145GREEN

Inserting Images in HTML DocumentIn a web page images can be inserted in order to make the page more attractive and informative. Inline image and Background image are the two types of images in HTML document. The commonly used images are GIF (Graphic Interchange Format) and JPEG (Joint Photographic Expert Group). You can insert any image in your web page by using <img> tag. Following is the simple syntax to use this tag. <img src="Image URL" ... attributes-list/>Attributes of <IMG> tagAttributes FunctionsSRC = " " Sets the path of a picture.ALIGN = " " Sets the alignment for a picture to left, right or center.BORDER = " " Sets the border of a picture.HEIGHT = " " Sets height of a picture.WIDTH = " " Sets width of a picture.ALT = " " Displays text incase image is not displayed by the user.

The <img> tag is an empty tag, which means that it can contain only list of attributes and it has no closing tag.Example:To try following example, let's keep our HTML file testimage.html and image file pic.jpg in the same directory:<html> <head> <title>Using Image in Webpage</title> </head> <body> <p>Simple Im age Insert</p> <img src="/html/images/pic.jpg" alt="Test Image" /> </body></html>

Page 146: Green Computer

GREEN Computer Book-9146

You can use PNG, JPEG or GIF image file based on your comfort but make sure you specify correct image file name in src attribute. Image name is always case sensitive.The alt attribute is a mandatory attribute which specifies an alternate text for an image, if the image cannot be displayed.

Set Image LocationUsually we keep our all the images in a separate directory. So let's keep HTML file test.htm in our home directory and create a subdirectory images inside the home directory where we will keep our image test.png.Example:Assuming our image location is "/html/image/test.png", try the following example:<html> <head> <title>Using Image in Webpage</title> </head> <body> <p>Simple Im age Insert</p> <img src="/html/images/test.png" alt="Test Image" /> </body></html>

Set Image Width/HeightYou can set image width and height based on your requirement using width and height attributes. You can specify width and height of the image in terms of either pixels or percentage of its actual size.Example:<html> <head> <title>Set Image Width and Height</title> </head> <body> <p>Setting image width and height</p> <img src="/html/im ages/test.png" alt="Test Image" width="150"

height="100"/></body></html>

Page 147: Green Computer

Computer Book-9 147GREEN

Set Image BorderBy default, image will have a border around it, you can specify border thickness in terms of pixels using border attribute. A thickness of 0 means, no border around the picture.Example:<html> <head> <title>Set Image Border</title> </head> <body> <p>Setting image Border</p> <img src="/html/images/test.png" alt="Test Image" border="3"/> </body></html>

Set Image AlignmentBy default image will align at the left side of the page, but you can use align attribute to set it in the center or right.Example:<html> <head> <title>Set Image Alignment</title> </head> <body> <p>Setting image Alignment</p> <img src="/html/images/test.png" alt="Test Image" border="3"

align="right"/> </body></html>

LinksLinks or hyperlinks are the most important part of the World Wide Web. A link is a reference, either to another part of the same document or another document signified by the <A> and </A> tags. There are three different kinds of links.

Page 148: Green Computer

GREEN Computer Book-9148

1. Links within a page (Internal links)2. Links to other web pages of the same Web site (Local hyperlinks).3. Links to pages of different Web sites (Global hyperlinks).

Anchor <A> tagAnchors are text elements which act as markers in HTML file to specify the beginning and end of a hypermedia link. They have several optional values which specify either the start or destination of a link or both.

Attributes of <A> tagAttributes FunctionsNAME = " " Specifies name of the section to be linked within the same web

page.HREF = " " Specifies the path of webpage file.TITLE = " " Displays message on a link while mouse over.Targer = '" " Specifies the location where linked document is opened.

a. NAMEIf you want to jump to a specific section within a web page then you have to create an anchor with NAME attribute. It allows the anchor to be the destination of a link. NAME acts as identifier for the anchor. You can use several named anchors in one document, which allow readers to jump directly to their area of interest, in the same page.

Linking DocumentsFollowing is the simple syntax to use <a> tag.<a href="Docum ent URL" ... attributes-list>Link Text</a>Example:Let's try following example which links http://www.tourismnepal.com at your page:<html> <head> <title>Hyperlink Example</title> </head> <body> <p>Click following link</p>

Page 149: Green Computer

Computer Book-9 149GREEN

<a href="http://www.tourismnepal.com" target="_self">Chitwan National Park </a>

</body></html>This will produce following result, where you can click on the link generated Chitwan National Park to reach to the home page of Chitwan National Park.Chitwan National Park

The target AttributeWe have used target attribute in our previous examples. This attribute is used to specify the location where linked document is opened. Following are possible options:Option Description_blank Opens the linked document in a new window or tab._self Opens the linked document in the same frame._parent Opens the linked document in the parent frame._top Opens the linked document in the full body of the window.targetframe Opens the linked document in a named targetframe.Try following example to understand basic difference in few options given for target attribute.

Example:<html> <head> <title>Hyperlink Example</title> <base href="http://www.

tourismnepal.com /"> </head> <body> <p>Click any of the following links</p> <a href="/html/index.htm " target="_blank"> New page</a> | <a href="/html/index.htm " target="_self">Home page</a> | <a href="/html/index.htm " target="_parent">Open in Parent</a> | <a href="/html/index.htm " target="_top">Opens in Body</a> </body></html>

Page 150: Green Computer

GREEN Computer Book-9150

This will produce following result, where you can click on different links to understand the difference between various options given for target attribute.Click any of the following linksNew page | Home page | Opens in Parent | Opens in Body

TablesTable is the best tool for organizing data in rows and columns. In HTML a table comprises three basic elements. They are table itself, the table rows and the table columns. So, while working with tables, there are four tags you need to burn into your memory.1. <TABLE> …………….. </TABLE> This tag is the main tag used to create a table.2. <TH> </TH> This tag is used to define the table heading.3. <TR> </TR> This tag is used to define a horizontal row.4. <TD> </TD>Each row may be further divided into cells. The tag is used to define cells (or columns) in a row. The <TD> tags always appear within <TR> tags, which in turn are always sandwiched between the <TABLE> and </TABLE> tags.So let’s create a simple table with two rows and three columns:

Page 151: Green Computer

Computer Book-9 151GREEN

Tables BackgroundsYou can set table background using one of the following two ways:bgcolour attribute - You can set background colour for whole table or just for one cell.background attribute - You can set background image for whole table or just for one cell.You can also set border colour also using bordercolour attribute.Example:

Try it and observe the output

Table Height and WidthYou can set a table width and height using width and height attributes. You can specify table width or height in terms of pixels or in terms of percentage of available screen area.

Page 152: Green Computer

GREEN Computer Book-9152

Example:<html> <head> <title>HTML Table Width/Height</title> </head> <body> <table border="1" width="400" height="150"> <tr> <td>Row 1, Colum n 1</td> <td>Row 1, Colum n 2</td> </tr> <tr> <td>Row 2, Colum n 1</td> <td>Row 2, Colum n 2</td> </tr> </table> </body></html>

Table CaptionThe caption tag will serve as a title or explanation for the table and it shows up at the top of the table. This tag is deprecated in newer version of HTML/XHTML.

Page 153: Green Computer

Computer Book-9 153GREEN

Example:

MarqueeAn HTML marquee is a scrolling piece of text displayed either horizontally across or vertically down your webpage depending on the settings. This is created by using HTML <marquees> tag.SyntaxA simple syntax to use HTML <marquee> tag is as follows:<marquee attribute_name="attribute_value"....more attributes>Text or image to be scrolled</marquee>

The <marquee> Tag AttributesFollowing is the list of important attributes which can be used with <marquee> tag.Attribute Descriptionwidth This specifies the width of the marquee. This can be a value

like 10 or 20%, etc.height This specifies the height of the marquee. This can be a value

like 10 or 20%, etc.direction This specifies the direction in which marquee should scroll.

This can be a value like up, down, left or right.

Page 154: Green Computer

GREEN Computer Book-9154

behavior This specifies the type of scrolling of the marquee. This can have a value like scroll, slide and alternate.

Scrolldelay This specifies how long to delay between each jump. This will have a value like 10 etc.

Scrollamount This specifies the speed of marquee text. This can have a value like 10 etc.

loop This specifies how many times to loop. The default value is INFINITE, which means that the marquee loops endlessly.

bgcolour This specifies background colour in terms of colour name or colour hex value.

hspace This specifies horizontal space around the marquee. This can be a value like 10 or 20%, etc.

vspace This specifies vertical space around the marquee. This can be a value like 10 or 20%, etc.

Observe the output of the following:Example: 1<html> <head> <title>HTML marquee Tag</title> </head> <body> <marquee> I Love My Country Nepal </marquee> </body></htmlExample: 2<html> <head> <title>HTML marquee Tag</title> </head> <body bgcolour =”yellow” > <marquee width="50%">This example will take only 50% width</

marquee></body></html>

Page 155: Green Computer

Computer Book-9 155GREEN

Example: 3<html> <head> <title>HTML marquee Tag</title> </head> <body>

<marquee direction="right">This text will scroll from left to right</marquee>

</body></html>Example: 4<html> <head> <title>HTML marquee Tag</title> </head> <body>

<marquee direction="up">This text will scroll from bottom to up</marquee>

</body></html>

HTML FormsHTML forms are used to pass data to a server. A form can contain input elements like text fields, checkboxes, radio-buttons, submit buttons and more. A form can also contain select lists, textarea, fieldset, legend, and label elements.The <form> tag is used to create an HTML form are:< form>input elements< /form>

The Input ElementThe most important form element is the input element. It is used to select user information.

Page 156: Green Computer

GREEN Computer Book-9156

It can vary in many ways, depending on the type attribute. An input element can be of type text field, checkbox, password, radio button, submit button, and more.The most used input types are described below.

Text Fields<input type="text" /> defines a one-line input field that a user can enter text into:

The form itself is not visible. Also note that the default width of a text field is 20 characters.

Password Field<input type="password" /> defines a password field:

Radio Buttons<input type="radio" /> defines a radio button. Radio buttons let a user select only one one of a limited number of choices:

Page 157: Green Computer

Computer Book-9 157GREEN

Checkboxes<input type="checkbox" /> defines a checkbox. Checkboxes let a user select one or more options of a limited number of choices.

Submit Button<input type="submit" /> defines a submit button. A submit button is used to send data entered in form to a server. The data is sent to the page specified in the form's action attribute. The file defined in the action attribute usually does something with the received input:< form name="input" action="html_form_action.asp" method="get">Username:< input type="text" name="user" />< input type="submit" value="Submit" />< /form>

Page 158: Green Computer

GREEN Computer Book-9158

If you type some characters in the text field above, and click the "Submit" button, the browser will send your input to a page called "html_form_action.asp". The page will show you received input.

Some commonly used HTML TagsTAGS ATTRIBUTES FUNCTIONS

<BODY></BODY> BGColour = " " Changes the colour of the body backgroundBACKGROUND = " " Sets a picture as body background.TOPMARGIN = " " Sets the top margin of a page.BOTTOMMARGIN = " " Sets the bottom margin of a page.BOTTOMMARGIN = " " Sets the bottom margin of a page.LEFTMARGIN = “ ” Sets the left margin of a page.

<HR> SIZE = " " Lets to set the size of the horizontal line in pixels or percentage.

WIDTH = " " Sets the width of the horizontal line in pixels.Colour = " " Sets the colour of the line.ALIGN = " " Sets the alignments of the line in the page to left,

right or center.<BR> Moves the text to a new line.<P> ALIGN = " " Sets the alignment of text in a paragraph to left,

right, center or justify.<!> Sets comments or remarks.<FONT> </FONT> FACE = " " Sets the font style of text.

SIZE = " " Sets the font size of text.Colour = " " Sets the font colour of text.

Page 159: Green Computer

Computer Book-9 159GREEN

<IMG> </IMG> SRC = " " Sets the path of a picture.ALIGN = " " Sets the alignment for a picture to left, right or

center.BORDER = " " Sets the border of a picture.HEIGHT = " " Sets height of a picture.WIDTH = " " Sets width of a picture.ALT = " " Displays text incase image is not displayed by the

user.<OL> </OL> TYPE = " "

START = " "<UL> TYPE = " " Declares type of bulleted list as fill round, disc,

square, circle etc.<LI> </LI> Defines item list within a cell.<TABLE> </TABLE> Inserts a table into a web document.

BORDER = " " Sets the width of shaded border around a table.BORDERColour = " " Sets the colour of the border.CELLSPACING = " " Defines the amount of space between the cells in a

table.CELLPADDING = " " Defines the amount of space between the edges of

the cell and its content.HEIGHT = " " Sets the height of a table.WIDTH = " " Sets the width of a table.

<TR> </TR> Defines a table row.Align = " " Sets alignment to left, right or center.BACKGROUND = " " Sets background picture for a cell.BGColour = " " Sets background colour for a cell.BORDERColour = " " Sets the border colour of a cell.

<TH> Sets the Table heading.<TD> </TD> Defines a cell containing data.

ALIGN = " " Sets the alignment of text inside the cell to left, right or center.

VALIGN = " " Sets the vertical alignment of text in the cell to top, middle or bottom.

BACKGROUND = " " Sets background picture for a cell.BGColour = " " Sets background colour for a cell.COLSPAN = " " Combines number of columns together.ROWSPAN = " " Combines number of rows together.BORDERColour = " " Sets border colour of a cell.

Page 160: Green Computer

GREEN Computer Book-9160

<A> </A> Creates a link with other document/s or within a same page.

HREF = " " Specifies the path of webpage file.NAME = " " Specifies name of the section to be linked within the

same web page.TITLE = " " Displays message on a link while Mouse over.

<MARQUEE>

</MARQUE>

Scrolls text around a page.BEHAVIOR = " " Sets movement behavior of text as alternate, scroll

or slide.DIRECTION = " " Sets the direction of marquee text movement, left

or right.BGColour = " " Sets background colour for marquee text.

Cascading Style Sheets (CSS)CSS is the language for describing the presentation of Web pages, including colors, layout, and fonts. It allows one to adapt the presentation to different types of devices, such as large screens, small screens, or printers. CSS is independent of HTML and can be used with any XML(Extensible Markup Language)-based markup language. The separation of HTML from CSS makes it easier to maintain sites, share style sheets across pages, and tailor pages to different environments.CSS helps Web developers create a uniform look across several pages of a Web site. Instead of defining the style of each table and each block of text within a page’s HTML, commonly used styles need to be defined only once in a CSS document. Once the style is defined in cascading style sheet, it can be used by any page that references the CSS file. Plus, CSS makes it easy to change styles across several pages at once. For example, a Web developer may want to increase the default text size from 10pt to 12pt for fifty pages of a Web site.

Stylesheets can do three things:

1. Set the font of text on a page2. Define a layer and position it on the page3. Modify HTML tags

DHTML(Dynamic Hypertext Markup Language)DHTML stands for Dynamic HTML, it is totally different from HTML. The browsers which support the dynamic HTML are some of the versions of Netscape Navigator and Internet Explorer of version higher than 4.0. The

Page 161: Green Computer

Computer Book-9 161GREEN

DHTML is based on the properties of the HTML, javascript, CSS, and DOM (Document Object Model which is used to access individual elements of a document) which helps in making dynamic content. It is the combination of HTML, CSS, JS, and DOM. The DHTML make use of Dynamic object model to make changes in settings and also in properties and methods. It also makes uses of Scripting and it is also part of earlier computing trends.DHTML allows different scripting languages in a web page to change their variables, which enhance the effects, looks and many others functions after the whole page have been fully loaded or under a view process, or otherwise static HTML pages on the same.

Syntax:

<Style Type= “text/css”>Tag{ attribute: value ; attributes: value…..}</Style>

CSS Fonts

CSS Fonts is a module of CSS that defines font-related properties and how font resources are loaded. It lets you define the style of a font, such as its family, size and weight, line height, and the glyph variants to use when multiple are available for a single character.The CSS color property defines the text color to be used.The CSS font-family property defines the font to be used.The CSS font-size property defines the text size to be used.The CSS font-style property is used to make a font italic or oblique.Example:<html><head><style>h1 { color: red; font-family: verdana; font-size: 300%;

Page 162: Green Computer

GREEN Computer Book-9162

}p { color: green; font-family: courier; font-size: 160%;}</style></head><body><h1>What is CSS</h1><p>Introduction of Cascading Style Sheet</p>

</body></html>

CSS BorderThe border properties allow you to specify how the border of the box representing an element should look. There are three properties of a border you can change:• The border-color specifies the color of a border.• The border-style specifies whether a border should be solid, dashed line,

double line, or one of the other possible values.• The border-width specifies the width of a border.

The border-color PropertyThe border-color property allows you to change the color of the border surrounding an element. You can individually change the color of the bottom, left, top and right sides of an element’s border using the properties −• border-bottom-color changes the color of bottom border.• border-top-color changes the color of top border.• border-left-color changes the color of left border.

Page 163: Green Computer

Computer Book-9 163GREEN

• border-right-color changes the color of right border.The following example shows the effect of all these properties :<html> <head> <style type = “text/css”> p.example1 { border:1px solid; border-bottom-color:#009900; /* Green */ border-top-color:#FF0000; /* Red */ border-left-color:#330000; /* Black */ border-right-color:#0000CC; /* Blue */ } p.example2 { border:1px solid; border-color:#009900; /* Green */ } </style> </head>

<body> <p class = “example1”> This example is showing all borders in different colors. </p> <p class = “example2”> This example is showing all borders in green color only. </p> </body></html>

Page 164: Green Computer

GREEN Computer Book-9164

CSS Styling Link

Links can be styled with any CSS property (e.g. color, font-family, background, etc.).Example

a { color: hotpink;}The four links states are:• a:link - a normal, unvisited link• a:visited - a link the user has visited• a:hover - a link when the user mouses over it• a:active - a link the moment it is clickedExample

/* unvisited link */a:link { color: red;}

/* visited link */a:visited { color: green;}

/* mouse over link */a:hover { color: hotpink;}

/* selected link */

Page 165: Green Computer

Computer Book-9 165GREEN

a:active { color: blue;}

Types of CSS Cascading Style Sheet(CSS) is used to set the style in web pages which contain HTML elements. It sets the background color, font-size, font-family, color etc property of elements in a web pages.There are three types of CSS which are given below:• Inline CSS• Internal or Embedded CSS• External CSS

Inline CSS

Inline CSS contains the CSS property in the body section attached with element is known as inline CSS. This kind of style is specified within an HTML tag using style attribute.<!DOCTYPE html> <html> <head> <title>An example of Inline CSS</title> </head> <body> <p style = “color:#009900; font-size:50px; font-style:italic; text-align:center;”> I Love Nepal </p> </body> </html>

Page 166: Green Computer

GREEN Computer Book-9166

Internal or Embedded CSS

This can be used when a single HTML document must be styled uniquely. The CSS rule set should be within the HTML file in the head section i.e the CSS is embedded within the HTML file.<!DOCTYPE html> <html> <head> <title>an example of Internal CSS</title> <style> .main { text-align:center; } .pps { color:#009900; font-size:50px; font-weight:bold; } .rock { font-style:bold; font-size:20px; } </style> </head> <body> <div class = “main”> <div class =”pps”>I love flowers</div> <div class =”rock”> A beautiful girl </div>

Page 167: Green Computer

Computer Book-9 167GREEN

</div> </body> </html>

External CSSExternal CSS contains separate CSS file which contains only style property with the help of tag attributes (For example class, id, heading etc). CSS property written in a separate file with .css extension and should be linked to the HTML document using link tag. This means that for each element, style can be set only once and that will be applied across web pages.Example:

The file given below contains CSS property. This file save with .css extension. For Ex: external.cssbody { background-color:powderblue;}.main { text-align:center; }.pps { color:#009900; font-size:50px; font-weight:bold;}#rock { font-style:bold; font-size:20px;}

Step 1:

• Open Notepad and type the following CSS code

Page 168: Green Computer

GREEN Computer Book-9168

• Save the CSS code in test1.CSS

body{ background-color: orange;} p { color: blue; } h3{ color: white; }

Step 2:

• Create HTML document using CSS code in Notepad• Type the following code and use test1.CSS In HTML document.• Open any browser

<html><head><link rel=”stylesheet” type=”text/css” href=”test1.css”></head><body><h1>Visit Nepal2020</h1><h3> Tourism Nepal </h3><p> Nepal is one of the beautiful country in the World. </p></body></html>

Quick Review

1. HTML is a Markup Language which means you use HTML to simply "mark up" a text document with tags that tell a Web browser how to structure it to display.

2. HTML Tags are the instructions which are used to create HTML document that can be opened by the browsers and by other agents worldwide if uploaded in WWW.

3. Attributes are the additional instructions that further define the behavior of the element.

Page 169: Green Computer

Computer Book-9 169GREEN

4. The BODY of the document contains the actual information.5. On a web page, text flows continuously across the page regardless of

carriage returns or white spaces in the html code.6. Table is the best tool for organizing data in rows and columns.7. A horizontal rule is a dividing line placed across the page of the document.8. An input element can be of type text field, checkbox, password, radio

button, submit button, and more.9. Links or hyperlinks are the most important part of the World Wide Web.10. Radio buttons let a user select only one of a limited number of choice.11. A form can contain input elements like text fields, checkboxes, radio-

buttons, submit buttons and more.12. A submit button is used to send data entered in form to a server.13. <HEAD> tag defines the information that would appear in the header

section of documents.14. <TITLE> tag displays the title text on the Title bar of browser’s window.15. Checkboxes let a user select one or more. Options of a limited number of

choice.

Exercise1. Answer the following questions:

a. What do you know about HTML?b. What is Website. Give an example.c. What is web browser? Give an example.d. Define the terms upload and download.e. What is the difference between tag and attributes?f. Write importance of BODY tag in HTML.g. What is the use of <IMG> tag?h. How can we put link in a web page?i. What is the use of <TABLE> tag?j. Differentiate between <OL> and <UL> tag.k. What is tag in HTML? Write its type.

l. What is Cascade Style Sheet? What can it do? m. What is CSS font? List its property.

Page 170: Green Computer

GREEN Computer Book-9170

n. What is CSS border? Write its property. o. List out the property of CSS style links states. p. Explain the types of Css with example.2. What are the following tags used for in HTML?

a. <FONT>b. <TABLE>c. <TR>d. <TD>e. <BR>f. <HR>g. <TH>

3. State whether the following statements are TRUE or FALSE:a. The horizontal rule tag is used to break a text in a paragraph.b. Container tags are the ones which have only Start tag.c. MARQUEE tag scrolls text top to button only.d. The head section specifies the main content of an HTML document.e. There are six levels of headings in HTML.

4. Fill in the blanks with the correct option:a. HTML stands for .....................b. All HTML tags are enclosed within .................... and ....................

brackets.c. Internet Explorer is a .....................d. The three types of lists that can be inserted in HTML are ....................,

.................... and ....................e. We can insert images in an HTML document by using the .............tag.f. We use .................... tag to link to another document.g. .................... elements allow you to group together several elements to

create sections or subsections of a page.5. Write short notes on the following terms

a. Search engine

Page 171: Green Computer

Computer Book-9 171GREEN

b. Web clientc. Web server d. Hyperlink

2. Write full form of the following

CSS DHTML DOM XML

LAB Practice11. Let us try the solved example. Type the following codes in notepad:

<html> <head> <title>festival</title> </head> <body> <table width="100%" border="0" height="100%"> <tr height="25%"> <td colspan="2" bgcolour="#FFA500"> <h1>I love Nepal</h1> </td> </tr> <tr height="50%" valign="top"> <td bgcolour="#FFD700" width="100px" align="top"> <a href="page3.htm">Mountains<br/></a> <a href="page4.htm">Himalaya<br/></a> Festivals<br/></a> <a href="page5.htm">Tourism</a><br> <a href="page6.htm">Photo Gallery</a> </td> <td bgcolour="#EEEEEE" height="200px" width="400px" align="top"> <h4> Festivals of Nepal </h4>

Page 172: Green Computer

GREEN Computer Book-9172

<OL> <a href="Dashain.htm"><li>Dashain</a> <li>Tihar <a href="Chhath.htm"><li>Lhosar</a> <li>Udhauli Uvauli <li>Holi <li>Teej <li>Dipawali <li>Bakar Id </ol></td> </tr> <tr height="15%"> <td colspan="2" bgcolour="#FFA500" align="center"> Copyright ©</td> </tr> </table></body></html>

6. Multiple Choice Questions 1. What does HTML stand for?

a. Hyper Text Markup Language b. Home Tool Markup Language c. Hyperlinks and Text Markup Language

2. Who is making the Web standards? a. Mozilla b. Microsoft c. The World Wide Web Consortium (W3C)

3. Choose the correct HTML tag for the largest heading. a. <h6> b. <heading> c. <h1> d. <head>

Page 173: Green Computer

Computer Book-9 173GREEN

4. What is the correct HTML tag for inserting a line break? a. <break /> b. <lb /> c. <br />

5. What is the correct HTML tag for adding a background colour? a. <body style="background-colour:yellow"> b. <background>yellow</background> c. <body background="yellow">

6. Choose the correct HTML tag to make a text bold. a. <bold> b. <b> c. <bo>

7. Choose the correct HTML tag to make a text italic. a. <italic> b. <i> c. </>

8. What is the correct HTML for creating a hyperlink? a. <a url="http://www.w3schools.com">W3Schools.com</a> b. <a href="http://www.w3schools.com">W3Schools</a> c. <a name="http://www.w3schools.com">W3Schools.com</a> d. <a>http://www.w3schools.com</a>

9. How can you create an e-mail link? a. <a href="mailto:xxx@yyy"> b. <a href="xxx@yyy"> c. <mail href="xxx@yyy"> d. <mail>xxx@yyy</mail>

10. How can you open a link in a new browser window? a. <a href="url" new> b. <a href="url" target="new"> c. <a href="url" target="_blank">

11. Which of these tags are all <table> tags? a. <table><head><tfoot> b. <table><tr><td> c. <thead><body><tr> d. <table><tr><tt>

Page 174: Green Computer

GREEN Computer Book-9174

12. Choose the correct HTML to left-align the content inside a table cell. a. <tdleft> b. <td align="left"> c. <td leftalign> d. <td valign="left">

13. How can you make a list that lists the items with numbers? a. <dl> b. <list> c. <ol> d. <ul>

14. How can you make a list that lists the items with bullets? a. <ol> b. <list> c. <dl> d. <ul>

15. What is the correct HTML for making a checkbox? a. <checkbox> b. <input type="checkbox" /> c. <input type="check" /> d. <check>

16. What is the correct HTML for making a text input field? a. <textinput type="text" /> b. <input type="textfield" /> c. <textfield> d. <input type="text" />

17. What is the correct HTML for making a drop-down list? a. <input type="dropdown" /> b. <list> c. <input type="list" /> d. <select>

18. What is the correct HTML for making a text area? a. <input type="textbox" /> b. <input type="textarea" /> c. <textarea>

19. What is the correct HTML for inserting an image?

Page 175: Green Computer

Computer Book-9 175GREEN

a. <image src="image.gif" /> b. <img src="image.gif" /> c. <img href="image.gif /> d. <img>image.gif</img>

20. What is the correct HTML for inserting a background image? a. <background img="background.gif"> b. <body background="background.gif"> c. <img src="background.gif" background />

Practical questions1. Write HTML tags to create table and enter some data.2. Write HTML tags to display data in order list.3. Write HTML tags to display data in unorder list.4. Prepare a webpage to describe your school.5. Prepare a webpage to describe about Dahain festival.6. Prepare a webpage to describe the beautiful places of Nepal. Use

hyperlink and images in the webpage.7. Prepare your personal webpage.

Practical<HTML>

<HEAD>

<TITLE> Text Attributes using css </TITLE>

<style type = “text/css”>

H1 {font-family:arial, helvetica; font-size:26pt; text-decoration:blink; color:red}

P {font-size:12pt; font-style:normal; font-weight:bold;color:#23238e;}

H6 {font-size:12pt; font-style:italic; font-weight:bold;color:#23238e; text-align:justify; text-indent:.5in}

a:hover{background:green;color:yellow}

Page 176: Green Computer

GREEN Computer Book-9176

</STYLE>

</HEAD>

<BODY >

<H1> Bhaktapur Durbar Square</H1>

<table border=”1” width =”50%”>

<tr>

<th><a href=”abc.html”>Home</a>

<th><a href=”bbc.html”>About Us</a>

<th><a href=”ccc.html”>contact Us</a>

<th><a href=”ddd.html”>Galary</a>

</tr>

</table>

<B><U> Overview</U></B>

<P> The ancient city Bhaktapur lies on the Eastern part of Kathmandu valley which is also known as Bhadgaon or Khwopa. The historical monument on around signifies medieval age culture and tradition of Nepal and this old city is inhabited by indigenous Newari people in large group. you can visit to this place to experience Nepali culture,tradition,religion from right way.we are here to support you for your tours.</P>

<B><U> Janaki Mandir</U></B>

<H6> Dedicated to Goddess Sita, Janaki Mandir is the biggest temple in Nepal. The dominant tourist attraction of Janakpur is constructed at the place where Goddess Sita was born. The attraction is now considered as a religiously important monument and a heritage site but is still an active temple for devotees. Anybody seeking a slice of the legend of Ramayana must visit the divine Janaki Temple. </H6>

<h1> Thank you very much</h1>

</BODY>

</HTML>

Page 177: Green Computer

Computer Book-9 177GREEN

Internet and Web Technology

10

IntroductionThe concept of Internet originated in 1969 and has since undergone several technological & infrastructural changes. The origin of Internet was devised from the concept of Advanced Research Project Agency Network (ARPANET). ARPANET was developed by the United States Department of Defense. The basic purpose of ARPANET was to provide communication among the various bodies of government. Initially, there were only four nodes, formally called Hosts. In 1972, the ARPANET spread over the globe with 23 nodes located at different countries and thus became known as Internet.January 1, 1983 is considered the official birthday of the Internet. Prior to this, the various computer networks did not have a standard way to communicate with each other. A new communications protocol was established called the Transmission Control Protocol/Internet Protocol (TCP/IP). This allowed different kinds of computers on different networks to “talk” to each other. ARPANET and the Defense Data Network officially changed to the TCP/IP standard on January 1, 1983, hence the birth of the Internet. All networks could now be connected by a universal language.By the time, with invention of new technologies such as TCP/IP protocols, DNS, WWW, browsers, scripting languages, etc., Internet provided a medium to publish and access information over the web.The Internet is a global system of interconnected computer networks that use the standard Internet protocol suit (TCP/IP) to serve billions of users worldwide. We can use it to connect people, communities, and countries around the world. It is a network of networks that consists of millions of public, private, academic, business, and government networks of local and global scope. The Internet carries an extensive range of information resources and services such as the interlinked hypertext documents of the World Wide Web (WWW) and the infrastructure to support email. You can think about the Internet as a

Page 178: Green Computer

GREEN Computer Book-9178

physical collection of routers and circuits as a set of shared resources or even as an attitude about interconnecting and intercommunication.

Characteristics of Internet:• Internet is a world-wide/global system of interconnected computer

networks.• Internet uses the standard Internet Protocol (TCP/IP).• Every computer in Internet is identified by a unique IP address.• IP address is a unique set of numbers (such as 110.22.33.114) which

identifies a computer ’s location.• A special computer DNS (Domain Name Server) is used to give name to

the IP address so that user can locate a computer by a name.• Internet is accessible to every user all over the world.

Advantages of Internet• The Internet has made it easy for people to communicate with others

because it is cheap and convenient. • The Internet is source of information about anything and everything.• You can easily share share music, videos and any other files instantly

using social media sites such as Facebook or an IM appWhatsApp, Viber .• Students can search their required information from Internet. They can

learn many things online any where any time. • You can transfer funds, pay taxes and utility bills or book.• Movie tickets over the Internet in the comfort of your office or home.• You can watch movies, listen to music, read your favorite celebrity gossip

columns and play games over the Internet.

Disadvantages of Internet• Sending of unwanted and useless emails to random people.• Hackers attack a computer with the sole intent of causing harm. • Leakage of Private Information.• Internet addiction led to some diseases like carpal tunnel syndrome.• Virus, Trojan & Other Malware are malicious programs that transfer to

your computer with downloaded file.

Page 179: Green Computer

Computer Book-9 179GREEN

Web BrowserA web browser is a software application that allows you to access websites and view web pages once you are connected to the Internet. software application used to locate, retrieve and display content on the World Wide Web, including webpages, images, video and other files. Today’s browsers are fully-functional software suites that can interpret and display HTML Webpages, applications, JavaScript, AJAX and other content hosted on web servers.

Some useful web Browser are• Google Chrome • Mozilla Firefox• Opera Web Browser • Safari Web Browser• Internet Explorer• UC Browser• Microsoft Edge

Search EngineInternet is one of the biggest libraries in the world. Search engine helps you to search a piece of information from the Internet. When you are looking for a site whose address you don’t know, you can search for it using a search engine. A search engine will scan through thousands of websites and web pages on the Internet and collect and organize the information it thinks is most relevant to you. It is a tool that searches documents for specific keyword, phrase, data, etc. via WWW.Some of the most popular search engines are:• Google www.google.com• Yahoo www.yahoo.com• Bing www.bing.com

Page 180: Green Computer

GREEN Computer Book-9180

Uploading: Uploading means data is being sent from your computer to the Internet. Examples of uploading include sending email, posting photos on a social media site and using your webcam. Even clicking on a link on a web page sends a tiny data upload.

Downloading: Downloading is the process of copying data from Internet to your computer.it means your computer is receiving different types of program, files, folders from Internet.

Web serverA web server is a computer that runs websites. It’s a computer program that distributes web pages as they are requisitioned. The basic objective of the web server is to store, process and deliver web pages to the users. These web pages are mostly static content that includes HTML documents, images, style sheets, and java script files etc. Apart from HTTP, a web server also supports SMTP (Simple Mail transfer Protocol) and FTP (File Transfer Protocol) protocol for emailing and for file transfer and storage.The Intercommunication between web server and web browser is done using Hypertext Transfer Protocol (HTTP) using port 80.

Client Web Server Database

Page 181: Green Computer

Computer Book-9 181GREEN

Functions of web server• Sending and receiving emails.• Downloading requests for File Transfer Protocol (FTP) files. • Building and publishing Web pages.• Storing, processing and delivering webpages to the user.Some of the popular webserver that allows to response the clients requests:• Internet Information Sever (IIS)• Aache• XAMP• WAMP

URLA URL (Uniform Resource Locator), as the name suggests, provides a way to locate a resource on the web, the hypertext system that operates over the Internet. The URL contains the name of the protocol to be used to access the resource and the resource name. The first part of a URL identifies what protocol to use and the second part identifies the IP address or domain name where the resource is located. A URL is the most common type of Uniform Resource Identifier (URI). URIs are strings of characters used to identify a resource over a network.

Web pages and Home pagesWeb page is a collection of text, images, graphics, videos and animations arranged in systematic way and provides the information about a subject. The very first page which we get while visiting the website is known as home page. All the links are provided from the home page to other pages.

Page 182: Green Computer

GREEN Computer Book-9182

Web siteA website is a collection of publicly accessible, interlinked Web pages that share a single domain name. Websites can be created and maintained by an individual, group, business or organization to serve a variety of purposes. Together, all publicly accessible websites constitute the World Wide Web. For example www.greenbooks.com.np is a website of Green books Publication which provides various information.

DNS ServerA DNS server is a computer server that contains a database of public IP addresses and their associated hostnames. The Domain Name System (DNS) is the phonebook of the Internet. When users type domain names such as ‘google.com’ into web browsers, DNS is responsible for finding the correct IP address for those sites. Browsers then use that addresses to communicate with origin servers or CDN edge servers to access website information.

ISPISP stands for Internet Service Provider. They are the companies who provide you service in terms of Internet connection to connect to the Internet. You will buy space on a Web Server from any Internet Service Provider. This space will be used to host your Web site.

Web HostingA web host or web hosting service provider is a business that provides technologies and services need for the website or webpages to be viewed the Internet. Websites are hosted or stored on special computers called serv

Page 183: Green Computer

Computer Book-9 183GREEN

Web SpaceThe web space, also known as storage space or disk space, generally refers the amount of space on a web server that is allocated to website owners by web hosting companies.

Web LinkA link from a hypertext file to another location or file; typically activated clicking on a highlighted word or icon at a particular location on the screen hyperlink, hotlink, link.

Web ClientWeb client is a client computer connected to the Internet which runs special software called a browser that allows them to:• connect to an appropriate server.• query the server for the information to be read.• provides an interface to read the informations returned by the server.

IOT (Internet of Things)The Internet of Things (IoT) describes the network of physical objects (things) that are embedded with sensors, software, and other technologies for the purpose of connecting and exchanging data with other devices and systems over the internet. These devices range from ordinary household objects to sophisticated industrial tools. The Internet of things (IoT) is a system of interrelated computing devices, mechanical and digital machines are provided with unique identifiers (UIDs) and the ability to transfer data over a network without requiring human-to-human or human-to-computer interactionThere are billions of devices in homes, factories, hospitals, cars, and thousands of other places. With the creation of devices, you increasingly need solutions to connect them, and collect, store, and analyze device data. IoT provides broad

Page 184: Green Computer

GREEN Computer Book-9184

and deep functionality, spanning the edge to the cloud. Since IoT integrates with AI services, you can make devices smarter, even without Internet connectivity such as a jet engine that’s now filled with thousands of sensors collecting and transmitting data back to make sure it is operating efficiently. At an even bigger scale, smart cities projects are filling entire regions with sensors to help us understand and control the environment. A lightbulb that can be switched on using a smartphone app is an IoT device, as is a motion sensor or a smart thermostat in your office or a connected streetlight.

Cloud ComputingIn Cloud Computing, the word Cloud means internet. Cloud computing refers to Internet-based computing. In cloud computing, different services like servers, storage, and applications are delivered to an organization’s computers and devices through the Internet.Cloud computing is an on-demand service that has obtained a huge demand in corporate data centers. In cloud services, the data center operates like the Internet and computing resources are accessed and shared as virtual resources in a secure and scalable manner. In a simple description, cloud computing refers to taking services (“cloud services”) and moving them outside an organizations firewall on shared systems. In the cloud system, applications and services are accessed via the web, instead of a computer hard drive. The services are delivered and used over the Internet where a charge is paid by cloud customer typically on an “as-needed, pay-per-use” business model. The benefit is that the cloud infrastructure is managed by the cloud provider, not the individual cloud customer.An increasing number of businesses are rapidly moving their infrastructures to the cloud. The reasons for moving to the cloud include the high-quality security, increasing value of the cloud market, secure backups for data, the ability to access files from anywhere online, and greater scalabilitySome of the international cloud computing services providers Amanoz web server, Microsoft Azure, IMB Cloud. In Nepal Data HUB Pvt. Ltd, Data Space Pvt. Ltd., Siver Lining, Cloud Himalaya are the cloud service providers.

Page 185: Green Computer

Computer Book-9 185GREEN

Types of cloud services: IaaS, PaaS, SaaS, FaaSCloud computing services fall into three categories: Infrastructure as a Service (IaaS), Platform as a Service (PaaS), and Software as a Service (SaaS). These are sometimes called the cloud computing stack, because they build on top of one another.

1. Software-as-a-Service (SaaS)Software-as-a-service (SaaS) is a method for delivering software applications over the Internet as per the demand and on a subscription basis. SaaS helps you host and manage the software application and underlying infrastructure and handle any maintenance (software upgrades and security patching).

2. Platform as a service (PaaS)Platform-as-a-service (PaaS) refers to the supply an on-demand environment for developing, testing, delivering and managing software applications. It is designed to quickly create web or mobile apps, without worrying about setting up or managing the underlying infrastructure of servers, storage, network and databases needed for development.

3. Infrastructure-as-a-Service (IaaS)Infrastructure-as-a-Service (IaaS) refers to the fundamental building blocks of computing that can be rented: physical or virtual servers, storage and networking. This is attractive to companies that want to build applications from the very ground up and want to control nearly all the elements themselves, but it does require firms to have the technical skills to be able to coordinate services at that level..

Quick Review

1. A web browser is a software application that allows you to access websites and view web pages once you are connected to the Internet.

2. Search engine helps you to search a piece of information from the Internet.3. A web server is a computer that runs websites. It’s a computer program

that distributes web pages as they are requisitioned.

SaasApplication

PaasPlatform

IaasInfrastructure

Page 186: Green Computer

GREEN Computer Book-9186

4. A URL (Uniform Resource Locator), as the name suggests, provides a way to locate a resource on the web, the hypertext system that operates over the Internet.

5. A DNS server is a computer server that contains a database of public IP addresses and their associated hostnames.

6. A website is a collection of publicly accessible, interlinked Web pages that share a single domain name.

7. The Internet of Things (IoT) describes the network of physical objects (things) that are embedded with sensors, software, and other technologies for the purpose of connecting and exchanging data with other devices and systems over the internet.

8. Cloud computing refers to Internet-based computing. In cloud computing, different services like servers, storage, and applications are delivered to an organization’s computers and devices through the Internet.

Exercise1. Answer the follwing questions. a. What is Internet? Write Characteristics of Internet. b. Write advantages and disadvantages of Internet c. What is web browser? Give some examples of web browser. d. Define web server. Write its functions. e. What is Internet of Things? Write its importance. f. Define cloud computing. Explain its types.

2. Write short notes on the following. a. DNS Server b. Web client c. Web link d. Web hosting e. ISP f. Website g. URL

Page 187: Green Computer

Computer Book-9 187GREEN

3. Write full form of the following: DNS PaaS IaaS SaaS UID IOT URL FTP HTTP SMTP WWW ARPANET

4. Write technical terms for the following statements:

a. It is a collection of publicly accessible, interlinked Web pages that share a single domain name.

b. It is a client computer connected to the Internet which runs special software called a browser.

c. It is a computer server that contains a database of public IP addresses and their associated hostnames.

d. It is is a collection of text, images, graphics, videos and animations arranged in systematic way and provides the information about a subject.

e. It contains the name of the protocol to be used to access the resource and the resource name.

5. Match the following: a. Website i. Protocol b. IaaS ii. copying file from Internet c. IOT iii. fundamental building blocks of computing d. HTTP iv. collection of webpages e. URL v. find piece of information on Internet f. Search engine vi. Uniform Resource Locator g. Downloading vii. The Internet of things (IoT) is a system of

interrelated computing devices

6. Tick the correct answer.

a. Which one is not a web browser? i. Mozilla firefox ii. Google Chrome iii. Gmail iv. Internet Explorer

Page 188: Green Computer

GREEN Computer Book-9188

b. Which one is protocol? i. URL ii. DNS iii. URI iv. FTP c. Which one is not a search engine? i. www.google.com ii. www.bing.com iii. www.greenbooks.com.np iv. www.ask.com www.greenbooks.com.npd. Which one is the main page of website? i. Web Page ii. Cover Page iii. Mid Page iv. Home Pagee. The companies who provide you service in terms of Internet

connection to connect to the Internet. i. URL ii. www iii. ISP iv. DNS

Page 189: Green Computer

Computer Book-9 189GREEN

Programming Concept11

IntroductionComputer programs are collections of instructions that tell a computer how to interact with the user, interact with the computer hardware and process data. The first programmable computers required the programers to write explicit instructions to directly manipulate the hardware of the computer. This “machine language” was very tedious to write by hand since even simple tasks such as printing some output on the screen require 10 or 20 machine language commands. Machine language is often referred to as a “low level language” since the code directly manipulates the hardware of the computer.

ProgramA program is a set of instructions following the rules of the chosen language. Without programs, computers are useless. A program is like a recipe. It contains a list of ingredients (called variables) and a list of directions (called statements) that tell the computer what to do with the variables. Today computer programs are being used in almost every field, household, agriculture, medical, entertainment, defense, communication, etc.

ProgrammingIf you understood what a computer program is, then we will say: the act of

Page 190: Green Computer

GREEN Computer Book-9190

writing computer programs is called computer programming.As we mentioned earlier, there are hundreds of programming languages, which can be used to write computer programs and following are a few of them −• Java• C• C++• Python• PHP• Perl• Ruby

ProgramerA programer is someone who writes computer program. Computer programers write, test, and maintain programs or software that tell the computer what to do. A programer needs to follow defined rules and regulations of statement while writing a program. These set of rules of computer language are called syntaxes. Based on computer programming language expertise, we can name a computer programers as follows −• C Programer• C++ Programer• Java Programer• Python Programer• PHP Programer• Perl Programer• Ruby Programer

Programming LanguageThe language, which is used to write programs to communicate with computer is called programming language. As we know, computer programs are collections of instructions that tell a computer how to interact with the user, interact with the computer hardware and process data. A programming language consists of a set of characters, symbols and rules that allow a user to

Page 191: Green Computer

Computer Book-9 191GREEN

write programs to communicate with computers. A programer needs to follow these set of rules while writing a program. Each programming language having its own set of rule is called syntax.

Two different models of programming. Structured programming; blocks of programming statements (code) are executed one after another. Control statements change which blocks of code are executed next.Object oriented programming; data are contained in objects and are accessed using special methods (blocks of code) specific to the type of object. There is no single “flow” of the program as objects can freely interact with one another by passing messages.

Generations of Programming Language• The first generation languages, or 1GL, are low-level languages that are

machine language.• The second generation languages, or 2GL, are also low-level languages

that generally consist of assembly languages.• The third generation languages, or 3GL, are high-level languages such as C• The fourth generation languages, or 4GL, are languages that consist of

statements similar to statements in a human language. Fourth generation languages are commonly used in database programming and scripts.

• The fifth generation languages, or 5GL, are programming languages that contain visual tools to help develop a program. A good example of a fifth generation language is Visual Basic.

Types of Programming LanguageThere are three types of programming language:1. Machine language (Low-level language)2. Assembly language (Low-level language)3. High-level language

Machine LanguageMachine language is a collection of binary digits or bits that the computer reads and interprets.

Page 192: Green Computer

GREEN Computer Book-9192

Machine languages are the only languages understood by computers. It is easily understood by computers, but it is almost impossible for humans to use machine language because they consist entirely of binary numbers.

Machine Instruction Machine Operation0000 0000 Stop0000 0001 Rotate bristles left0000 0010 Rotate bristles right0000 0100 Go back to start of program0000 1000 Skip next instruction if switch is off

Assembly LanguageA program written in assembly language consists of a series of instructions mnemonics that correspond to a stream of executable instructions, when translated by an assembler, that can be loaded into memory and executed.Assembly languages use keywords and symbols, much like English, to form a programming language but at the same time introduce a new problem.Example:Assembly language :mov a1, #061hMeaning:Move the hexadecimal value 61 (97 decimal) into the processor register named "a1".Since, this language is not directly understood by the computer, the program written in this language needs to be translated into machine language by a translator called Assembler.Assembler: It translates the program written in assembly language into

machine language.

Source code Assembler Object code

High Level LanguageHigh-level languages allow us to write computer code using instructions resembling everyday spoken language (for example: print, if, while) which are then translated into machine language to be executed. Programs written in

Page 193: Green Computer

Computer Book-9 193GREEN

a high-level language need to be translated into machine language before they can be executed. Some programming languages use a compiler to perform this translation and others use an interpreter.

Examples of High-level Language:

• ADA

• C

• C++

• JAVA

• BASIC

• COBOL

• PASCAL, etc.

Interpreter: It translates program written in high level language into machine language. It translate the program code one after another.

Source code Assembler Object code

• Interpreter is a program that executes instructions written in a high-level language.

• An interpreter reads the source code one instruction or line at a time, converts this line into machine code and executes it.

Compiler: It translates program written in high level language into machine language. It translates the whole program at once.

Source code Assembler Object code

• Compiler is to transform a program written in a high-level programming language from source code into object code.

• A compiler reads the whole source code and translates it into a complete machine code program to perform the required tasks which is output as a new file.

Page 194: Green Computer

GREEN Computer Book-9194

ComparisonMachine Language Assembly Language High-level

Languages

Time to execute

Since it is the basic language of the computer, it does not require any translation, and hence ensures better machine efficiency. This means the programs run faster.

A program called an ‘assembler’ is required to convert the program into machine language. Thus, it takes longer to execute than a machine language program.

A program called a compiler or interpreter is required to convert the program into machine language. Thus, it takes more time for a computer to execute.

Time to develop

Needs a lot of skill, as instructions are very lengthy and complex. Thus, it takes more time to program.

Simpler to use than machine language, though instruction codes must be memorized. It takes less time to develop programs as compared to machine language.

Easiest to use. Takes less time to develop programs and, hence, ensures better program efficiency.

POINTS TO REMEMBER

1. Computer programs are collections of instructions that tell a computer how to interact with the user, interact with the computer hardware and process data.

2. A program is a set of instructions following the rules of the chosen language.

3. The act of writing computer programs is called computer programming.4. A programer is someone who writes computer program.5. The language, which is used to write programs to communicate with

computer is called programming language.6. Machine language is a collection of binary digits or bits that the computer

reads and interprets.

Page 195: Green Computer

Computer Book-9 195GREEN

7. A program written in assembly language consists of a series of instructions mnemonics that correspond to a stream of executable instructions, when translated by an assembler, that can be loaded into memory and executed.

8. High-level languages allow us to write computer code using instructions resembling everyday spoken language.

9. Interpreter is a program that executes instructions written in a high-level language.

10. Compiler is to transform a program written in a high-level programming language from source code into object code.

Exercise1. Answer the following questions:

a. What is programming?b. Define program.c. Who is called a programer?d. What is programming language? Write its types.e. What is machine language? Give an example.f. What is assembly language? Give an example.g. What is high level language? Give an example.h. Write the difference between object code and source code.i. Differentiate compiler and interpreter.j. Explain the generation of programming language.

2. Fill in the blanks:

a. ............................ is a set of instructions following the rules of the chosen language.

b. ............................ is written in high level language.c. ............................ translates high level language into machine language

one statement at a time.d. ............................ translates high level language into machine language

whole program at a time.

Page 196: Green Computer

GREEN Computer Book-9196

e. ............................ is a collection of binary digits or bits that the computer reads and interprets.

f. The act of writing computer programs is called ............................g. ............................ is someone who writes computer program.

3. Give full form of the following.

1GL 2GL 3GL 4GL 5GL

4. State whether the following statements are “True” or “False”

a. A programer should have knowledge of programming language.b. A program is collection of raw materials.c. First generation language is a high level language.d. 4GL is a machine level language.e. Assembler is a program that solves our day-to-day problem.

5. Match the following:

a. Assembler i. set of instructionb. Interpreter ii. second generation languagec. Program iii. translate mnemonics code into onachind. Compiler iv. translate the program code one after anothere. Programer v. translate whole program at oncef. 2GL vi. who write program

Page 197: Green Computer

Computer Book-9 197GREEN

Program Development Life Cycle (PDLC)

12

IntroductionWhatever the things you create or develop, you need to undergo several processes in order to get your work done. If you are constructing a building, you need to analyze several factors like the design of the house, cost of materials required, number of rooms, how many storey, etc. It is the same with the development of a computer program. When you are going to develop a new computer program, you have to accomplish few processes which have been termed as Program Development Life Cycle. When programers build software applications, they just do not sit down and start writing code. Instead, they follow an organized plan, or methodology, that breaks the process into a series of tasks.

Program Development Life CycleThe process of developing software according to the desired needs of a user by following a basic set of interrelated procedures is known as Program Development Life Cycle. It is a tool used to guide computer programers through the development of an application. It is an outline of each of the steps used to build software applications. The different steps of program development life cycle have been defined as follows:1. Problem Analysis2. Program Design3. Program Coding

1Problem Analysis

2Program Design

3Program Coding

4Testing and Debugging

5Documentation

6Maintenance or Redesign

Page 198: Green Computer

GREEN Computer Book-9198

4. Testing and Debugging5. Documentation6. Maintenance or Redesign

1. Problem AnalysisIt is very difficult to solve a problem by using a computer without a clear understanding and identification of the problem. The process of identifying the problems to be solved before a program is developed is known as problem analysis. It is necessary to understand what the user wants and what are the problems that are to be solved by a program. A programer specifies the kind of input, processing, and output required during this process.This step is very critical for the completion of a satisfactory program. Inadequate identification of problem leads to poor performance of the system. The programer should invest a significant portion of his time in problem identification. If he does not spend enough time at this stage, he may find that his well written program fails to solve the real problem. This step is the process of becoming familiar with the problem. It starts when the programer is assigned a task. This step includes the reviewing of the design document that was prepared for the program, as well as any system wide information that would be helpful. The process ends when all the programer’s questions have been resolved and the requirements of the program are understood.

2. Program DesignOnce the problem has been identified, the next stage is the program design. A computer is both fast and versatile, but it requires the meticulous specification of what actions it should take. For the user, there is seldom an opportunity to allow the computer to make an undirected decision. Therefore, the programer must decide, prior to writing his program, exactly which steps the computer should take to solve an identified problem. Such a functional description of the task is either called an algorithm or results in a diagram called flowchart. Most of the program developers use tools such as pseudo code, flow chart, and hierarchy chart to design programs.

a. AlgorithmAn algorithm can be defined as a set of clearly defined rules and instructions in a sequence to solve a problem. It is a step-by-step procedure for solving any particular kind of problem including computer oriented computational problems. An algorithm can be written in different kinds of notations such as natural languages and pseudo code. An algorithm helps a programer in

Page 199: Green Computer

Computer Book-9 199GREEN

writing a computer program to solve a problem. There is no hard and fast rule for writing an algorithm.

b. FlowchartA flowchart is a diagrammatic or graphic representation that illustrates the sequence of operations to be performed with different symbols to get the solution of a problem. In other words, a flowchart is pictorial representation of an algorithm with different symbols. It presents the flow of instructions in a pictorial way.

3. Program CodingThe third step is the process of transforming the logic documents into a computer language format. This stage translates the program design into computer instructions. These instructions are the actual program or the software product. During this step the programer eliminates all the syntax and formal errors from the program and all logic errors are detected and resolved during this process. They use programming language like VB, C#, Java, ASP, etc.

4. Testing and DebuggingThis stage is the finding and correcting errors in program. Only few programs run correctly for the first time, so debugging is an important and time consuming stage of software development. Programming theorists often refer to program debugging and testing as verification and validation, respectively. Verification ensures that the program does what the programer intends to do. Validation ensures that the program gives the correct results for a set of tested data.Testing refers to the validation of the program. Testing ensures that the program performs correctly the required tasks. Program testing and program debugging are closely related.Testing is essentially a later stage of debugging in which the program is validated by trying it on a suitable set of cases. Program testing is, however, more than a simple matter of exercising the program a few times. In-depth testing of all possible cases is the best alternative, but this process is usually impractical. Formal validation methods exist, but are only applicable to very simple programs. Thus, program testing requires a choice of tested cases. Among the rules that can aid in program testing are the following:• Make the test plan part of the program design.• Check all minor and special cases.• Select test data on a random basis.• Plan and document software testing just like hardware testing.

Page 200: Green Computer

GREEN Computer Book-9200

• Use the maximum and minimum values of all variables as tested data.• Use statistical methods in planning and evaluating complex tasks.There are two goals in preparing a test plan. Firstly, a properly detailed test plan demonstrates that the program specifications are understood completely. Second, the test plan is used during the program testing to prove the correctness of the program. During this step, a general approach to the testing of the program is prepared and documented, indicating the number of tests needed and the purpose of each test.While testing the program there may be two types of errors in the program:

a. Syntax ErrorIf a programer does not follow the set of rules of a particular programming language, then there may be syntax error. For example: error keyword, statements and function. If there is any syntax error in the program, then it does not produce output. It shows the error message.

b. Logical ErrorLogical error refers to the error in mathematical part of the program. For example: comparison, arithmetical operations and logical operations. If there is logical error in program, then it does not affect the program execution. But it does not show the correct output.

5. DocumentationThis stage is the documentation of the program so that those who use and maintain it, can understand it, and program can be extended to further applications. Documentation is a stage of software development that is often overlooked. Yet proper documentation is not only useful in the testing and debugging stages, it is also essential in the maintenance and redesign stages. A properly documented program can be easily reused when needed; an undocumented program usually requires so much extra work that the programer might start from scratch. Among the techniques commonly used in documentation are flowcharts, comments, memory maps, parameters and definition lists, and program library forms.Proper documentation combines all or most of the methods mentioned. Documentation is a time consuming task that the programer performs simultaneously with the design, coding, debugging and testing stages of software development. Good documentation simplifies maintenance and redesign, and makes subsequent tasks simpler.

Page 201: Green Computer

Computer Book-9 201GREEN

6. Program Implementation and MaintenanceProgram implementation is about making a program work. It includes who, what, where and how a program is setup and run. After implementation of the program, user may need some update or their may be some issues in program. This stage is the updating and correcting of the program to account for changing conditions or field experience. Proper testing and documentation should significantly reduce the frequency and extent of required maintenance. Unlike programs that are used for a long time, changes may occur due to:• Newly discovered bugs. • Specification changes.• Specification expansion. • New equipment.The costs involved in program maintenance are usually grossly underestimated by most programers. It has been studied that in a typical programming environment, over 50% of the time is spent on maintaining the existing programs. So, it becomes really necessary to reduce the costs and the time spent on maintenance. This can be done by the use of the following steps:• Clarity and readability of code. • Portability and generality.• Structured code. • Modularity.• Debugging and testing. • Documentation.

Quick Review

1. The process of developing software according to the desired needs of a user, by following a basic set of interrelated procedures, is known as Program Development Life Cycle.

2. The process of identifying the problems to be solved before a program is developed is known as Problem Analysis.

3. Algorithm and flowcharts are Program Designing tools.4. Coding is the process of transforming the logic documents into a

computer language format.5. The process of finding and correcting of programming errors is known

as debugging.6. Testing is the validation of the program to ensure that the program

performs correctly the required tasks.7. Documentation of the program is done to facilitate those who use and

maintain it, can understand and extend to further applications.8. Flowchart is a graphic representation that illustrate the sequence of

operations.9. Algorithm is well defined instruction in a sequence to solve a problem.10. It has been studied that in a typical programming environment, over

50% of time is spent on maintiaining the existing programs.

Page 202: Green Computer

GREEN Computer Book-9202

Exercise1. State whether the following statements are TRUE or FALSE:

a. A programer follows series of steps before he/she starts coding the program.

b. A software program is free of errors at its first design itself.c. An algorithm and flowchart provides basic information to write a

program.d. Documentation helps in testing and debugging of a software program.e. Software programs may need to be extended or redesigned.f. Syntax error does not show the error message.

2. Answer the following questions:g. What is PDLC? h. Mention the different stages of PDLC?i. Why is Problem analysis important in programming?j. What are the different methods of program design?k. What is debugging?l. Is it necessary to test a program? If yes, why?m. Define the terms syntax error and logical error.n. What is documentation?o. Explain the maintenance and redesign stage of PDLC.p. Write any two differences between testing and debugging.

5. Match the following:

a. Programe maintainance i. graphical representation

b. Flowchart ii. identifying problem

c. Syntax error iii. updating program

d. basical error iv. programmers does not follow the set of rules

e. problem analysis v. error in mathematical part of program

Page 203: Green Computer

Computer Book-9 203GREEN

Algorithm and Flowchart

13

IntroductionComputer program is created by programers. There are so many people who work behind it. Before writing the programming code, a problem needs to be analyzed and program designed. Algorithm and flow charts are designing tools. They help in designing programs in sequential set of steps and pictorial representation.

AlgorithmAn algorithm can be defined as a set of clearly defined rules and instructions in a sequence to solve a problem. It is a step-by-step procedure for solving any particular kind of problem including computer oriented computational problems. An algorithm can be written in different kinds of notation such as natural languages and pseudo code. An algorithm helps a programer in writing a computer program to solve a problem. There are no hard and fast rules for writing an algorithm.

Properties of an algorithm1. There should be finite number of steps. 2. All steps of an algorithm should be clear and understandable.3. Steps specified in an algorithm should be applicable in computer program.4. An algorithm should be capable of producing output from the given input

of instructions after the finite number of steps.5. Stop the algorithm

Example: 1An algorithm for preparing a cup of milk tea (Tea Recipe)Step 1: Start.

Page 204: Green Computer

GREEN Computer Book-9204

Step 2: Pour a cup of milk into a tea kettle.Step 3: Put the kettle on the fire.Step 4: Add tea leaves appropriately.Step 5: Wait for some time until the milk with tea leaves in the kettle boils.Step 6: Put sugar in a tea cup and pour the tea from the kettle.Step 7: Serve the tea and drink.Step 8: Stop.The above example of an algorithm for preparing tea includes all necessary instructions to prepare a cup of tea. It’s a recipe.Let’s see another example that illustrates mathematical computations.

Example: 2An algorithm for calculating and displaying a sum of two different numbers.Step 1: Start.Step 2: Read the first number. (a)Step 3: Read the second number. (b)Step 4: Add the first number and second number and store the calculated

amount to a variable sum. (sum=a+b)Step 5: Display the calculated value as result. (sum)Step 6: Stop.

Example: 3An algorithm to find the greatest of three different numbers.Step 1: Start.Step 2: Read the first number as A.Step 3: Read the second number as B.Step 4: Read the third number as C.Step 5: Is A greater than B and A greater than C? If Yes: Print "A is the greatest". If No: Go to Step 6

Page 205: Green Computer

Computer Book-9 205GREEN

Step 6: Is B greater than A and B greater than C? If Yes: Print "B is the greatest". If No : Go to Step 7Step 7: Print "C is the greatest".Step 8: Stop

Example: 4Write an algorithm to print first ten natural numbers.Step 1: StartStep 2: Assign a value 1 to variable p (p=1)Step 3: Is p less than or equal to 10 If “Yes” then Step 4: print pStep 5: Increase the value of p by 1. (p=p+1) and repeat from step 3 If “No” then go to step 6Step 6: Stop

FlowchartA flowchart is a diagrammatic or graphic representation that illustrates the sequence of operations to be performed with different symbols to get the solution of a problem. In other words, a flowchart is pictorial representation of an algorithm with different symbols. It presents the flow of instructions in a pictorial way. A flowchart plays a vital role in the programming of a problem in any high level language. Different processes or operations are represented in different symbols and arrows are used to connect the symbols/boxes and to represent the flow of control. Flowcharts are used in analyzing, designing, documenting or managing a process or program in various fields. There are different types of flowcharts which are as follows:The flowcharts can be categorized under different types as follows:

Page 206: Green Computer

GREEN Computer Book-9206

1. Document FlowchartA document flowchart traces the movement of a document, such as internal memos, payroll information and interoffice mail, through a system. The chart is a group of columns that are divided by vertical lines. Each column represents a section, employee, department or unit in a company. The flowchart shows how a document passes from one part of the company to another. Usually, document flowcharts contain minimal detail, just the route of the document takes from one place to another.

2. Data FlowchartA data flowchart illustrates how data pass through a system. Symbols operations involved in the flow of data, the storage, input and output materials needed to keep the flow going. This is a good way to track where the data originates and where it ends up. Data flowcharts are more concerned with the movement of the data than how the data is processed.

3. System FlowchartA system flowchart shows how an entire system works by demonstrating how data flows and what decisions are made to control this event. Symbols that connote decisions, processes, inputs and outputs and data flow are the most important elements of a system flowchart.These differ from data flowcharts because they show decisions, which are more detailed.System flowcharts are used in fields such as aircraft control, central heating and automatic washing machines.

4. Program FlowchartA program flowchart demonstrates how a program works within a system. These flowcharts show any and all user-interaction pathways by using boxes and arrows. These arrows and boxes form hierarchical menus. Program charts can be large and complex. However, they are useful for mapping an entire program. It is a graphical representation of an algorithm or a problem. It is more informative than algorithm. Program flowchart describes the way of writing instructions for different operations in a sequence to solve a given problem. It is like a blueprint of a building which is drawn by the designer before starting the construction of a building. Here, we will discuss only about program flow chart in detail

Page 207: Green Computer

Computer Book-9 207GREEN

Symbols used in Flowchart

Name and Symbols Descriptions

OvalStart and Stop: They are ovals or rounded rectangles that usually contain the word "Start" or "End".

ParallelogramInput and Output: It is a parallelogram which represents the instruction about the input or output in a flowchart.

RectangleProcessing: Rectangle symbol allows you to write the instruction of calculations and computations within the symbol.

Diamond Decision making: Diamond symbol is used to write conditions to make decision.This symbol branches the control flow to different parts of the flowchart responding ‘Yes’ or ‘No’.

Circle Connector: Circle with label is used to represent a point at which the flowchart connects with another process. The name or reference for the other process should appear within the circle.

AnnotationAnnotation: It allows you to write remarks or comments about symbols or logics used in the flowchart.

Arrows Flow lines: It allows you to connect different symbols to show the flow of program. It shows the flow of direction up, down, left and right in a flowchart.

Page 208: Green Computer

GREEN Computer Book-9208

Example 1Draw a flowchart to find sum and product of two numbers.

Start

Read two numbers (a, b)

Add a and b and store in sum

(Sum=a+b)

Display sum

Stop

Example 2Draw a flowchart to find the greatest number from two input numbers.

Start

Read a and b

Is a>b ?

Display a is greater

Yes No

Display b is greater

Stop

Page 209: Green Computer

Computer Book-9 209GREEN

Example 3Draw a flowchart to print sum of first 10 natural numbers.

Start

Stop

A=1, S=0

Is A<=10

?

S= S+AA=A+1

Display S

Yes No

Example 4Draw a flowchart to print sum of the square of first 10 natural numbers

Start

A=1, S=0

Is A<=10

?

Display S S= S+A^2A=A+1

Stop

Yes No

Page 210: Green Computer

GREEN Computer Book-9210

Quick Review

1. Algorithm and flow charts are designing tools.2. An algorithm can be defined as a set of clearly defined rules and

instructions in a sequence to solve a problem.3. A flowchart is a diagrammatic or graphic representation that illustrates

the sequence of operations to be performed with different symbols to get the solution of a problem.

4. A document flowchart traces the movement of a document, such as internal memos, payroll information and interoffice mail, through a system.

5. A data flowchart illustrates how data pass through a system. Symbols connote operations involved in the flow of data, storage, input and output materials needed to keep the flow going.

6. A system flowchart shows how an entire system works by demonstrating how data flows and what decisions are made to control this event.

7. A program flowchart demonstrates how a program works within a system. These flowcharts show any and all user-interaction pathways by using boxes and arrows.

Exercise1. Answer the following questions:

a. What is algorithm?

b. Why is algorithm used by programers?

c. List the five major features of an algorithm.

d. What do you mean by flowchart? List its types.

e. What is program flowchart?

f . What are the different types of flowchart?

g. What is system flowchart?

h. Draw and name the standard symbols of flowchart.

i. Explain the importance of algorithm and flowchart.

Page 211: Green Computer

Computer Book-9 211GREEN

2. Write an algorithm and draw flowchart for the following problems:

a. To calculate area of a rectangle.

b. To calculate area of a circle.

c. To calculate volume of cube.

d. To find profit or loss from the Input Selling Price and Cost Price.

e. To find the sum and average of five input numbers.

f. To calculate simple interest.

g. To check whether an input number is "odd" or "even".

h. To print first 10 natural numbers.

i. To print first 10 odd numbers.j. To print the multiplication table of 9.

3. Write True or False against the following statements:

a. Algorithm can be executed in computer.b. Flowchart is a video representation of an algorithm.c. A system flowchart shows how an entire system works by

demonstrating how data flows and what decisions are made to control this event.

d. A data flowchart illustrates how data pass through a system.

e. Document flow chart is a group of columns that are divided by vertical lines.

4. Write the name and function of the following symbols.

Page 212: Green Computer

GREEN Computer Book-9212

Introduction to QBASIC14

IntroductionThe BASIC stands for Beginners All-Purpose Symbolic Instruction Code and was first invented by Professor J. G. Kemeny and T. E. Kurtz of Dartmouth College, U.S.A. in 1964. As the name suggests, right from the beginning BASIC was designed to be a beginners’ language but it can be used to write very complex and useful programs. It is a very user-friendly language. BASIC facilitates to develop customized software packages for business application, music and games packages.BASIC language is intended to be simple to learn and to use. It is a general purpose language, suited to a wide range of applications. Its mathematical and character handling features are equally powerful. BASIC is intended to be an interactive language. It facilitates the design of program, which permits a ‘conversion’ between user and computer. The graphics capabilities of recent version have enhanced the features.There are various types of BASIC programming. Some of them are: BASICA, GW-BASIC, TURBO- BASIC, Q-BASIC, QUICK BASIC, APPLE-BASIC etc.

QBASICQBASIC is a product of Microsoft Corporation and is available with MS-DOS version 5. QBASIC has a simple user interface and menu structure. Its design serves to aid the user in developing programs with the least number of steps. The intelligent editor checks the syntax as the program lines are entered. The program is compiled as it is typed. Errors are identified and reported in a way that allows the user to correct immediately.

Page 213: Green Computer

Computer Book-9 213GREEN

Features of QBASICQBASIC editor is called a smart editor because of the following features:i. It checks the syntax of the statement as lines are entered. If mistakes are

found, it reports accordingly.ii. It converts the reserved words into upper case if syntax is correct.iii. It maintains the space between operator and operand.iv. It provides online help about QBASIC reversed words.iv. QBASIC programs are portable.v. It allows us to write/test/debug the program.

QBASIC is regarded as high-level programming language due to the following reasons:i. QABISC is problem oriented and machine independent language. ii. QBASIC programs are portable.iii. QBASIC programs are easy to learn, write and debug.iv. QBASIC programs use syntax and also provide online help about the

syntax of the statements and commands.Turn on your computer to get DOS prompt.C: \>To change the directory to QBASIC do as instructed below.C: \>CD QBASIC [Press Enter]To load QBASICC: \QBASIC>QBASIC [Press Enter].Now, you will see the QBASIC TEXT EDITOR screen as given below:

Page 214: Green Computer

GREEN Computer Book-9214

Let's write one sample program in QBASIC text editor and save it.REM To write and save QBASIC program : ’ Remark statementCLSPRINT “Program by Creative Mind:”PRINT “QBASIC a Fantastic Programming Language!!!”END

Explanation:The program consists of REM, CLS, PRINT, and END key words. The specific meaning and syntax: REM is remark statement, CLS clears the output screen, PRINT statement writes the data on the monitor, and END statement terminates the program. You need to execute a program to see the result. You have to press function key F5 to execute the program.

OutputProgram by Creative MindQBASIC a Fantastic Programming Language!!!

Save a program:After executing a program, if you want to store it in a disc for the future then follow the steps given below:• Click on File menu or Press Alt + F to explore the File menu. • Click Save or Save As and press Enter key.• Save dialog box appears as given below :

Page 215: Green Computer

Computer Book-9 215GREEN

• Type the file name including location of a file.• Finally click on Ok or press Enter key to store the program. QBASIC

MENUSThe file menu allows the user to create new file, open a file, save and exit from the QBASIC.

Commands UseNew Clears the current program from the memory and allows the user

to write a new program.Open Loads the existing program from the disc into the memory.Save Saves the current program into the disc.Save As Saves the current file under different filenames and locations.Print Prints the whole or part of the program.Exit Makes permanent exit to DOS ending session with QBASIC.

The Edit MenuThe edit menu allows the user to edit the program and to create sub procedures.

Commands Shortcut Key UseCut Shift+Del Deletes the selected text; saves in clipboard.Copy Ctrl+Ins Copies the selected text; saves in the clipboard.Paste Shift+Ins Inserts from the clipboard.Clear Del Deletes the selected text; does not save in the

clipboard.New Sub Opens windows for a new SUB program.New Function Opens windows for a new FUNCTION

procedure.

The Cut and Paste CommandsThe Cut and Paste commands together allow the user to move a block of statements from one location to another within a program. The Copy and Paste commands together allow the user to copy a block of statements from one location to another within a program without deleting the original block.

Page 216: Green Computer

GREEN Computer Book-9216

The following steps need to be followed for the Cut-Paste (Move) or Copy-Paste (Copy) operation:• Highlight the block of statements that you want to Move or Copy. To

highlight statements, hold down Shift-key and press arrow key or use mouse to make selection.

• Now, choose the Cut (for Move) or Copy (for copy) command from the Edit menu.

• Now, move the cursor to the new location, where you want to paste the Cut or Copy selected statements.

• Now, select the Paste command. It copies the selected statements block from the clipboard to the desired location

The View MenuThe View menu allows you to access any procedure quickly. It displays individual procedure in the view windows. Let's discuss the commands of View menu one by one. Commands Shortcut Key UseSubs F2 Lists the modules, subprograms and

functions.Split Splits the screen into two view windows.Output Screen F4 Views the output screen.

The Search MenuThe Search menu offers commands that locate and replace a text.Commands Shortcut Key UseFind Ctrl+ Q+ F Finds the specified text.Repeat last find F3 or Ctrl+L Finds the next occurrence of the specified

text.Change Ctrl+ Q+ A Finds the text and changes with the new

text.

The Run MenuThe Run menu commands allow you to execute the program. Let's discuss the commands of Run menu in detail.

Page 217: Green Computer

Computer Book-9 217GREEN

Commands Shortcut Key UseStart Shift+F5 Runs the current program.Restart Reinitializes all variables and highlights the

first executable statement.Continue F5 Continues to run the program after

suspension.

The Debug MenuThe Debug menu facilitates the user to use the powerful debugging commands. Let's discuss the commands of Debug menu. Commands Shortcut Key UseStep F8 To execute the next statement.Procedure Step To execute the next statement.Trace on F10 To watch execution of the programToggle Breakpoint F9 To establish a breakpoint at the current line

where the cursor is located.Clear All Breakpoints To deactivate the breakpoints.Set Next Statement To set new starting point to resume the

program.

The Options MenuThe Options menu allows the user to set display environment, help path and auto syntax checking on or off.Commands UseDisplay To set the display environment.Help To set search path for help.Syntax Checking To set auto syntax checking on or off.

The Help MenuThe Help menu offers an extensive on-line help facility. You can use help by pulling down the help menu or by pressing Shift + F1.

Page 218: Green Computer

GREEN Computer Book-9218

Commands Use

IndexIt shows index of keywords. Press the first character of keyword to get help.

ContentsIt gives information about QBASIC Menu, commands, keywords, character sets, etc.

TopicIt shows information about the topic selected from contents.

Using helpIt displays the information about help.

AboutIt shows short information about QBASIC.

Characters Set in QBASICOne of the virtues of BASIC language is a simple way in which data is represented. Data, in a basic program, may be of two types. These are number or numeric data and a set of characters called string or literal data.Type Character or SymbolAlphabet A to Z or a to zDigits 0 to 9Operators +, -, *, /, \, MOD, ^, ( ), =, <, >, >=, <=, <>Special Characters $, #, !, %, and

Quick Review

1. QBASIC was developed by Professor J. G. Kemeny and T. E. Kurtz of Dartmouth College, U.S.A. in 1964.

2. QBASIC is a product of Microsoft Corporation and is available with MS-DOS version 5.

3. QBASIC programs are portable.4. QBASIC allows us to write/test/debug the program.5. The Debug menu facilitates the user to use the powerful debugging

commands.

Page 219: Green Computer

Computer Book-9 219GREEN

6. The Options menu allows the user to set display environment, help path and auto syntax checking on or off.

7. The Help menu offers an extensive on-line help facility.

Exercise1. Fill in the gaps:

a. QBASIC is ........................ language.b. QBASIC is not case ........................ language.c. QBASIC supports the mouse to select ........................ from the menu.d. The short-cut key for CUT is .........................e. ........................ statement terminates the execution of program.

2. Answer the following questions:a. What is QBASIC? Write in short.b. Define high-level language. Name any three high-level languages

that you know.c. Write any four important features of QBASIC.d. Write the functions of Smart Editor of QBASIC.e. Differentiate between the View windows and the Immediate windows

of QBASIC.

3. Write short notes on:a. Run menub. Cut-Paste and Copy-Pastec. Save and Save As

4. Write function of the following keys:a. F2 b. F4 c. F5d. F8 e. F9 f. F10

5. Write use of following shortcut keys:a. Shit + Del b. Ctrl + Ins c. Shift + Insd. Ctrl + Q + F e. Ctrl + Q + A f. Ctrl + L

Page 220: Green Computer

GREEN Computer Book-9220

Constants, Variables And Data Types

15

IntroductionAll computer programs have three aspects, namely, input, processing and output. Input is concerned with supplying data to computer, processing involves manipulating the data, and output concerns printing or displaying the result of processing. In some program, input, processing and output occurs in distinct stages. In other programs, particularly interactive programs, input processing and output steps are repeated many times during the run time of the program.This chapter introduces the BASIC language instructions for these operations.

ConstantsConstants are the data or values that do not change when the program executes. The data types accepted by QBASIC can be termed as Constants. There are two types of Constants in QBASIC.1. Numeric Constant2. String Constant

1. Numeric ConstantA number or a set of numbers used in mathematical calculations and comparisons is known as Numeric Constant. It is the general type of number and appears normal like we write in English or mathematics. It should be stored in Numeric Variable. A numeric constant does not consist of comma, Rs. and any other characters.

Valid Numeric Constant1000 -253 1056.50 -25.64Numeric Constant can be positive or negative numbers with decimal values.

Page 221: Green Computer

Computer Book-9 221GREEN

Invalid Numeric Constanta. 10,00 Comma is not acceptable.b. 100% No sign is accepted.c. 1 23 Space is not allowed.

2. String ConstantA set of alphanumeric values and special characters is known as String Constant. Normally, it is enclosed within double quotation marks. It should be stored in String Variable.Valid String Constant Invalid a. “Kathmandu” Kathmandu”b. “Programming is fun” “programming” “is” “fun”c. “---------special characters can be used -------” I love Nepald. “5526783” 984150

Symbolic ConstantA fixed value which is represented by some scientific symbols is called symbolic constant. Fox example: 3.1416. In QBASIC, we use CONST statement to declare one or more symbolic constants. Its syntax is:CONST constant name = expression eg: CONST pi = 3.1416

Constant Name It is the name of the constant. This name can consist of up to 40 characters and must begin with a letter. Valid characters are A-Z, 0-9, and period (.).Example:Const PI = 3.141593INPUT "Radius of Circle: "; rPrint "Area = "; PI * r ^ 2

VariablesVariable is a name or an entity of the space in the memory location that can hold alphanumeric and numeric values. A variable can contain a number, a special character, a word, a sentence or an entire paragraph as its value. The value of variable can change during the program execution. It is further divided into

Page 222: Green Computer

GREEN Computer Book-9222

two categories on the basis of data it stores.1. String Variable2. Numeric Variable

1. String VariableIt is the data entity that holds alphanumeric values. The name of string variable ends with dollar ($) sign. It also accepts number as its value but the number does not take part in mathematical calculations. The value of String Variable is the string constant.

Valid String Variablea. N$ b. FirstName$ c. Address$ d. pH$ e. R15$

Invalid String Variablea. 1N$ Variable name doesn’t start with a number.b. First Name$ Space is not allowed.c. Address $ sign is missing.

2. Numeric VariableNumeric variable holds all negative and positive number for mathematical calculations. A numeric variable may be a single character or combination of alphabets and numbers followed by type declaration character. It cannot accept text as its value. Numeric Variable is further divided into four types.a. Integer variable (%)b. Long integer variable (&)c. Single precision variable (!)d. Double precision variable (#)

Rules for naming Variablei. First letter of a variable name must be an alphabet.ii. Variable name can be up to 40 characters long.iii. Variable name can be in UPPERCASE, lowercase or a combination of both.iv. Space in between the variable name is not allowed.

Page 223: Green Computer

Computer Book-9 223GREEN

v. Variable name should be precise and meaningful.vi. Some reserved words such as SQR, PRINT, LEN, etc. cannot be used as

variable namevii. Letters (a to z and A to Z) and numbers (0 to 9) can be combined to write

variable name.

Variable Declaration in QBASICThe standard ways to declare the variable in QBASIC are:a. Implicit declarationb. Explicit declaration

a. Implicit Variable DeclarationImplicit variable declaration is specially used in simple variable. In implicit variable declaration, the type of variable is declared at the same time when the value is assigned to it. So the declaration and the assignment are done at the same time. The variable type is declared by using data type declaration characters which are always used as suffix in variable name such as ($,%,!,and,#).E.g. y%=1000.67, variable has been declared as an integer variable and the value is assigned as 1001.

NOTE: If there is no any data type declaration character used in the variable name, then the QBASIC program assigns the default data type that is considered as a single precision variable.

b. Explicit Variable DeclarationAn array or subscripted variables are declared as explicit. Explicit variable declaration, the variable type and the assignment are done separately. The variable type is declared first with DIM statement, then the value is assigned later. So the declaration characters are not used here. In programming languages like C and C++, the variables must be declared explicitly.

Syntax: DIM [Variable name] AS TYPEThe type can be STRING, INTEGER, LONG, SINGLE, DOUBLEExample:DIM x AS INTEGER 'declaration part, x has been declared as an integer variable

Page 224: Green Computer

GREEN Computer Book-9224

a = 100'assignment part, 100 has been assigned to variable a.DIM name AS STRING*15 'variable a has been declared as a string variablewhich 'can accumulate (store) upto 15 characters.name="Issac Newton" 'value has been assigned as "Issac Newton".

Data types in QBASICQBASIC supports two basic types of data in QBASIC programming. They are string and numeric.

a. String data types String data type is a text value that consists of alphabets, numbers and

other special symbols. String data types are stored by string variables. The string variable which contains $ sign after the variable name. For example name$= “Atul”. QBASIC supports two types of string data. They are:

i. Variable Length String: A variable length string is a popular string data type available in all versions of BASIC. It consists of 0 to 32767 characters in QBASIC. Sting data can be supplied from the keyboard or enclosed in double quotation sign.

Example: the variable Name$ can store string of different length. INPUT “ enter your name”; Name$

ii. Fixed Length String: A fixed length string is another string data type supported by QBASIC. A fixed length string has a declared length that remains fixed throughout the execution of the program. It is compulsory to declare a string length variable before its use. It is declared with an explicit declaration method.

Example:REM to store 4 and 8 characters in variable name and address respectively.DIM name AS STRING*4DIM address AS STRING*8name= “Atul”address= “Lalitpur”PRINT “My name is”; name

Page 225: Green Computer

Computer Book-9 225GREEN

PRINT “I live in”; addressEND

b. Numeric data types Numeric data type includes all negative and positive data type in QBASIC.

There are four numeric data types:

Integer (%):Integers are positive or negative whole numbers. The legal range for integer data type is from -32,768 to 32,767. Each integer values with 2 bytes of memory. For example : Num%

Long integer (&):Long integer data type provides a long range of whole numbers. The legal range of Long Integer data type is -2,147,483,648 to 2,147,483,647. It needs four bytes memory to store each long integer number. For example: Num&.

Single precision (!):Single precision stores the number with fraction data. It stores the number with an accuracy up to 7 digits. Single precision numbers can be written in different ways. The most common way to write the number is number with a decimal point. It occupies four bytes memory space. The suffix or symbol (!) is an optional while declaring single precision. For example: Num!

Double precision (#): Double precision data type supports a long range of value with fractional parts. It has accuracy up to 15 digits. For example: num#.Following table makes you more clear about the numeric data type.

DATA TYPE DECLARATION MAXIMUM MINIMUM BYTES USEDIntegers % 32,767 -32,768 2Long Integers & 2,147,483,647 -2,147,483,648 4Single (7-digit)Precision

! 3.402823 +38 1.401298 E-45 4

Double (16-digit) Precision

# 1.7976931 D+308 4.940656 D-324 8

String $ 32767 0 2

Page 226: Green Computer

GREEN Computer Book-9226

POINTS TO REMEMBER

1. Constants are the data or values that do not change when the program executes.

2. Variable is the space in the memory location that can hold alphanumeric and numeric values.

3. String variable is the data entity that holds alphanumeric values.4. Numeric variable holds number for mathematical calculations.5. Integers are positive or negative whole numbers.6. Single precision stores the number with fraction data.7. Long integer data type provides a long range of whole numbers.8. Double precision data type supports a long range of value with

fractional parts.9. A variable length string consists of 0 to 32767 characters in QBASIC. 10. A fixed length string has a declared length that remains fixed throughout

the execution of the program.11. In implicit variable declaration, the type of variable is declared at the

same time when the value is assigned to it.12. An array or subscripted variables are declared as explicit.

Exercise1. Answer the following questions:

a. Define the term constant.b. What is variable? Mention its types.c. Write any two differences between string variable and numeric

variable.d. Write the rules for writing a variable name.e. Write any two differences between implicit variable and explicit

variable.f. What is variable length string data type?g. What is fixed length data type?

2. Fill in the blanks.

a. ....................... are the data or values that do not change when the program executes.

b. ....................... is the data entity that holds alphanumeric values.

Page 227: Green Computer

Computer Book-9 227GREEN

c. The legal range for integer data type is from ....................... to .......................

d. A variable length string consists of ....................... to ....................... characters in QBASIC.

e. ....................... holds number for mathematical calculations.f. ....................... has accuracy up to 15 digits.g. A fixed value which is represented by some scientific symbols is

called .......................h. String Variable ends with a ........................sign.i. Variable name can be up to ........................ characters long. j. A variable name should always start with an .........................k. String variable is the data entity that holds …………………..values.

3. Write the name and function of the following symbols.

a. % b. & c. ! d. # e. $

4. Classify the following Valid or Invalid variables. Give reasons if invalid.

Variables Reasons Name1$9Address$A123#Num$1Area of a circle&L_name5sumaDDress$$500D%

5. Correct and write the following assignment. Name#= “Ramesh”, $daaress= sursh, a#1=5000, Num1= “6789” Num=$750,

Num3%= RS, 751, symbol Num= 5, amount= 50,000

Page 228: Green Computer

GREEN Computer Book-9228

Operators Operands and Expressions

16

IntroductionOperators, operands and expressions are the important factors in QBASIC. A programer must have knowledge of these things. Without proper knowledge of operators, operands and expressions a programer cannot write error free program. Most of the results of a program depend on the operators, operands and expressions so we are going to discuss these factors in this chapter.Operators are signs or symbols that perform mathematical and logical operation such as addition, multiplication, comparisons, assign values and make logical decisions. The types of operators are:a. Arithmetic Operators b. Relational Operators c. Logical Operators d. String Operatorse. Assignment Operators

a. Arithmetic OperatorsThey perform mathematical calculations like addition, subtraction, multiplication, division, etc. They give numeric values (numbers) as a result.

Arithmetic Operators

Function Example

^ (Exponentiation) calculates exponent (Power of the number)

2^3=8

* (Asterisk) multiplies the numbers 2*3=6/ (Forward slash) divides the number and returns

decimal value5/2=2.5

\ (Backward slash) performs division and gives only integer number as quotient

5\2=2

MOD performs division and return 5 MOD 2=1+ performs addition 3+1=4- performs subtraction 3-1=2

Page 229: Green Computer

Computer Book-9 229GREEN

NOTE: If multiplication and forward slash (decimal division) are in same expression then operations are done on which comes first from left. Expression in bracket ( ) gets first priority in operation.

b. Relational Operators (=, <, >, >=, <=, <>)They compare the values and give result as True or False. They are used to make decisions in the program. They help in making logical expression which returns Boolean value (True or False). It provides six different relational operators.= equal to> greater than< less than>= greater than or equal to<= less than or equal to<> not equal to

Example:If a= 5, b= 8 then; a=b = falsea>b = falsea<b = truea>= b =falsea<=b = truea<>b = true

c. Logical Operators ( AND, OR, NOT)They help to make decisions as True or False. It combines multiple conditions to make a complex logic. Logical operator helps in making logical expressions which returns Boolean value (True or False).

Truth TableA truth table shows the outputs obtained from a logic circuit or gate as consequences of specific inputs.

Page 230: Green Computer

GREEN Computer Book-9230

OR operator It is a logical operator which does not evaluate the condition but logically compares the outcomes or two or more than two conditions. It returns the true if one or all conditions are true.

Truth Table for OR operator.Condition1 (x) Condition2 (y) Output z= (x OR y)False(0) False(0) False(0)True(1) False(0) True(1)False(0) True(1) True(1)True(1) True(1) True(1)

Let a=10, b= 15, c= 20Condition 1 (x) Condition 2 (y) Output (x OR y)a>b= false a>c=false False OR False = Falsea>b= false a<b= true False OR True=Truea<b=true a>b= false True OR False=Truea<b=true a<c= true True OR True= True

AND operatorIt is a logical operator which does not evaluate the condition but logically compares the outcomes or two or more than two conditions. It returns the true if all conditions are true.

Truth Table of AND operatorCondition1 (x) Condition2 (y) Output z= (x AND y)False(0) False(0) False(0)True(1) False(0) False (0)False(0) True(1) false (0)True(1) True(1) True(1)

Let a=10, b= 15, c= 20Condition 1 (x) Condition 2 (y) Output (x OR y)a>b= false a>c=false False AND False = Falsea>b= false a<b= true False AND True=Falsea<b=true a>b= false True AND False=Falsea<b=true a<c= true True AND True= True

Page 231: Green Computer

Computer Book-9 231GREEN

NOT operatorIt is a logical operator which does not evaluate the condition but logically reverses an outcome. If input is true then output becomes false and if input is false then output becomes true.

Truth Table of NOTInput OutputFalse(0) True (1)True(1) False(0)

d. String OperatorIt combines text with the " + " sign. This process is known as concatenation.Example:A$="Program"B$="ming"Print A$+B$ It will result in Programming.

e. Assignment OperatorIt assigns value to the variable = (equal) sign is considered as assignment operator.

OperandsOperands are constant values or variables on which mathematical or logical operations take place. Let us look at the example below:X = 5 + 10Sum = A + BIn the above two expressions, the numbers 5, 10 and the variables A and B are called the operands. The plus is the arithmetic operator which is working on the operands.

ExpressionsThe combination of operators, variables and constants is known as an expression. The variables or constants used before or after an operator are known as operands. An expression gives out a value as a result

Page 232: Green Computer

GREEN Computer Book-9232

There are three types of expressionsa. Arithmetic Expression: Arithmetic expression contains values, variables

and arithmetic operators which return numeric value after the operation. For example: sum=5+7

b. Logical Expression: A logical expression contains variables or values and relational or logical operator that returns Boolean values, the name after George Boole, the nineteenth-century English mathematician (True or False). For example 10>7 = True

c. String Expression: An expression contains string operators and string values which returns string value after the operation. String expression is mostly used for concatenating strings. For example: “Ram”+ “kumar” = Ramkumar

Conversion of Algebraic Expression into QBASIC ExpressionAlgebraic Expression QBASIC Expressiona. h2 = p2 + b2 h^2 = p^2 + b^2b. (a2 – b2 )=(a +b) (a –b) (a^2+b^2) = (a + b) * (a – b)c. V = L3 V = L^3d. A ÷ B x C A / B * Ce. average = total ÷ N average = total / N

Quick Review

1. Operators are signs or symbols that perform mathematical and logical operation such as addition, multiplication, comparisons, assign values and make logical decisions.

2. Operands are constant values or variables on which mathematical or logical operations take place.

3. The combination of operators, variables and constants is known as an expression.

4. Relational operators compare the values and give result as True or False.

5. Arithmetic expression contains values, variables and arithmetic operators which return numeric value after the operation.

6. A logical expression contains variables or values and relational or logical operator that returns Boolean values (True or False).

Page 233: Green Computer

Computer Book-9 233GREEN

Exercise1. Answer the following questions.

a. What is an operator? List out the types of operators.b. Make truth table of AND, OR, and NOT operators.c. What is expression? Mention the types of expressions.d. What is logical operator? Give an example.e. What is an operand? Give an example.

3. Evaluate and find the output of the following if a=15, b=20 and c= 5.

i. (a + b +c )/4ii. (a + b +c ) \5iii. b MOD civ. b MOD a * cv. (a+b)^(1/2)vi. (a+b+c)^(1/3)vii. 12 MOD 4 = 3viii. 45>56 AND 45=45ix. 45>76 AND 25<>5x. a<b OR a<>c

4. Complete the Table if a=15, b= 5, c= 10

Condition 1 (x) Condition 2 (y) Output (x OR y) Output (x AND y)a>b= True A<c=False True OR False = True True AND False = Falsea>b= ? a<b= ? ? ?a<b=? a>b= ? ? ?a<b=? a<c= ? ? ?

5. Covert the following QBASIC Expressions into Algebraic Expressions:

QBASIC Expression Algebraic Expressionp=2* (l+b) p =2 (l+ b)a= 2*h*(l+b)s=(3*x^2+y^2+z^2)/(x+y+z)s=u*t + ½ a*t^2

Page 234: Green Computer

GREEN Computer Book-9234

(a+b)^(1/2)x = SQR(c/(a+b))a = (s*(s-a)*(s-b)*(s-c)^(1/2)v=4/3*PI*r^3c.i= p*(1+r/100)^t - 1h= v/(l*b)x= (-b + (b^2-4*a*c)^(1/2))/(2*a)gp = (sp-cp)/cp*100t= (si*100)/(p*r)

Page 235: Green Computer

Computer Book-9 235GREEN

QBASIC Statements17

QBASIC Statement is the word used in QBASIC to perform specific task in a program. It helps to solve problem with the help of a computer. All the command words have to be written using some standard rules, which are called “Syntax Rules”. Syntax is the grammar of writing the statement in a language.

Some of the statements are:Clearing the screenCLSThis statement is used as the first line of every program so that the screen is cleared each time the program runs. It helps the program to start with a fresh screen.You can insert the CLS statement anywhere in a program.Syntax: CLS REM StatementThis command is used to put remarks to a program or a line of statement to make the code more understandable.REM statement is used throughout the program to explain what your code is trying to accomplish.You can type (') apostrophe instead of REM statement.Syntax: REM remarksLET StatementIt is used to assign value to a variable. It is optional.Syntax: LET variable = expression

Page 236: Green Computer

GREEN Computer Book-9236

LAB Practice 1 CLS REM program to find sum of two numbers LET a= 10 LET b= 15 LET sum = a+b PRINT sum END

PRINT StatementIt displays the value or values of variables on the screen. The variables and the values are used to the right of PRINT statement.Syntax: PRINT [prompt string];expressionWhere, The prompt means the message you keep enclosed within the double quotation marks. Generally, it is a string constant defining the type of output in the variable.

LAB Practice 2 CLS REM program to print your name LET Name$= “Isha” PRINT “My name is”;Name$ END

LAB Practice 3REM program demonstrating print statementCLSINPUT “Enter a name of student :”; N$INPUT “Enter marks in English”; EngINPUT “Enter marks in Nepali”; NepINPUT “Enter marks in Science”; Sci

Page 237: Green Computer

Computer Book-9 237GREEN

INPUT “Enter marks in Computer”; CompTotal = Eng+Nep+Sci+CompPRINT “The student is”; N$PRINT “Marks in English is”; EngPRINT “Marks in Nepali is”;NepPRINT “Marks in Science is”;SciPRINT “Marks in Computer is”;CompPRINT “The total score in four subjects is”; TotalEND

The above program will get executed as described below:Enter a name of student?BikramEnter marks in English?80Enter marks in Nepali?82Enter marks in Science?85Enter marks in Computer?90The student is : BikramMarks in English is 78Marks in Nepali is 72Marks in Science is 82Marks in Computer is 90The total score in four subjects is 330

READ.....DATA statementREAD statement accepts data to a variable which are stored in DATA statement. More than one variable name can be used with READ statement. DATA statement supplies data to the variables in READ statement.Syntax: READ variable listDATA value listExample: READ Name$, Add$, salary

Page 238: Green Computer

GREEN Computer Book-9238

DATA Shanvi, Sanepa, 5000In this example, the variable Name$ will read the data Shanvi from DATA statement. Likewise, Add$ and salary will read the data Sanepa and 5000 from the DATA statement respectively.

LAB Practice 4Type the following codes in QBASIC screen and run the program.REM PROGRAM USING READ DATA STATEMENTCLSREAD Name$, Add$, salaryDATA Shanvi, Sanepa, 5000PRINT Name$, Add$, salaryENDNote: Run the program by pressing F5 or Shift + F5.

LAB Practice 5 REM to find area of circle using READ – DATA statement CONST PI = 3.1416 READ r LET a = PI * r^2 PRINT “Area of circle:”; a DATA 5 END

END StatementIt is used to end the program. It assures you that the program is complete.INPUT StatementIt allows user to enter value to variable during program execution. This is the most commonly used statement for entering the values.Syntax: INPUT [;] [prompt string] [;][,] variable, [variable, ....]

Page 239: Green Computer

Computer Book-9 239GREEN

Understanding SyntaxINPUT Word in capital represents BASIC statement.[;] It causes the cursor to remain in the same line after the user

presses Enter key.prompt string It displays a prompt to input. The string must be enclosed

within double quotes.[;] It prints question mark (?) at the end of the prompt string. Variable It denotes valid variable name to be used.[Variable, ...] It denotes other variable name that can be typed separated

by a comma (,).

LINE INPUT statementPurpose: LINE INPUT reads a line of up to 255 characters from the keyboard or a file.Syntax: LINE INPUT [;] ["prompt";] variable$

CONST statementPurpose: Declares one or more symbolic constants.Syntax:CONST constantname = expression [,constantname = expression]...

LAB Practice 6CLSLET R= 5CONST PI = 3.141593PRINT "Area = "; PI * R ^ 2 ENDSWAP statementPurpose: Exchanges the values of two variables.Syntax:SWAP variable1, variable2Note: variable1 and variable2 should have the same data type.

Page 240: Green Computer

GREEN Computer Book-9240

Example: REM to interchange the value between two data items LET a = 100 LET b = 200 PRINT "Value of A and b Before SWAP: "; a, b SWAP a, b PRINT "Value of A and B after SWAP: "; a, b END

Conditional Branching StatementThis type of statement is executed only when a given condition is satisfied.For example: IF…THEN…ELSE statements.

IF...THEN…ELSE StatementIt is used to make comparison between two or more values. The statementis also used while making decisions. Syntax:IF condition THEN (block of statement1 to be executed)ELSE (block of statement2 to be executed)END IFThe condition following the IF statement is processed first. If the condition is true, statements which appear after THEN statement will be processed. If the condition is not true, then the ELSE statement will be executed.

LAB Practice 7REM program to enter a number and check it is less than 10 or notCLSINPUT "Enter a number: "; NIF N < 10 THEN

Page 241: Green Computer

Computer Book-9 241GREEN

PRINT "It is less than ten";NELSEPRINT "it is more than ten";NEND IFEND

LAB Practice 8REM program to enter any two numbers and check find the greater oneCLSINPUT "Enter first number: "; N1INPUT "Enter second number: "; N2IF N1> N2 THENPRINT "the first number is greater";N1ELSEPRINT "the second number is greater";N2END IFEND

IF...…ELSE IF……END IF StatementThese blocks of statements allow you to have more than one IF…THEN statements in the same program.

Syntax:IF condition1 THEN Statement block1ELSEIF condition2 THEN Statement block 2ELSEIF condition 3 Statement block 3ELSE

When the program encounters the IF statement, the program first tests the condition1. If the first condition1 becomes true, the program executes the first statement block1. If condition1 is false then it checks condition2….. if all conditions are false, then it executes the statement block after ELSE.

Page 242: Green Computer

GREEN Computer Book-9242

Statement block 4END IF

LAB Practice 9REM program to enter any three numbers and find the greatest numberCLSINPUT “ Enter the first number”, aINPUT “ Enter the second number”, bINPUT “ Enter the third number”, cIF a>b AND a>c THEN PRINT “ First number is greatest”;aELSEIF b>a AND b>c THEN PRINT “ Second number is greatest”;bELSEIF c>a AND c>b THEN PRINT “ Third number is greatest”;cELSE PRINT “ All are equal”ENDIFEND

Press F5Enter the first number? 10Enter the second number? 15Enter the third number?20

Third number is greatest 20

Statements variable Operators outputCLS, INPUT

IF…THEN..ELSE,

PRINT, END

a,b,c

all are numeric variable

> relational

AND logical operator

Third number is greatest 20

Description Table

Page 243: Green Computer

Computer Book-9 243GREEN

LAB Practice 10REM program to enter any number from 1 to 7 and print the matching dayCLSINPUT “Enter any number ”; NumIF Num =1 THEN PRINT “It’s Sunday”ELSEIF Num =2 THEN PRINT “It’s Monday”ELSEIF Num =3 THEN PRINT “It’s Tuesday”ELSEIF Num =4 THEN PRINT “It’s Wednesday”ELSEIF Num =5 THEN PRINT “It’s Thursday”ELSEIF Num =6 THEN PRINT “It’s Friday”ELSEIF Num =7 THEN PRINT “It’s Saturday”ELSE PRINT “Invalid number”END IFEND

SELECT CASE statementSelect case is another conditional statement. It is almost like IF...THEN...ELSE. What if you have 5 or 6 friends that might use your computer and you want the computer to say something different to each of them?

Syntax:SELECT CASE <variable>

Page 244: Green Computer

GREEN Computer Book-9244

CASE <value1> (Block of statement 1 to be executed) CASE <value2> (Block of statement 2 to be executed) CASE <value3> (Block of statement 3 to be executed) . . . . .END SELECT

CLSINPUT "Enter your name: ", Name$SELECT CASE Name$CASE "Ram" PRINT "Greetings, oh powerful master"CASE "Hari" PRINT "Go away!"CASE ELSE PRINT "Hello, "; Name$; ". How are you?"END SELECTENDSELECT CASE first checks Name$ for the value "Ram". If it finds it, it does the PRINT after the CASE "Ram". When the PRINT is done, it skips over the rest of the CASEs. It keeps checking against each CASE until it gets to CASE ELSE. If it hasn't found anything, it will do whatever is after the CASE ELSE.

SELECT CASE can also be used with numbers as well as strings. Here's a quick example:

Page 245: Green Computer

Computer Book-9 245GREEN

CLSINPUT "Enter a number: ", NumberSELECT CASE NumberCASE 1234 PRINT "Thank you for entering the secret number 1234"CASE 22 PRINT "Well, 22 is an interesting number"CASE ELSE PRINT "You must not know the secret number"END SELECTEND

Library FunctionsLibrary Functions are the set of executable block of instructions capable of doing some specific tasks. They are also called built-in functions as they are ready to be used. They are programd by the software developer and attached along with the software. Library Functions are of two types. They are String Functions and Mathematical.Functions take data or variables inside the parenthesis (), i.e. bracket and is known as argument. They are used along with other QBASIC statements.Generally, the String Functions give out string data as output after processing of the data whereas Mathematical Functions give number as an output after the processing.Some of the String Functions are:

TIME$ functionPurpose: The TIME$ function returns the computer's current system time.Syntax: TIME$TIME$ statementThe TIME$ statement sets the current system time on your computer.

Page 246: Green Computer

GREEN Computer Book-9246

TIME$ = stringexpression$Note: stringexpression$ The time in one of the following forms:hh Sets the hour; minutes and seconds default to 00.hh:mm Sets the hour and minutes; seconds default to 00.hh:mm:ss Sets the hour, minutes, and seconds.The TIME$ function returns a string in the form hh:mm:ss.

Example PRINT TIME$TIME$ = "08:00:58" 'Note: The new system time remains in effect until you change it again.PRINT "Time set to "; TIME$

DATE$ functionPurpose: The DATE$ function returns the computer's current system date.Syntax: DATE$Note: The DATE$ function returns a string in the form mm-dd-yyyy.

DATE$ statementPurpose: The DATE$ statement sets the current system date on your computer.Syntax: DATE$ = stringexpression$Note: stringexpression$ is the date in one of the following forms: mm -dd – yy or mm - dd – yyyyor mm / dd / yy, mm / dd / yyyy.

Example PRINT DATE$ DATE$ = "01-01-90" 'Note: The new system date remains in effect until' you change it again. PRINT "Date set to "; DATE$ Re- write the following program correcting the bugs. d = DATE$ : n$ = VAL(LEFT(d$,2))

Page 247: Green Computer

Computer Book-9 247GREEN

FOR I = 1 TO TWELVE READ M$ IF I = N THEN PRINT "CURRENT MONTH:";M$NEXT IDATA JAN,FEB,MAR,APR,MAY,JUN,JUL,AUG,SEP, OCT,NOV,DECEND

UCASE$( )This function converts the supplied string to capital letters. You can directly supply a string data enclosed within inverted comma or a string variable containing string data. This can be categorized under String Function.Syntax : UCASE$(string/variable)Example1 : UCASE$("buddha was born in nepal ")This will change the text " budha was born in nepal" to capital letters as "BUDDHA WAS BORN IN NEPAL".Example2 : n$=" buddha was born in nepal "UCASE$(n$) It converts the text "BUDDHA WAS BORN IN NEPAL".

LCASE$( )This function changes the supplied string into lowercase characters i.e. small letter.You can directly supply a string data enclosed within inverted comma or a string variable containing string data. This is also a String Function.Syntax : LCASE$(string or variable)Example1 : LCASE$("I Love Nepal")It converts the text into lower case “I love Nepal” Example2 : n$="I Love Nepal " LCASE$(n$)It converts the text into lower case “I love Nepal” b session

Page 248: Green Computer

GREEN Computer Book-9248

LEFT$( )This function returns specified number of characters from the left side of a string.Syntax : LEFT$(string, number)Example1 : LEFT$("Narayani",4)It returns 3 characters from the left of the string “Narayani” i.e. Nara.Example2 : L$="Narayani"LEFT$(L$,3)It returns four characters from the left of the string "Narayani" i.e. Nar.Lab session

Solved ExampleREM program to extract number of characters from left of the stringCLSL$="COMPUTER"PRINT LEFT$(L$,3)ENDThis will print three characters from left of the string COMPUTER i.e. COM.Use of LEFT$ with FOR..NEXTCLSC$="NEPAL"FOR J=1 TO 5 L$= LEFT$(C$,J)PRINT L$;NEXT JENDDry run helps you to understand how the program will be executed.

J= 1 TO 5 L$=LEFT$(C$,J) Output (L$) NEXT J (J=J+1)1 L$=LEFT$(“NEPAL”,1) N 1+1=22 L$=LEFT$(“NEPAL”,2) NE 2+1=33 L$=LEFT$(“NEPAL”,3) NEP 3+1=44 L$=LEFT$(“NEPAL”,4) NEPA 4+1=55 L$=LEFT$(“NEPAL”,5) NEPAL 5+1=6 FALSE

Page 249: Green Computer

Computer Book-9 249GREEN

RIGHT$( )This function returns specified number of characters from the right side of the supplied string.Syntax : RIGHT$ (string, number)Example1 : RIGHT$("COMPUTER", 3)This returns three characters from the right of the string “COMPUTER” i.e. TER.Example2 : C$="COMPUTER"RIGHT$(C$,5)This will return five characters from the right of the string “COMPUTER” i.e. “PUTER”.

Solved ExampleCLSC$="NEPAL" FOR J=1 TO LEN(C$) R$= RIGHT$(C$,J)PRINT R$NEXT JENDDry run helps you to understand how the program will be executed.

J= 1 TO LEN(C$) R$=RIGHT$(C$,J) Output (L$) NEXT J (J=J+1)1 R$=RIGHT$(“NEPAL”,1) L 1+1=22 R$=RIGHT$(“NEPAL”,2) AL 2+1=33 R$=RIGHT$(“NEPAL”,3) PAL 3+1=44 R$=RIGHT$(“NEPAL”,4) EPAL 4+1=55 R$=RIGHT$(“NEPAL”,5) NEPAL 5+1=6

MID$( )This function returns specified number of characters from the specified position of a supplied string.Syntax : MID$(string, position, number)Example1 : MID$("COMPUTER", 4, 3)

Page 250: Green Computer

GREEN Computer Book-9250

This will return three characters of the string COMPUTER starting from the fourth position of the string i.e. P.It will return PUT.Example2 : C$="COMPUTER"MID$(C$, 2, 4)This will return four characters of the string COMPUTER starting from the second position of the string i.e. O.It will return OMPU.Lab sessionSolved ExampleREM program to reverse a stringC$="NEPAL"FOR J=5 TO 1 STEP -1 M$=MID$(C$,J,1) REV$=REV$+M$NEXT J PRINT "REVERSED STRING IS";REV$ENDDry run helps you to understand how the program will be executed.

J= 5 TO 1 M$=MID$(C$,J,1) REV$=REV$+M$ Output (REV$) J=J-1

5 M$=MID$(“NEPAL”,5,1) “”+“L” 5-1=44 M$=MID$(“NEPAL”,4,1) “L”+ “A” 4-1=33 M$=MID$(“NEPAL”,3,1) “L”+“A”+“P” 3-1=22 M$=MID$(“NEPAL”,2,1) “L”+“A”+“P”+“E” 2-1=11 M$=MID$(“NEPAL”,1,1) “L”+“A”+“P”+“E”+“N” “LAPEN” 1-1=0 FALSE

CHR$ functionPurpose: CHR$ returns the character corresponding to a specified ASCII code.Syntax: CHR$(ascii-code%)PRINT CHR$(65) → A

Page 251: Green Computer

Computer Book-9 251GREEN

PRINT CHR$(97) → aPRINT CHR$(122) → zPRINT CHR$(48) → 0PRINT CHR$(57) → 9PRINT CHR$(1) → smile face

STR$ functionPurpose: STR$ returns a string representation of a number.Syntax: STR$(numeric-expression)

Mathematical Function

INT functionPurpose: INT returns the largest integer less than or equal to a numericexpression. Syntax: INT (numeric-expression)For example 1:LET a=5.8LET b= INT(a)LET c=a-bPRINT a, b, cENDIn above program, INT is a function name and is numeric function, which operates on parameter x and the return value is stored in variable in b, i.e. 5.

SGN functionPurpose: SGN returns a value indicating the sign of a numeric expression (1 if the expression is positive, 0 if it is zero or 1 if it is negative).Syntax:

Page 252: Green Computer

GREEN Computer Book-9252

SGN (numeric-expression)Note: Numeric-expression is any valid numeric expression.PRINT SGN(1024) →1PRINT SGN(- 234) → -1PRINT SGN(0) → 0Write a program to decide whether an input number is positive, negative or zero using SGN function.REM to decide whether an input number is +ve or –ve or zeroINPUT “Enter a number:”;nLET a= SGN(n)IF a=0 THEN PRINT “The given number is zero:”;nELSEIF a=1 THEN PRINT “The given number is positive”;nELSE PRINT “The given number is negative”;nEND IFEND

VAL functionPurpose: VAL converts a string representation of a number to a number.Syntax: VAL(string expression$)Example: PRINT "Sample of STR$ and VAL function" LET a = 4 LET b = 5 PRINT a + b PRINT STR$(a) + STR$(b) REM val function test

Page 253: Green Computer

Computer Book-9 253GREEN

LET text$ = "HEDNEPAL 2006" LET b$ = "16 KHA KTM" PRINT VAL(text$), VAL(b$) PRINT VAL(RIGHT$(text$, 4))

LEN ( )This function counts numbers of characters that are present in the supplied string. A space is counted as one character if there is space used in the string. It is a mathematical function.Syntax : LEN(string)Example1 : LEN("COMPUTER")This will count number of characters in the supplied string COMPUTER and return 8 as there are eight characters in the string.Example2 : C$="QBASIC is a high level language"LEN(C$)This will count number of characters in the string including spaces. It will return 31.

SQR( )This function returns square root of a supplied number. It is a mathematical function.Syntax : SQR(number)Example1 : SQR(25)This will return square root of 25 i.e. 5.Example2 : N=100SQR(N)This will return square root of 100 i.e. 10.Lab session

Solved ExampleREM program to display the square root of a supplied number

Page 254: Green Computer

GREEN Computer Book-9254

CLSINPUT "Enter a number"; NSQ=SQR(N)PRINT "Square root of "; N; " is ";SQEND

ASC( )This function returns the ASCII value of a supplied character. ASCII stands for American Standard Codes for Information Interchange. There are 256 ASCII values ranging from 0 to 255 representing different characters, digits and symbols.Syntax : ASC(character)Example1 : ASC("A")This will return the ASCII value of the letter A. The letter A is represented by 65 in ASCII.So, it will return 65.

Solved ExampleREM program to display A to ZCLSFOR J=64 TO 92PRINT ASC(J),NEXT JEND

POINTS TO REMEMBER

1. IF……….THEN……….ELSE is a conditional statement.2. The combination of operators, variables and constants is known as an

expression.3. QBASIC statement is the word used in QBASIC to perform specific task

in a program.

Page 255: Green Computer

Computer Book-9 255GREEN

4. CLS clears the screen each time you run the program.5. REM statement is used throughout the program to explain what your

code is trying to accomplish.6. PRINT statement displays the value or values of variables on the screen.7. Input allows user to enter value to the variable during program execution.8. Library Functions are the set of executable block of instructions capable

of doing some specific tasks.9. UCASE$ () function converts the supplied string to capital letters.10. LCASE$() function converts the supplied string to small letters.11. MID$() function returns specified number of characters from the specified

position of a supplied string.12. LEN()function counts numbers of characters that are present in the

supplied string.

Exercise1. Write syntax and purpose of the following statements and functions.

a. INPUT b. PRINT c. IF…THEN….ELSE d. SELECT…..CASE e. LEN( ) f. MID$( )g. LEFT$( ) h. RIGHT$( ) i. UCASE$( )j. LCASE$( ) k. SQR( ) l. ASC( )

2. Write a program for the followinga. To calculate area of a rectangle. [A=l x b]b. To calculate perimeter of a rectangle. [P=2( l + b )]c. To calculate area of a circle. (A=pr²)d. To calculate perimeter of a circle. [P=2pr]e. To calculate sum of two different numbers.f. To calculate product of two different numbers.g. To calculate difference of two different numbers.h. To input three different numbers and decide the smallest number

amongst the three using IF…THEN statement.i. To input days of a week and decide “school day” or “holiday” using IF…THEN statement

Page 256: Green Computer

GREEN Computer Book-9256

j. To decide whether an input number is divided by 5 and 3 or not?k. To input any number from 0 to 9 and check whether it is single digit

number or not using SELECT CASE statement.l. To input name of the SAARC country and print name of their capital

city using SELECT CASE statement.

3. WAP to perform the following using library function.a. Write a program to return MAN from the word KATHMANDU.b. Write a program to return NEP from the word NEPAL.c. Write a program to return PAL from the word NEPAL.d. Write a program to return ASCII value of letter 'a'.e. Write programs to display following pattern: i. N ii. N E P A L iii. L A P E N iv. N E P A L NE NEPA E P A L NEP NEP P A L NEPA NE A L NEPAL N L

f. Write a program to return RETUPMOC from the word COMPUTER.

4. Write output of the following progammes. a. CLS b. CLS S$ = “Bharatpur” S$ = “Bharatpur” FOR K = 1 TO LEN(S$) FOR K = LEN(S$) TO 1 (STEP–1) R$ = RIGHT$(S$,K) R$ = LEFT$(S$,K) PRINT R$ PRINT R$ NEXT K NEXT K END END

Page 257: Green Computer

Computer Book-9 257GREEN

Looping in QBASIC18

Looping is another name for iteration where a set of statements executes more than once. A loop is defined as a set of instructions that repeat a block of statements to the given number of times or till the given condition is satisfied or until a certain condition becomes true. Programming process jumps forwards and backwards in looping. Loop helps us to do more works with lesser number of statements. There are three loop statements in QBASIC :1. FOR ……….NEXT 2. WHILE ……………. WEND 3. DO ………….. LOOPa. DO WHILE/ UNTIL……………..LOOPb. DO ……………LOOP WHILE/ UNTIL

FOR ……….NEXT Statement

Purpose: Repeats a block of statements for a specified number of times.Syntax:FOR counter = start TO End [STEP increment/ Decrement] [block of statement to be executed]NEXT counter Where, counter is a numeric variable used as the loop counter. Start and end are the initial and final values of the counter. Increment /decrement is the amount the counter is changed each time through the loop.

Use CTRL+ pause break key to stop infinite loop.

Page 258: Green Computer

GREEN Computer Book-9258

LAB Practice 1CLSREM to print first 5 natural numbersFOR CNT = 1 TO 5 PRINT CNT;NEXT CNTEND

LAB Practice 2Write a program to print sum of first 5 even numbers.CLSa=2Sum=0For i= 1 to 5 PRINT “Sum of the number:”; Sum Sum = Sum + a a=a+2NEXT iEND

LAB Practice 3REM to generate the following numbers 2,4,6,8,10,…50CLSFOR I = 2 to 50 Step 2 PRINT INEXT IEND

Dry RunCNT Output(CNT) CNT=CNT+11 1 1+1=2 2 2 2+1=33 3 3+1=44 4 4+1=55 5 5+1=6 FalseNote: If you don’t write step then qbasic suppose +1 itself

Dry Runa i Sum=Sum+a Sum(output) a=a+2 I=i+12 1 Sum=0+2 2 2+2=4 1+1=24 2 2+4 6 4+2=6 2+1=36 3 6+6 12 6+2=8 3+1=48 4 12+8 20 8+2=10 4+1=510 5 20+10 30 10+2=12 5+1=6

Page 259: Green Computer

Computer Book-9 259GREEN

LAB Practice 4REM generate the following numbers 5,10,15,…90CLSFOR I = 5 to 90 Step 5 PRINT INEXT IEND

LAB Practice 5REM to check a given number is prime or not.CLSINPUT “Enter any number”; na = 0FOR i = 1 TO n IF n MOD i = 0 THEN a = a + 1NEXT iIF a = 2 THEN PRINT “It is prime number”;ELSE PRINT “It is not prime number”;END IFEND

LAB Practice 6WAP to find the factorial of given number.CLSINPUT “Enter any number”; nf = 1FOR k = 1 TO n

Page 260: Green Computer

GREEN Computer Book-9260

f = f * kNEXT kPRINT “The factorial of given number is”; fEND

WHILE …………WEND statementPurpose: Executes a series of statements as long as specific condition is true.Syntax:WHILE conditionStatement blockWENDFlow chart of WHILE …..WEND statement

Start

Initial value of counter

IsCondition

True ?

Display output

Increase/ Decrease the

value of counter

Stop

Yes No

Page 261: Green Computer

Computer Book-9 261GREEN

Let us see an example to understand WHILE...WEND more clearly.

LAB Practice 5REM to print first 10 natural numbers.CLSI = 1WHILE I<=10 NO PRINT I ; I = I + 1WEND END

LAB Practice 6REM generate the following numbers 2,4,6,8,10….50CLSI = 2WHILE I < =50 PRINT I; I = I + 2WEND END

LAB Practice 7REM to print numbers stated below 1,3,5,7,9,…99CLS I = 1WHILE I <=99

Start

I=1

Is I<=10

Print I

I=I+1

Stop

Yes No

Page 262: Green Computer

GREEN Computer Book-9262

PRINT I; I = I + 2WEND END

LAB Practice 8REM to print numbers stated below1, 4, 9,…up to 10th term.CLS I=1WHILE I < =10 PRINT I^2; I = I + 1WEND END

LAB Practice 9REM to print numbers stated below10, 9, 8, 7…up to 1.CLS I=10WHILE I >1 PRINT I; I = I - 1WEND END

LAB Practice 10WAP to display HCF and LCM of given numbersCLSINPUT “ENTER ANY TWO NUMBERS”; A, BC = A

Page 263: Green Computer

Computer Book-9 263GREEN

D = BWHILE A MOD B < > 0T = A MOD BA = BB = TWENDL = C * D / BPRINT “H.C.F=”; BPRINT “L.C.M=”; LEND

DO - LOOP statementPurpose: Repeats a block of statements while a condition is true or until a condition becomes true.Syntax 1: (Pre-Test)DO [{WHILE | UNTIL} condition] [block of statement to be executed]LOOPExample:CNT = 1DO WHILE CNT <= 10 PRINT CNT ^ 2 CNT = CNT + 1LOOPENDSyntax 2: (Post Test)DO[Statement block]LOOP [{WHILE | UNTIL} condition]

Page 264: Green Computer

GREEN Computer Book-9264

LAB Practice 1CLSREM to find the square of first 10 natural numberCNT = 1DO PRINT CNT ^ 2 CNT = CNT + 1LOOP WHILE CNT <= 10END

LAB Practice 2REM to find the square of first 10 natural numbersCNT = 1DO PRINT CNT ^ 2 CNT = CNT + 1LOOP UNTIL CNT > 10END

LAB Practice 3REM to find sum of even digits and product of a digits of a given numbersCLSINPUT “Enter any multidigits number”; NS=0P=1DO WHILE N<>0 R = N MOD 10 IF R MOD 2 =0 THEN S=S+R ELSE P=P*R END IF

Page 265: Green Computer

Computer Book-9 265GREEN

N=N\10LOOPPRINT “Sum of digits is”; sPRINT “ Product of digits is”;pENDWAP to find the factorial of given number.

LAB Practice 4REM to find factorial of a given numberCLSINPUT “Enter any number”; nf = 1FOR k = 1 TO n f = f * kNEXT kPRINT “The factorial of given number is”; fEND

Nested LoopA loop inside another loop is called a nested loop.A nested loop executes from outer loop, then program executes inner loop. During the execution of inner loop, the value of outer loop remains constant.For instance,WHILE condition1 statement blocks WHILE condtion2 ………… statement blocks inner loop outer loop WEND ……………. …………….WEND

Page 266: Green Computer

GREEN Computer Book-9266

REM program for nested loopCLSPRINT “ ............ “PRINT “value of x”,”value of y”PRINT “ ............ “LET x = 80WHILE x>=60LET y = 100WHILE y <= 500 PRINT x, y y=y + 100WEND PRINT x = x - 100WENDENDSyntax (nested loop FOR……NEXT)FOR cv1 = start value TO end value STEP[I/D] FOR cv2 =start value TO end value STEP[I/D] (Block of statement to be executed)NEXT cv2NEXT cv1

ExampleCLSREM to display number patternFor I = 1 TO 5 STEP 1 FOR J= 1 TO I STEP 1 PRINT j; NEXT J PRINTNEXT I

Dry RunI J=1 TO I J (output) J = J + 1 I = I + 11 1 To 1 1 1 + 1 = 2 (T) 1 + 1 = 2 (T)2 1 TO 2 12 2 + 1 = 3 (T) 2 + 1 = 3 (T)3 1 TO 3 123 3 + 1 = 4 (T) 3 + 1 = 4 (T)4 1 TO 4 1234 4 + 1 = 5 (T) 4 + 1 = 5 (T)5 1 TO 5 12345 5 + 1 = 6 (F) 5 + 1 = 6 (F)

Page 267: Green Computer

Computer Book-9 267GREEN

Exercise1. Answer the following questions. a. What is looping? b. List out the types of loop statements in QBASIC. c. Write purpose and syntax of FOR….NEXT statement. d. Write purpose and syntax of WHILE…..WEND statement. e. What happens if you don’t write stem in FOR… NEXT statement.2. Debug the following program: CLS CLS REM to print your name 5 times REM to print table of 9. INPUT “ Enter your name: $N P=9 FOR A= 1 TO 5 STEP -1 C=1 PRINT “My name is:”;$N WHILE C<=10 NEXT A T=P*C END PRINT T C=C-1 WEND END CLS REM to print length and third three characters of input string INPUT “Enter a string”; N$ L = LEN$(N$) ch= MID(N$, 3) PRINT L, ch END3. Write a program for the following: a. To print multiplication table of 7.(eg. 7x1=7) [FOR..NEXT] b. To print your mother’s name 15 times. [WHILE…WEND] c. To print numbers from 15 to 1. [FOR..NEXT] d. To print sum of odd numbers between 2 and 20. [WHILE…WEND] e. To print the series 1, 8, 27…..up to 10th term. f. To print the series 1,1,2,3,5,8……….up to 10th term. g. To print the following output: i. 5, 10, 15……up to 50

Page 268: Green Computer

GREEN Computer Book-9268

ii. 70, 65,60…..up to 10 iii. 5, 55, 555 up to 5th terms h. To accept any string and print the vowel letters. i. To accept any string and print its reverse. j. To input any string and check whether it is palindrome or not. k. To enter any string and print number of vowel letters. l. To enter any sentence and print number of words in the sentence. m. To enter any string and replace the vowel letters with “*” character.

n. Write a program to enter any multi digit number and find sum of the digits.

o. Write a program to enter any multi digit number and find the sum of even digits and product of odd digit.

p. Write a program to enter any numbers and print its factors. q. Write a program to print the following output of “NEPAL”. i. N ii. N NE E NEP P NEPA A NEPAL L iii. LAPEN iv. NEPAL NEPA NEP NE N r. To print the following output (nested loop) i. 1 ii. 12345 12 1234 123 123 1234 12 1 iii. 54321 iv. 1234 5432 1234 543 1234 54 1234 5

Page 269: Green Computer

Computer Book-9 269GREEN

ARRAY in QBASIC19

An array is a special type of variable with an unique name, size and type. In other words, an array is a data structure that stores multiple values of similar type with a common name but having different subscript. An array is defined by using DIM statement. An array consists of a group of consecutive storage locations, each location containing a single element location containing a single element. The entire array is given one name and any particular element within the array is indicated by its position in the array. Eg: A(1 to 7)

78 98 45 56 67 89 75A(1) A(2) A(3) A(4) A(5) A(6) A(7)

To gain access to a single assignment score within the array, an array subscript or index is used. A subscript is a value enclosed in parentheses that identifies the parentheses that identifies the position of a given element in the array.There are two types of array:

Single Dimensional Array:An array having series of similar type of data represented by a variable with a single subscript or index value known as single dimensional array. Example: DIM NUM (6). It defines a single dimensional array having named NUM having six sub-scripted variables.

Multidimensional Array:An array having series of similar type of data represented by a variable with double subscripts is known as multidimensional array.

Page 270: Green Computer

GREEN Computer Book-9270

One or Single Dimensional Array:A list of quantities can be given one variable name using only one subscript and such a variable is called a single subscripted variable. A single subscripted variable is also called as single dimensional array or variable. For e.g. a set of five numbers say (19,17,11,3,-5) can be represented in an array as x(5). Where x is an array name and 5 is subscript or index.

Cells QuantitiesX(1) 19X(2) 17X(3) 11X(4) 3X(5) -5

DIM statementSyntax: DIM array_name(number_of_items) AS datatype

Example: DIM X ( 1 TO 5)

The data can be read into the memory as follows:Example: 1DIM X(1 to 5)FOR I = 1 TO 5READ X ( I )PRINT X(I)NEXT IDATA 19,17,11,3,-5END

Example: 2CLSFNames(1) = “Joe”

Page 271: Green Computer

Computer Book-9 271GREEN

FNames(2) = “Jim”FNames(3) = “Jill”FNames(4) = “Joan”FNames(5) = “Jan”

FOR x = 1 TO 5 PRINT FNames(x)NEXT xEND

Example: 3DIM Num(5) AS INTEGERDIM x AS INTEGERDIM Sum AS INTEGERCLSNum(1) = 15Num(2) = 20Num(3) = 5Num(4) = 10Num(5) = 10Sum = 0FOR x = 1 TO 5 Sum = Sum + Num(x)NEXT xPRINT “The Sum Is:”; SumEND

Example :4REM to print greatest number among 10 different input numbers.DIM N(1 TO 10)

Page 272: Green Computer

GREEN Computer Book-9272

FOR I = 1 TO 10 INPUT “Enter 10 different numbers”; N(I)NEXT IMAX=N(1)FOR J = 2 TO 10 IF N(J)>MAX THEN MAX=N(J) END IF NEXT J PRINT “the greatest number is”;MAXEND

Two or Double Dimensional Array:When a list of quantities can be given one variable name using two subscript, such a variable is called a double subscripted variable or two dimensional array. Consider the following table of number:

A B C DX(4) 2 4 8 10Y(4) 4 3 5 7Z(4) 3 7 13 17

These values can be stored in 3 subscripted variable each representing a single array. Instead of single two dimensional array could be used, if this is done and a new array variable is named V, the variable takes the form of V (3,4).Cells of V

1 1,1 1,2 1,3 1,42 2,1 2,2 2,3, 2,43 3,1, 3,2 3,3 3,4

Description:Multi-Dimensional Arrays are several arrays that are combined into one. Some examples where a two dimensional array might be used would be a chess

Page 273: Green Computer

Computer Book-9 273GREEN

board, grid, and a deck of cards. We will create a 2D (Matrix) array for a deck of cards. In a deck of cards, there are 4 suits and 13 ranks per suit.The suits are: Diamonds, Spades, Hearts, ClubsThe ranks are: 2, 3, 4, 5, 6, 7, 8, 9, 10, Jack, Queen, King, AceWe can create a 2D array from the array of suits and the array of ranks.This is the code to create a multi-dimensional array for a deck of cards:

Example1DIM x AS INTEGERDIM y AS INTEGERDIM Suit(4) AS STRINGDIM Rank(13) AS STRINGDIM Cards(4, 13) AS STRINGSuit(1) = “D”Suit(2) = “S”Suit(3) = “H”Suit(4) = “C”Rank(1) = “2”Rank(2) = “3”Rank(3) = “4”Rank(4) = “5”Rank(5) = “6”Rank(6) = “7”Rank(7) = “8”Rank(8) = “9”Rank(9) = “10”Rank(10) = “Jack”Rank(11) = “Queen”Rank(12) = “King”

Page 274: Green Computer

GREEN Computer Book-9274

Rank(13) = “Ace”FOR x = 1 TO 4 FOR y = 1 TO 13 Cards(x, y) = Suit(x) + Rank(y) NEXT yNEXT xFOR x = 1 TO 4 FOR y = 1 TO 13 PRINT Cards(x, y) + “ “; NEXT yNEXT xEnd

Example 2REM to find row wise sumDIM N(3,4)CLSFOR K= 1 TO 3 SUM=0 FOR J = 1 TO 4 READ N(I, J) PRINT N(I,J) SUM=SUM+N(I, J)NEXT J PRINT SUMNEXT IDATA 2,3,4,5,6,4,7,8,6,7,8,9,8END

Page 275: Green Computer

Computer Book-9 275GREEN

Exercise1. Answer the following questions: a. Define an array? Why is array important? b. Explain the types of array. c. Write syntax and purpose of DIM statement. d. What is subscript in array? e. What is the meaning of array element.

2. Write the following programs using array.

a. Write a program to enter 10 different numbers in descending order.b. Write a program to enter 10 different numbers and find the sum of 3rd

and 5th element.c. Write a program to enter 15 different numbers and print their sum.d. Write a program to enter 15 different numbers and print the sum of

even elements.e. Write a program to enter 15 different numbers and print the sum of

odd numbers.f. Write a program to enter 10 different numbers and print the smallest

number.g. Write a program to enter 10 different names and print the longest name.h. Write a program to enter 10 different names and print the shortest

name.i. Write a program to enter 10 different strings and print those, whose

first letter is “A”.j. Write a program to enter 15 different strings and print those, whose

last letter is “r”.k. Write a program to enter 10 different names and print the vowel letters

of each name.

Page 276: Green Computer

GREEN Computer Book-9276

Glossary of the terms:A microprocessor is a computer processor that incorporates the functions of a central processing unit on a single integrated circuit (IC), or at most a few integrated circuits.

A biochip is a collection of miniaturized test sites (microarrays) arranged on a solid substrate that permits many tests to be performed at the same time in order to achieve higher throughput and speed. Typically, a biochip’s surface area is no larger than a fingernail.

A terminal is an electronic communication hardware device that handles the input and display of data. It may be a PC or workstation connected to a network, Voice over Internet Protocol (VOIP) network endpoint, mobile data terminal such as a telemetric device, or a text terminal, or textual language interface.

A Holter monitor is a machine that continuously records the heart’s rhythms. The monitor is worn for 24 to 48 hours during normal activity.

A slot, or expansion slot , is an engineered technique for adding capability to a computer in the form of connection pinholes (typically, in the range of 16 to 64 closely-spaced holes) and a place to fit an expansion card containing the circuitry that provides some specialized capability, such as video .

AGP: (Accelerated Graphics Port) An earlier hardware interface from Intel for connecting a graphics card (display adapter) to a PC.

A graphic designer is a professional within the graphic design and graphic arts industry who assembles together images, typography, or motion graphics to create a piece of design. A graphic designer creates the graphics primarily for published, printed or electronic media, such as brochures (sometimes) and advertising.

A simulation is an imitation of the operation of a real-world process or system. It is the process of building and using a time based visual model that emulates every significant step that occurs in a process and every significant interaction between resources in a process so as to gain insight about the impact of potential decisions on that process.

An obligation is a course of action that someone is required to take, whether legal or moral.

A repository can be a place where multiple databases or files are located for distribution over a network, or a repository can be a location that is directly accessible to the user without having to travel across a network.

Page 277: Green Computer

Computer Book-9 277GREEN

Computer-aided design (CAD) is the use of computer programs to create, modify, analyze and document two- or three-dimensional (2D or 3D) graphical representations of physical objects as an alternative to manual drafts and product prototypes.

Computer graphics (CG) are any image media, usually movies and pictures that are created through the use of hardware and software.

CSS is the language for describing the presentation of Web pages, including colors, layout, and fonts.

Cloud computing refers to Internet-based computing in which different services like servers, storage, and applications are delivered to an organization’s computers and devices through the Internet.

Dedicated applications are custom-made and they reflect the nature of the customer and his business. Preparing for the design of a dedicated system, we listen to the needs of the client, we get to know the nature of his business, and on this basis we prepare the concept of implementation which is the best for him,. Depending on the chosen model, we prepare plan to launch a Web application; desktop system or a mobile application.

Downloading is the process of copying data from Internet to your computer.

DNS server is a computer server that contains a database of public IP addresses and their associated hostnames.

Ethernet is the most widely installed local area network (LAN) technology. Ethernet is a link layer protocol in the TCP/IP stack, describing how networked devices can format data for transmission to other network devices on the same network segment, and how to put that data out on the network connection.

Encryption is the process of using an algorithm to transform information to make it unreadable for unauthorized users.

Facilitator is a person or thing that makes an action or process easy or easier.

Gallium is a soft, silvery metal used primarily in electronic circuits, semiconductors and light-emitting diodes (LEDs).

Gallium Arsenide (GaAs) is a compound semiconductor: a mixture of two elements, Gallium (Ga) and Arsenic (As).

Globalization is a process of interaction and integration among the people, companies, and governments of different nations, a process driven by international trade and investment and aided by information technology.

Page 278: Green Computer

GREEN Computer Book-9278

Graphics file is a computer file that contains an image or picture in digital format.

Graphics software refers to a program or collection of programs that enable a person to manipulate images or models visually on a computer.

Intellectual property (IP) refers to creations of the mind, such as inventions; literary and artistic works; designs; and symbols, names and images used in commerce.

Interactive Computer Graphics involves a two way communication between computer and user.

Laser beams are used to read information from CDs in CD players. The shiny surface of a CD contains microscopic pits in a spiral track. The pattern of pits contains digital information. The laser light is reflected off the surface of the CD as the disk spins, and is detected: The change in the amount of reflected light caused by entering or leaving a pit is interpreted as a 1 and no change in the amount of reflected light is interpreted as a 0.

Linux is a free open source operating system (OS) based on UNIX that was created in 1991 by Linus Torvalds. Users can modify and create variations of the source code, known as distributions, for computers and other devices. The most common use is as a server, but Linux is also used in desktop computers, smart phones, e-book readers and gaming consoles, etc.

Legitimacy is the right and acceptance of an authority, usually a governing law or a régime. Whereas “authority” denotes a specific position in an established government, the term “legitimacy” denotes a system of government—wherein “government” denotes “sphere of influence”.

Multiprocessing is the use of two or more central processing units (CPUs) within a single computer system. The term also refers to the ability of a system to support more than one processor or the ability to allocate tasks between them.

Monochrome monitors are computer monitors that display a single color against a solid background. It is also known as monochromatic monitors.

Multimedia is the field concerned with the computer-controlled integration of text, graphics, drawings, still and moving images (Video), animation, audio, and any other media where every type of information can be represented, stored, transmitted and processed digitally.

Page 279: Green Computer

Computer Book-9 279GREEN

Modularity: In software engineering, modularity refers to the extent to which a software/Web application may be divided into smaller modules. Software modularity indicates that the number of application modules are capable of serving a specified business domain.

Non interactive computer graphics also known as passive computer graphics, the observer has no control over the image.

Object code is produced when an interpreter or a compiler translates source code into recognizable and executable machine code. Object code is a set of instruction codes that is understood by a computer at the lowest hardware level.

Parallel Processing and Data Transfer Modes in a Computer System. Instead of processing each instruction sequentially, a parallel processing system provides concurrent data processing to increase the execution time.

Pseudocode is an informal high-level description of the operating principle of a computer program or other algorithm. It uses the structural conventions of a normal programming language, but is intended for human reading rather than machine reading.

Computer based images are comprised of thousands of tiny dots of colour called pixels.

Raster graphics are the most common and are used for digital photos, Web graphics, icons, and other types of images.

Resolution indicates the number of pixels that are displayed per inch for an image (or pixels per centimeter).

Strategy is a plan of action designed to achieve a long-term or overall aim.

Source code is the fundamental component of a computer program that is created by a programer. It can be read and easily understood by a human being. Search engine helps you to search a piece of information from the Internet.

The Internet is a global system of interconnected computer networks that use the standard Internet protocol suit (TCP/IP) to serve billions of users worldwide.

Unix is a portable, multitasking, multiuser, time-sharing operating system (OS) originally developed in 1969 by a group of employees at AT&T. Unix was first programd in assembly language but was reprogramd in C in 1973.

URL contains the name of the protocol to be used to access the resource and the resource name.

Page 280: Green Computer

GREEN Computer Book-9280

Uploading means data is being sent from your computer to the Internet.

Virtual memory is a memory management capability of an OS that uses hardware and software to allow a computer to compensate for physical memory shortages by temporarily transferring data from random access memory (RAM) to disk storage.

In computer science, the Boolean data type is a data type that has one of two possible values (usually denoted true and false), intended to represent the two truth values of logic and Boolean algebra.

In formal language theory and computer programming, string concatenation is the operation of joining character strings end-to-end. For example, the concatenation of “snow” and “ball” is “snowball”.

Vector graphics, are made up of paths, which may be lines, shapes, letters, or other scalable objects. They are often used for creating logos, signs, and other types of drawings.

Web browser is a software application that allows you to access websites and view web pages once you are connected to the Internet.

Web server a computer program that distributes web pages as they are requisitioned.

Website is a collection of publicly accessible, interlinked Web pages that share a single domain name.

Page 281: Green Computer

Computer Book-9 281GREEN

Full form4GL Fourth Generation LanguageABC Atanasoff Berry ComputerAC Alternating CurrentADSL Asymmetric Digital Subscriber lineAGP Accelerated Graphics PortAI Artificial IntelligenceALU Arithmetic Logic UnitAM Amplitude ModulationARP Address Resolution ProtocolARPA Advanced Research Projects AgencyARPANet Advanced research Projects Agency NetworkASCII American Standard Code for Information InterchangeAT Advance TechnologyATM Automated Teller MachineAVG Antivirus GuardAVI Audio video interleaveB2B Business to BusinessBASIC Beginner’s All Purpose Symbolic Instruction CodeBCD Binary Coded DecimalBCDIC Binary Coded Decimal Interchange CodeBCR Bar Code ReaderBIOS Basic Input Output Systembits Binary DigitsBMP Bitmapbps bits per secondCA Certificate AuthorityCAD Computer Aided DesigningCAI Computer Aided InstructionCAL Computer Aided LearningCAM Computer Aided ManufacturingCAN Campus Area NetworkCAT Computer Aided Training

Page 282: Green Computer

GREEN Computer Book-9282

CBE Computer Based EducationCBT Computer Based TrainingCCTV Closed Circuit TelevisionCD Compact DiskCDFS Compact Disk File SystemCDR Compact Disk RecordableCD-ROM Compact Disk - Read Only MemoryCD-RW Compact Disk-RewritableCGA Colour Graphics AdaptorCGI Common Gateway InterfaceCIS Computer Information SystemCMOS Complementary Metal Oxide SemiconductorCOBOL Common Business Oriented LanguageCPS Characters per secondCPU Central Processing UnitCRT Cathode Ray TubeCSU/DSU Channel Service Unit/Digital Service UnitCUI Character user InterfaceCVT Constant Voltage TransformerDARPA Defense Advanced Research Projects AgencyDBMS Database Management SystemDCU Device Control UnitDDE Dynamic Data ExchangeDDP Distributed Data Processing / Datagram Delivery ProtocolDHCP Dynamic Host Configuration ProtocolDMA Direct Memory AccessDMV Dahila Mosiac VirusDPI Dots Per InchDRAM Dynamic Random Access MemoryDSDD Double Sided Double DensityDSHD Double Sided High DensityDSS Digital Satellite SystemDSS Data Security Standards

Page 283: Green Computer

Computer Book-9 283GREEN

DTH Direct To HomeDVD Digital Versatile DiskDVD-R Digital Versatile Disk-RecordableDVD-ROM Digital Versatile Disk-Read Only memoryDVD-RW Digital Versatile Disk-RewritableE-Commerce Electronic CommerceEDCDIC Extended Binary Coded Decimal Interchange CodeEDI Electronic Data InterchangeEDO-ROM Extended Data Out-Random Access MemoryEDP Electronic Data ProcessingEDS Electronic Data StorageEDSAC Electronic Delay Storage Automatic ComputerEDVAC Electronic Discrete Variable Automatic ComputerEEPROM Electrically Erasable Programmable Read Only MemoryE-Fax Electronic FaxEGA Enhanced Graphic AdaptorE-Mail Electronic MailEMI Electro Magnetic InterferenceEMS Electro magetic SystemENIAC Electronic Numerical Integration and CalculatorEOF End of FileEPROM Erasable Programmable-Read Only MemoryFAQ Frequently Asked QuestionsFAT File Allocation TableFAX FacsimileFCRA Fair Credit Reporting ActFDD Floppy Disk DriveFDMA Frequency Division Multiple AccessFORTRAN Formula TranslationFTP File Transfer ProtocolG2C Government To CitizenG2G Government To GovernmentGaAS Gallium Arsenide

Page 284: Green Computer

GREEN Computer Book-9284

GB Giga ByteGBps Gigabits Per SecondGHz Giga HertzGIF Graphics Interchange FormatGIGO Garbage In Garbage OutGIS Geographical Information SystemGPL General Public LicenseGPRS General Packet Radio ServiceGPS global Positioning SystemGSM Global System for Mobile CommunicationGUI Graphical User InterfaceHDD Hard Disk DriveHF High FrequencyHLCIT High Level Commission For Information and TechnologyHP Hewlett - PackardHTML Hyper Text Markup LanguageHTTP Hyper Text Transfer ProtocolHz HertzI/O Input/OutputIAB Internet Architecture BoardIBM International Business MachineIBT Internet Board TrainingIC Integrated CircuitICF Internet Connection FirewallICT Information and Communication TechnologyIDE Integrated Drive ElectronicsIDS Intrusion Detection SystemIDS Industry Detection SystemIE Internet ExplorerIEEE Institute Of Electrical And Electronics EngineersIEFIP Internet Federation Of Information ProcessingIETF Internet Engineering Task ForceIIS Internet Information Services

Page 285: Green Computer

Computer Book-9 285GREEN

IM Instant messagingIMS Information Management SystemINTERNET International NetworkIP Internet ProtocolIRC Internet Relay ChatIS Information systemISA Industry Standard ArchitectureISDN Integrated Services Digital NetworkISO International Organization for StandardizationISOC Internet SocietyISP Internet Service ProviderIT Information TechnologyITPDC Information Technology Park Development CouncilITSP International Telephony Service ProviderJPEG Joint Photography Experts GroupKB Kilo ByteKbps Kilobits per secondKHz kilo HertzLAN Local Area NetworkLCD Liquid Crystal DisplayLED Light Emitting DiodeLSI Large Scale IntegrationMAC Media Access ControlMB Mega byteMbps Mega bits per secondMBR Master Boot RecordMIDI Musical Instrument Digital InterfaceMIME Multipurpose internet Mail ExtensionsMIPS Million Instructions Per SecondMMC Multimedia CardMMS Multimedia Messaging ServiceMODEM Modulator demodulatorMOST Ministry of Science and Technology

Page 286: Green Computer

GREEN Computer Book-9286

MP3 Moving Picture Experts Group Phase 3MPCD Metropolitan Police Crime DivisionMPEG Moving Picture Experts GroupMPPP Multilink Point To Point ProtocolMSAU MultiStation Access UnitMSAV Microsoft Anti-virusMS-DOS Microsoft Disk Operating SystemNAC Network access controlNAV Norton AntivirusNetBIOS Network Basic Input Output SystemNIC Network Interface CardNITC National Information Technology CenterNITCC National Information Technology Co-ordination CommitteeNITDC National Information Technology Development CouncilNOS Network Operating SystemNTC Nepal TelecomNTFS New Technology File SystemOLE Object Linking And EmbeddingOS Operating SystemOSS Open- Source SoftwareP2P Peer -to -PeerPC Personal ComputerPCO Public Call OfficePDA Personal Digital AssistantPDF Portable Document FormatPIN Personal Identification NumberPixel Picture CellPOP Post Office ProtocolPOP3 Post Office Protocol Version 3POST Power On Self TestPPP Point-to-Point ProtocolPPPOE Point to Point Over EthernetPSK Pre - Shared KeyPSK Phase Shift Keying

Page 287: Green Computer

Computer Book-9 287GREEN

PSTN public Switched Telephone NetworkPSU Power Supply UnitPTT Push To TalkPUK Pin Unlock Key/Personal Unblocking KeyQOS Quality Of ServiceR/W Read/ WriteRARP Reverse Address Resolution ProtocolRDMBS Relational Database Management SystemRF Radio FrequencyRGB Red Green BlueRIP Routing information ProtocolRJ-45 Registered Jack-45RTF Rich Text FormatRTP Real Time Transport ProtocolRTS Real Time StrategySC Subscriber ConnectorSDSL Symmetric Digital Subscriber lineSGML Standard Generalized Markup LanguageSHF Super High FrequencySIM subscriber identity ModuleSIS Secret Intelligence ServiceSMA Screw-Mounted AdaptorsSMPS Switched Mode Power SupplySMS Short Message ServiceSMTP Simple Mail Transfer ProtocolSNA System Network ArchitectureSQL Structured Query LanguageST Straight Tip ConnectorSTD Subscriber Trunk DialingSTP Shielded Twisted PairSVGA Super Video Graphics ArrayTB Tera ByteTCP/IP Transmission Control Protocol /Internet Protocol

Page 288: Green Computer

GREEN Computer Book-9288

TelNet Telecommunication NetworkTFT Thin Film TransistorTFTP Trivial File Transfer ProtocolUDP User Datagram ProtocolUHF Ultra High FrequencyUPS Uninterruptible Power SupplyURL Uniform Resource LocatorUSB Universal Serial BusUse Net User NetworkUTP Unshielded Twisted PairVCD Video Compact DiskVDT Video Display TerminalVDU Video Display UnitVLAN Virtual Local Area NetworkVM Virtual MachineVR Virtual RealityW3C World Wide Web ConsortiumWAV Waveform Audio File FormatWI MAX Worldwide Interoperability For Microwave AccessWi-Fi Wireless FidelityWindows NT Windows NetworkWindows XP Windows ExperienceWLAN Wireless Local Area NetworkWMV Windows Media VideoWORM Write Once, Read ManyWWW World Wide Web