0% found this document useful (0 votes)
18 views251 pages

Computer Applications

Uploaded by

krissshh82
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
0% found this document useful (0 votes)
18 views251 pages

Computer Applications

Uploaded by

krissshh82
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 251

What is a computer?

(overview of a computer )
● A computer is an electronic device that accepts
input ,processes data ,stores data ,and produces
output, according to a series of instructions.
● Hardware refers to the physical components of the
computer such as keyboard, monitor etc.
● Software is the instructions or program that makes
the computer work.
● User is a person who operates the computer
system.

● Data is the collection of unprocessed items which


caninclude text, numbers, images, audio and
video.
● Information is the processed data with definite
meaning.
● A program consists of step-by-step instructions
that tell the computer how to do its work.

Computer system’s characteristics and compatibilities:

🞂 High speed

🞂 Accuracy

🞂 Storage capacity
🞂 Versatile

🞂 Reduced Cost

🞂 Reliability

Computer systems CHRACTERISTICS and capabilities:

❖High speed : Computer works at very high speed


and is much faster than human beings. It processes
millions of instructions per second.

❖Accuracy : Computer gives accurate result for the


correct input data. It can accurately perform all
kinds of complex computations.

❖Storage capacity : Computer can store large


amount of data using magnetic devices such as
hard disk, DVDs, pen drives etc.

❖Versatile

It can perform all kind of jobs simultaneously such


as calculation, searching etc.

❖Reduced Cost : As the technology is being


advanced thecost of the system is also reduced.
Computers reduces the amount of paper work and
human effort, thereby reducing the cost.

❖Reliability : Computer is free from tiredness and


lack of concentration. It can work continuously.
Repetitive tasks can also be done.
Functional COMPONENTs of a Computer:

❖A computer is designed using four units. They are:

❖1.Input Unit

❖2. Central Processing Unit(CPU)

❖a) Control Unit (CU)

❖b) Arithmetic and Logic Unit(ALU)

❖c) Registers

❖3. Memory Unit

❖a)Main memory

❖b)Secondary memory
❖4. Output Unit

INPUT UNIT:
An input device is any hardware component that allows
to enter data and instructions into a computer. Some of
the input devices are keyboard, mouse, microphone,
scanner.
CENTRAL PROCESSING UNIT:
The CPU is the main part of a computer. It is also
known as heart or brain of the computer system as it
follows the instructions of the software/program to
manipulate data into information.
It consists of three major units:
i. Control Unit
ii. Arithmetic and Logic Unit
iii. Registers
CONTROL UNIT:
Control unit controls and directs the transfer of
program instructions and data between various units.
ARITHEMATIC AND LOGIC OPERATOR (ALU):
The ALU of a computer system is the place where the
actual execution of the instructions takes place during
the processing operation. It performs
⮚ Arithmetic operations like addition(+),
subtraction(-), multiplication(*) and division(/).

⮚ Logical operations like AND, OR, NOT.

⮚ Relational operations like greater than(>), lesser


than(<)etc.
REGISTERS:
The CPU consists of a number of temporary storage
units, which are used to store instructions, and
intermediate data, which may be generated during
processing.
MEMORY UNIT: Memory unit is used for storing
information or data in the computer system.
Primary memory will store data temporarily and it
can store less amount of data.
Secondary storage devices are additional memory
devices such as floppy disks, magnetic tapes, hard
disks, compact disks etc. which are used to store huge
information for future use.
The input unit, output unit and secondary storage
devices are together known as peripheral devices.
OUTPUT UNIT:
An output device is any hardware component that
conveys information(output) to the user. Commonly
used output devices are printer, monitor and speakers.
1 MARK QUESTIONS
1)What is a computer?
2)What is hardware?
3)What is software?
4) What is data?
5) What is information?
6) What is program?
7)Mention the characteristics of computers.
8)Explain any one characteristics of computer.
9) What is an input device?
10) Mention any two input devices.
11) Expand CPU.
12) Mention the units of CPU.
13) What is the function of control unit?
14) Expand ALU.
15) What is the function of ALU?
16) What are registers?
17) What is the use of memory unit?
18) Mention the different types of memory.
19) Mention any two secondary storage devices.
20) What are peripheral devices?
21) What is an output device?
22) Mention any two output devices.
2 MARK QUESTIONS
1)Explain any two characteristics of computer.
2)Mention the functional components of a
computer.
3)Draw the block diagram of a computer.
4)Explain memory unit.
5 MARK QUESTIONS
1) Explain the characteristics of computer.
2) Explain the functional units of a computer with
a neat block diagram.

FIVE GENERATIONS OF MODERN


COMPUTERS
Computer generation means a step of advancement in
technology both in hardware and software. It also
reflects the growth of computer industry.
FIRST GENERATION COMPUTERS(1940-1956)
Harvard H. Aiken produced an electronic computer
Mark I. Later, John Presper Eckert and John W. Mauchly
developed ENIAC (Electronic Numerical Integrator and
Computer), which was a general purpose computer
1000 times faster than Mark I.
John Von Neumann designed Electronic Discrete
Variable Automatic Computer (EDVAC). Later, UNIVAC I
(Universal Automatic Computer) was developed. It was
the first commercially available electronic digital
computer.
FEATURES OF FIRST GENERATION COMPUTERS

⮚ Vacuum tubes for internal operations.

⮚ Magnetic drums were used for memory.

⮚ Punched card and paper tapes were used for input


and paper printout for output.

⮚ Low level languages for programming were used.

⮚ Processing speed was very slow.

⮚ It was very expensive.


⮚ The system was not very powerful .

⮚ The system was huge and non portable.

⮚ It did not have much memory.

⮚ Could solve only one problem at a time.

SECOND GENERATION COMPUTERS (1956-1963)


Second generation of computers used transistors
in place of vacuum tubes. High level languages such as
COBOL(COmmon Business Oriented Language),
FORTRAN(FORmula TRANslator) etc. were used during
this time.
FEATURES OF SECOND GENERATION COMPUTERS

⮚ Transistors were used for internal operations.

⮚ Moved from machine level language to assemble

level language

⮚ Punched cards for input and printouts for output. .

⮚ Magnetic core for main memory was used .


⮚ Magnetic tapes and disks were used for secondary
memory.

⮚ High Level Languages were used for developing


programs.

⮚ The systems were faster, more powerful, more


reliable, cheaper, smaller in overall size and had
more memory.
THIRD GENERATION COMPUTERS (1964-1971)
Integrated circuits(IC) replaced transistors. It
was developed by Jack Kilby. Instead of punched
cards and paper printouts, keyboard and monitors
were introduced for input
and output .Magnetic hard drives were used for
storage. More advanced high level languages like
PASCAL were used.
FEATURES OF THIRD GENERATION COMPUTERS

⮚ Integrated circuits were used for internal


operations.

⮚ Use of operating systems, which allowed


computers to run different programs at once.
⮚ Keyboards and monitors were introduced as input
and output devices.

⮚ Magnetic disks such as hard disk, floppy disk were


used as secondary storage devices.

⮚ Mini computers were introduced.

⮚ The system were faster ,more reliable, cheaper,


smaller in overall size and had more memory.

FOURTH GENERATION COMPUTERS (1971- 1990)


Fourth generation may be called Microcomputer
generation. Thousands of integrated circuits were built
on a single silicon chip called microprocessor. IBM
introduced its personal computer(PC) for use in 1981.
FEATURES OF FOURTH GENERATION COMPUTERS

⮚ Introduction of microprocessors.

⮚ Microcomputers was available to the common man.

⮚ Use of chips for memory.

⮚ The cost of assembling reduced.


⮚ Hardware failure were negligible

⮚ User friendly systems.

⮚ Networking became common, and the whole world


is connected by the internet.

⮚ The system were faster ,more powerful, more


reliable, cheaper, smaller in overall size and had
more memory.
FIFTH GENERATION COMPUTERS (BEYOND 90’S)
Fifth generation computers will work on artificial
intelligence i.e; computer has to think, analyse, learn,
make decisions etc. on its own. This generation of
computers will use multiple microprocessors. Voice and
touch are expected to be a primary means of input.
FEATURES OF FIFTH GENERATION COMPUTERS

⮚ Development of storage technology.

⮚ Advancement in networking technology.

⮚ System are reliable, faster, and cheaper.

⮚ Development of super computers.


⮚ Concept of parallel processing in computers.

⮚ Computers are more intelligent.

⮚ Development of robots to assist human beings.

⮚ 1 MARK QUESTIONS

⮚ 1) Which is the first all-electronic computer?

⮚ 2) Who developed MARK I?

⮚ 3) Who developed the first all-electronic


computer?

⮚ 4) Expand ENIAC.

⮚ 5) Who developed ENIAC?

⮚ 6) Expand EDVAC.

⮚ 7) Who developed EDVAC?

⮚ 8) Expand UNIVAC.

⮚ 9) Name few first generation computers.


⮚ 10) Which is the basic electronic component of
the first generation systems?

⮚ 11) Which is the basic electronic component of


the second generation systems?

⮚ 12) Expand COBOL.

⮚ 13) Expand FORTRAN.

⮚ 14) Which is the basic electronic component of


the third generation systems?

⮚ 15) What does IC stand for?

⮚ 16) Who developed IC?

⮚ 17) Which is the basic electronic component of


the fourth generation systems?

⮚ 18) What is microprocessor?

⮚ 19) Name the technology used in the fifth


generation computers.

⮚ 2 MARK QUESTIONS
⮚ 1) Write any two features of the first generation
computers.

⮚ 2) Write any two features of the second


generation computers.

⮚ 3) Write any two features of the third generation


computers.

⮚ 4) Write any two features of the fourth


generation computers.

⮚ 5) Write any two features of the fifth generation


computers.

⮚ 5 MARK QUESTIONS

⮚ 1) Write the features of the first generation


computers.

⮚ 2) Write the features of the second generation


computers.

⮚ 3) Write the features of the third generation


computers.
⮚ 4) Write the features of the fourth generation
computers.

⮚ 5) Write the features of the fifth generation


computers.

EVOLUTION OF COMPUTERS
Abacus: Abacus is the first calculating device which
is designed by the Chinese about 5000 years ago.
Abacus was mainly used for addition, subtraction and
later for division and multiplication.
1)Napier’s Bones:
John Napier invented Napier’s bones in 1617. It
was used for multiplication.
2)The Slide Rule:
The slide rule was invented by William Oughtred in
1625. It uses logarithms to perform multiplication and
division using addition and subtraction.

3) The Slide Rule: The slide rule was invented by


William Oughtred in 1625. It uses logarithms to
perform multiplication and division using addition and
subtraction.
4)Leibnitz Calculator:
In 1650, Gottfried Wilhelm Von Leibnitz, built a
calculator that could add, subtract, multiply and divide
the numbers. It is also used to find the square roots.
5)Jacquard’s loom:
In 1820, Joseph Marie Jacquard invented Jacquard
Loom that used punched cards to automatically weave
detailed patterns. This can be taken as the first ‘read
only memory’ device.
6)The difference Engine:
In 1822, Charles Babbage developed a machine to
performdifferential equations, called a Difference
engine. It could perform calculations and print the
result automatically.
7)Analytical engine:
In 1833, Charles Babbage designed the analytical
engine .It outlined the basic elements of a modern
general – purpose computer. Hence Charles Babbage is
known as the ‘father of computers’.
Augusta Ada Byron also known as Lady Ada
Lovelace wrote many of the operating instructions for
this machine. She is therefore considered as the world’s
first computer programmer.
8)Hollerith’s Tabulating Machine:
In 1889, Herman Hollerith designed a machine that
could tabulate data using punched cards. It was used to
count the population ofUSA. In 1896, he founded the
Tabulating Machine Company. His company later
merged with other companies to become International
Business Machines (IBM).
1 MARK QUESTIONS:
1) Which is the earliest calculating machine?
2) Who invented Napier’s bones?
3) Who invented Slide rule?
4) Who invented Pascaline?
5) Who invented Leibnitz’s calculator?
6) Who invented Jacquard’s loom?
7) Which is the first ‘read only memory’ device?
8) Who developed difference engine?
9) Who developed analytical engine?
) Who is known as the ‘father of computers’?
11) What is Charles Babbage known as?
12) What is the machine proposed by Babbage, to
compute differential equations called as?
13) Name the world’s first programmer.
14) Who is the founder of Tabulating Machine
Company?
15) What is the new name of the Tabulating Machine
Company?
16) Expand IBM.
5 MARK QUESTIONS
1) Explain the history of computers.

APPLICATION OF COMPUTERS
► Computers in education

► Computers in industry

► Computers in communication

► Computers in entertainment and multimedia

► Computers in business

Computers in science and engineering


COMPUTERS IN EDUCATION:

❖For giving presentations about various topics.

❖To teach students online.


❖For preparing projects and learning the different
topics of a subject.

❖Through internet students can get any type of


information.

❖Computers are used in schools and colleges to


keep track of student and staff information.
Helps the students with special needs
COMPUTERS IN INDUSTRY:

❖CAD (Computer Aided Design) is used to develop


products.

❖CAM (Computer Aided Manufacturing) is used to


produce them.

❖To run robots that create, finish, assemble, test


products and their components.

❖To maintain the details of production,


export/import details.

❖To keep track of profit/loss from the sales.


❖For accounting as well as for maintaining the
database of the employees.

❖Computer Based Training(CBT) is used to train


people in the industry.
COMPUTERS IN COMMUNICATION:

❖Used in teleconferencing to communicate and


discuss online projects and technologies.

❖Fastest mailing service, electronic mail(E-mail) is


used.

❖We can chat with the persons present in the other


country.

❖Voice mail increases communication by transmitting


voice.

❖Used in satellite communications.

❖Used in telephone exchange.

COMPUTERS IN ENTERTAINMENT AND MULTIMEDIA:

❖Used for playing games.


❖Used for animations in cartoon films and games.

❖Used to create special effects in big budget movies.

❖Used for recording ,composing and playing music.

❖Used to edit films.

❖Computer play a growing role in dance,


photography, painting, and many other arts.
COMPUTERS IN BUSINESS:

❖Used in stocks and shares.

❖To do business work from home.

❖Online shopping (E-Commerce) i.e. selling & buying


products using internet.

❖Desktop publishing to develop good printing


material.

❖Helps in internet banking.

COMPUTERS IN SCIENCE AND ENGINEERING:


❖Computers are used in scientific and technological
activities like launching and controlling a satellite,
weapon control etc.

❖Super computers have numerous applications in


Chemistry and Physics and in weather forecasting.

❖Physician use computers to understand the


human
body and to diagnose disorders.

❖Used in astronomy.

❖Computers help scientist in their research work.

1 MARK QUESTIONS

❖1) Expand CAD.

❖2) Expand CAM.

❖2 MARK QUESTIONS

❖1) Mention the fields computers are used.

❖2) Explain the role of computers in education.


❖3) Explain the role of computers in industry.

❖4) What are the applications of computers in


business?

❖5) How are computers important in


communication?

❖6) Explain the role of computers in science and


engineering.

❖7) Explain the role of computers in entertainment


and multimedia.
5 MARK QUESTIONS
1)Explain the role of computers in education.
2)Explain the role of computers in industry.
3)What are the applications of computers in
business?
4)How are computers important in communication?
5)Explain the role of computers in science and
engineering.
6)Explain the role of computers in entertainment
and multimedia.
CLASSIFICATION OF COMPUTERS
Classification of the computers may be based on either
their principles of operations or their configuration(size
, speed, storage capacity).
Classification based on principles of operation

▪ Analog computers

▪ Digital computers

▪ Hybrid computers

ANALOG COMPUTERS:
Analog computers are used for measuring
continuous quantities. They are used measuring
voltage, current, speed, temperature etc. Some of the
analog devices are thermometer, speedometer etc.
Accuracy is limited since they deal with quantities that
vary continuously. Calculations take place concurrently
and hence processing is faster.
DIGITAL COMPUTERS:
The digital computers operates on discrete data. They
convert data into digits, 0’s and 1’s. Analog computers
are much faster than digital computer and digital
computers are far more accurate than analog
computers. These computers are used for general and
special purpose.
Hybrid computers:
A combination of analog and digital computers
those are capable of inputting and outputting both
digital and analog signals.
In hospitals analog devices measure patient’s heart
beat, bloodpressure etc. These are then converted into
numbers and supplied to digital components in the
system.
Classification of computers based on configuration:
• Micro computers
• Mini computers
• Mainframe computers
• Super computers
MICROCOMPUTERS:
It is also known as personal computers. It contains
one or more processors. It provides access to a wide
variety of computing applications. Personal computers
are available as desktop or portable models. PC’s are
built by IBM, Dell, Lenovo, Sony, HP etc. These are
commonly used in the offices and at home. They are
also used for (small )business and engineering
application.
personal computers can be categorized into:

❑Desktop computers

The system unit is placed on the desktop or table .It


cannot be carried from one place to another.

❑Portable computers

Portables can be carried from one place to other


easily. Examples are laptop, notebook and handheld
(palmtop like smart phone) computers.
MINI COMPUTERS:
A minicomputer is larger and more powerful than
micro computer.it is multiprocessing system capable of
supporting up to 4000 users simultaneously. It can
execute five million instructions per second. They are
used by small and medium-sized companies to provide
centralized store of information.
Examples: Digital Alpha, Sun Ultra.
MAINFRAMES:
A mainframe computer is a very large computer in
size and are more powerful than mini computer . It
consists of multiple processors. It is designed to
perform multiple tasks for multiple users at the same
time. It can serve up to 50000 users at the same time.
It can execute 16 million instruction per second . It is
used in large organizations. ( for example - Airline ticket
reservation system, banks)
Example:- IBM s/390, HP 9000.
SUPERCOMPUTERS: Super computers are largest in size
, most expensive, faster computers with large storage
capacity. They are multiprocessor systems.it can
process trilli0ns of instructions per sec .
Uses of super computer include weather forecasting,
animated graphics in Hollywood movies, space science,
weapon and missile design ,nuclear energy research.
Examples are IBM’s Deep Blue and Silicon Graphics’
Cray line.
1 MARK QUESTIONS
1)How are computers classified based on principle
of operation?
2)How are computers classified based on
configuration?
3)What is analog computer?
4)What is digital computer?
5)What is hybrid computer?
6)What is micro computer?
7)What is mini computer?
8)What is mainframe computer?
9)What is super computer?
10) Mention the different types of micro
computers.
11) What is the difference between the mainframe
and super computers?
12) Mention the uses of super computers.
2 MARK QUESTIONS
1)How are computers classified?
2)Explain analog computer.
3)Explain digital computer.
4)Explain hybrid computer.
5)Explain micro computer.
6)Explain mini computer.
7)Explain mainframe computer.
8)Explain super computer.
5 MARK QUESTIONS
1) Explain the classification of computers based
on configuration.
INPUT, OUTPUT AND MEMORY DEVICES:
INPUT AND OUTPUT:
Input and output devices connect the external world to
the computer system.
Input-Output devices are of two types :
1. Hard copy devices and
2. Non-hard copy devices
1) Hard copy devices:
It provides the output in terms of hard copies i.e. it
generates the printouts. Printed information can be
given as input.
Example :- Printer and scanner
2) Non-hard copy devices:
It provides the output by displaying them on the
screen. Inputs are given pressing the keyboard keys.
Example :- Monitor and keyboard
Soft copy: The programs and data present in the
memory is called as soft copy.
Hard copy: The programs and data present on the
paper is called as hard copy.
Input devices: A device that is used to feed data into a
computer system.

KEYBOARD: The computer keyboard has four


categories of keys.
I. Alphabetic keys(to enter letters)
2. Numeric keys(to enter numbers)
3. Punctuation keys(to enter comma , period,
semicolon etc.)
4. Function keys(to perform specific functions)
Types of keyboard:
STANDARD KEYBOARD: The average number of keys
on a regular keyboard is 105 -108.
ERGONOMIC keyboards: They are designed in such a
way that typing can be done in putting the least
amount of stress on the fingers and the wrist.
Virtual keyboards: They open up as an application and
can be controlled by a mouse or via a touch screen.
COMPACT KEYBOARD: They are slim and usually do
not have numeric keypad that is present on the right
side of other keyboards.
MOUSE:
Mouse stands for "Mechanically Operated User Serial
Engine“. You can roll the mouse along a flat
surface(mouse pad).In a mouse, a small ball /IR rays is
kept inside and touches the pad through a hole at the
bottom of the mouse. When the mouse is moved the
ball rolls/position on the screen and is converted into
signals and sent to the computer.
There are three types.
1)Manual mouse
2)Scroll mouse
3)USB mouse
4)Wireless mouse
JOYSTICK: A joystick normally contains a lever similar to
the gear lever of a car. This lever controls the
movement of the pointer and the other display objects
on the screen. It is used to control video games, for
controlling machines such as cranes, trucks etc.
DEVICES USING OPTICAL MEDIA: Direct Data
Entry(DDE) refers to entry of data directly into the
computers through machine readable source
documents.
The following devices belong to this category.
1. OMR (Optical Mark Reader)
2. OCR (Optical Character Recognition)
3. MICR (Magnetic Ink Character Recognition)
OPTICAL MARK READER: The main use of these devices
is to recognize certain pre-specified types of marks
made by pencil or pen. Documents are read by optical
mark reader. It reads the pen or pencil shades and
converts that into electrical pulses and later into
binary code for manipulation. These types of scanners
are normally used in grading objective type tests.
OPTICAL CHARACTER RECOGNITION: The main use of
these devices is to recognize alphabetic and numeric
character printed on paper. It permits the direct
reading of any printed character. A user can scan a page
from a book. The computer will recognise the
characters in the page as letters and punctuation marks
and stores.
MAGNETIC INK CHARACTER RECOGNITION: MICR
device is normally used to assist the banking sector in
processing the cheques that are issued by the
customers every day. Human readable numbers are
printed on cheques using a special magnetic ink. This
method eliminates the manual errors. It also saves
time, ensures security and accuracy of data.
1 MARK QUESTIONS
1)How are I/O devices classified?
2)What is hard copy device?
3)Write examples of hard copy devices.
4)What is meant by non-hard copy devices?
5)Mention examples of non-hard copy devices.
6)What is soft copy?
7)What is hard copy?
8)Mention few input devices.
9)Expand mouse.
10) Mention the different types of keyboard.
11) Mention the different types of mouse.
12) Expand DDE.
13) What is meant by Direct Data Entry?
14) Mention few DDE devices.
15) Expand OMR.
16) Expand OCR.
17) Expand MICR.
2 MARK QUESTIONS
1)What is the difference between hard copy and
non-hard devices?
2)What is the difference between hard copy and soft
copy?
3)What is meant by direct data entry? Mention DDE
devices.
4)Explain OMR.
5)Explain OCR.
6)Explain MICR.
3 MARK QUESTIONS
1)Explain keyboard.
2)Explain mouse.
3)Explain any one input device.

Output devices: The device which is used to display or


print the result is called output device. Some of the
output devices are monitors, printers , plotters,
speakers etc.
MONITOR: Monitors are also called as Visual Display
Unit(VDU). Two types of monitors are available –
monochrome and color.
The smallest dot that can be displayed is called pixel.
The number of pixels that can be displayed vertically
and horizontally is called as the resolution of the
monitor.
The resolution of the screen increases as the number
of pixels increases. The resolution of the monitor
displays the quality of display.
Printers: A printer is an output device that produces
text and graphics on a physical medium such as paper.
There are two main classifications of printers – Impact
and non-impact.
Impact printer: In impact printers, the print head
mechanism strikes an inked ribbon located between
the print head and the paper. The different types of
impact printers are Dot matrix, line printers.
Characteristics of impact printers:

⚫ There is a physical contact with paper to produce


an image.

⚫ They are useful for bulk printing.

⚫ Due to striking activity, they are very noisy.

⚫ Since they are mechanical in nature, they tend to


be slow.
⚫ Measured in characters per second(cps).

LINE PRINTER:

❑High speed printers capable of printing an entire


line at a time.

❑Can print 150 - 3000 lines per minute.

❑ Different fonts, pictures and drawings are not


compatible for printing.

❑Print quality is low.

❑Noisy to operate.

❑Can print large volume of text data.

Very fast compared to other printers.


Dot matrix Printer: Print head has 9 or 24 pins and
these pins are arranged in a matrix format. It forms a
character by joining tiny dots.

❖Prints a character at a time.

❖Slow in printing.
❖The speed of the printer is measured in characters
per second (cps).

❖Printing speed is around 300cps.

Non-Impact printer: Non-impact printers do not use


striking device. The ink is stored in the printer
cartridges and the flow of ink is controlled by the
processors. The three main types of non-impact
printers are LaserJet, ink jet and thermal. The
printing speed of a printer is expressed in pages per
minute (ppm). Printer resolution is often expressed
in dpi (dots per inch). The larger the number, the
higher the resolution.
Characteristics of non-impact printers

⚫ No striking mechanism.

⚫ Does not make noise while printing.

⚫ Resolution is measured in dots per inches(DPI).

⚫ Produces high quality graphics.

⚫ Speed is calculated by the number of pages printed


per minute(PPM).
⚫ Can print many pages per minute(faster).

⚫ Can print pictures and drawings.

Laser Printers: A laser printer uses a laser beam and


dry ink powder.

▪ It can produce very good quality

graphic images.

▪ The resolution of printing varies from

300 to 1200 dots per inch (dpi).

▪ It is very fast.

▪ It can handle large volumes of printed output.

▪ The speed ranges from 10 pages to about 200


pages per minute.
INKJET PRINTER: Inkjet printers work by spraying ink
on a sheet of paper. It generates high quality output.
Thermal printer: Thermal printers are printers that
produce images by pushing electrically heated pins
against special heat-sensitive paper. They are not
expensive and used widely in fax machines and
calculators.
Plotter printers: It is an output device that prints
large amount of data with pictures and drawings. It
prints faster.
Speakers: Speakers are output device which is to
produce audio output that can be heard by the
listener.
1 MARK QUESTIONS
1)Mention few output devices.
2)Expand VDU.
3)What is pixel?
4)What is meant by the resolution of the monitor?
5)What is a printer?
6)How are printers classified?
7)Mention the different impact printers.
8)Mention the different non-impact printers.
9)Write one characteristic of impact printer.
10) Write one characteristic of line printer.
11) Write one characteristic of dot matrix printer.
12) Write one characteristic of non-impact printer.
13) Mention one characteristic of laser printer.
14) Mention one characteristic of ink-jet printer.
2 MARK QUESTIONS
1)What is a printer? How are printers classified?
2)Write the characteristics of impact printer.
3)Explain line printer.
4)Explain dot matrix printer.
5)Explain the characteristic of non-impact printer.
6)Explain laser printer.
7)Explain thermal printer.
8)Explain the characteristic of line printer.
9)Explain the characteristics of dot matrix printer.
3 MARK QUESTIONS
1)Explain the characteristics of impact printer.
2)Explain the characteristics of line printer.
3)Explain the characteristics of dot matrix printer.
4)Explain the characteristics of non-impact printer.
5)Explain any one output device.
6)Mention the different types of impact printer.
Explain any one.
7)Mention the different types of non-impact printer.
Explain any one.

COMPUTER MEMORY: Two kinds of memory are


commonly used in modern computers.
• Semiconductor memory [Primary memory]
• Magnetic memory [Secondary memory]
The primary memory is faster, compact and lighter
and it consumes less power. The primary memory is
a static device as there are no rotating parts in it.
Secondary memory is slow compared to primary
memory. But it is cheaper than primary memory. It is
not a static device. It is either in the form of a
rotating disk or tape.

Byte 20
1 Kilo byte(1 KB) 210 bytes(1024 Bytes)
1 Mega byte(1 MB) 220 bytes
1 Giga byte(1 GB) 230 bytes
1 Tera byte(1 TB) 240 bytes
1 Peta byte 250 bytes
1 Exa byte 260 bytes
1 Zeta byte 270 bytes
1 Yotta byte 280 bytes
1 Bronto byte 290 bytes
1 Geop byte 2100 bytes

PRIMARY MEMORY: Primary memory stores

programs and data, which are currently needed by


the CPU. The CPU communicates directly only with
the main memory.
Primary memories are of two types.
• RAM (Random Access Memory)
• ROM (Read Only Memory)
Random Access memory (RAM) :RAM is also called
as the main memory of a computer. The users can
write information into RAM and read information
from it. RAM is accessible to users. The user enters
his program and data into RAM. It has random access
property.
RAM is a volatile memory. The information written
into it is retained in it as long as the power supply
is on. As soon as the power supply goes off its
stored information is lost. The programmer has to
reload his program and data into the RAM when
the power supply is resumed.
TYPES OF RAM:
Dynamic random access memory(Dram)
DRAM is small and cheap. DRAM must be refreshed
continuously to store information; otherwise it will lose
what it is holding. The refresh operation occurs
automatically. DRAM is slow because the refreshing
takes time.
Static random access memory(sram)
Static RAM retains stored information as long as the
power supply is on. Static RAM is costlier and
consumes more power.
Read Only Memory (ROM): In ROM, the information is
burnt into the ROM chip at manufacturing time. Once
data has been written into a ROM chip, it cannot be
erased but you can read it. ROM stores programs such
as the program that boots the computer.
ROM stands for "Read Only Memory". It is
nonvolatile, i.e., the information stored in it is not lost
even when the power supply goes off. It is used for
permanent storage of information. It also possesses
random access property.
PROM( Programmable Read Only Memory): PROM is a
memory on which data can be written only once. It is
not burnt at manufacturing time, but can be
programmed using PROM programmer or a PROM
burner. PROM is also a non-volatile memory.
EPROM (Erasable Programmable Read Only Memory):
In EPROM, the information can be erased and
reprogrammed using a special PROM – programmer.
When an EPROM is exposed to ultraviolet light the
entire data are erased. EPROM is a non-volatile
memory.
EEPROM(Electrically Erasable Programmable Read
Only Memory ): It can be erased by exposing it to an
electrical charge. It is non-volatile in nature. It is not
fast as RAM or other types of ROM.
Secondary memory: The storage capacity of the
primary memory is not very large. It cannot hold large
amount of data, including programs, which may be
needed for processing. So secondary storage devices
are necessary.
These devices are normally very slow compared to the
primary storage. The information, which is not being
currently processed, resides in the secondary memory.
The size of the secondary memory is normally large and
the cost is also reasonable.
The secondary memory should not be of volatile
nature. It must store information permanently.
Secondary storage is also called backup storage. Some
of the commonly used secondary storage devices are
hard disks, floppy disks, magnetic tapes and CD-ROM.
Hard Disk: It is a magnetic disk on which you can store
computer data. It is a direct access storage medium.
You can store and retrieve data randomly.
It has a rotating metal oxide plate called platter.
Concentric circles on a platter is called a track. Each
track is divided into smaller segments called sectors.
Set of matched tracks are called cylinder. An
electromagnetic recording head is used to perform the
read/write operation. The disk rotates at
7200rpm(rotations per minute).
Magnetic tape: This recording medium contains a thin
tape with a coating of a fine magnetic strip used for
storing digital data. Bits are recorded as magnetic spots
on the tape along several tracks. Read/write heads are
mounted one in each track so that data can be
recorded and read as a sequence of characters.
Data is stored in frames across the width of the tape.
The frames are grouped into blocks or records which
are separated by gaps. Magnetic tape is a serial access
medium. So data can not be randomly located.
Floppy Disk: It contains circular disk plate. A disk plate
consists of metal oxide components. It also contains
electromagnetic heads which are used to perform the
read and write operation. Floppies are in three
different sizes - 3 1/2 inches, 5 1/4 inches and 8 inches
in diameter. The commonly used floppy disk was of 3
1
/2 inches with a storage capacity of 1.44 MB. Floppy
disks are cheap when compared to other storage
devices. Floppy disks are slower to access than hard
disks and less storage capacity. It can be accessed
randomly.
Optical disks: Optical disks consist of a rotating disk,
which is coated with a highly reflective material. Data
recording on the disk is done by focusing a laser beam
on the surface of the disk. There are different types of
optical laser disks. Information can be easily read from
any point on the disk. CD-ROM stands for Compact Disk
Read Only Memory. Read and write CDs are also
available.
DVD(DIGITAL VIDEO DISC/digital versatile disc): It can
store video, audio, or any other information. DVD-R
stands for DVD Recordable where in only once you can
record data. DVD-RW stands for DVD Re-writable
where in data can be recorded and erased. The storage
capacity is 4.7 GB.
BD(Blu-ray)disk: It is a high capacity storage technology
with a 25 GB to 50 GB capacity to store high definition
movies and data. The name Blu-ray is derived from the
blue-violet colour laser used to read data stored on
Blu-ray discs.
PEN DRIVE: It is a plug and play device. It can store
large amount of data. They are compact and faster.
CACHE MEMORY: The cache memory is placed in
between the CPU and main memory. It is much faster
than main memory. Its access time is less compared to
that of the main memory. The cache memory is an
intermediate memory and is not accessible to the
users. It stores data and instructions which are to be
immediately executed. It increases the operating speed
of the system. But it is much costlier than main
memory.
Types of cache memory:
1)Level 1 (L1) cache – It is situated in the CPU.
2)Level 2 (L2) cache – It is present in the mother
board.
1 MARK QUESTIONS
1)Mention the different types of memory.
2)What is primary memory also called as?
3)What is secondary memory also called as?
4)Mention the different types of primary memory.
5)Expand RAM.
6)Expand ROM.
7)Mention the different types of RAM.
8)Expand DRAM.
9)Expand SRAM.
10) Mention the different types of ROM.
11) Expand PROM.
12) Expand EPROM.
13) Expand EEPROM.
14) Mention few secondary storage devices.
15) Expand CD-ROM.
16) Expand DVD.
17) What is cache memory?
18) Mention the types of cache memory.
19) Where is L1 cache located?
20) Where is L2 cache located?
21) Mention any one difference between primary
memory and secondary memory.
22) Mention one difference between SRAM and
DRAM.
23) What is volatile memory?
24) What is non-volatile memory?
2 MARK QUESTIONS
1)Write the differences between volatile and
non-volatile memory.
2)Explain primary memory.
3)Explain RAM.
4)Explain ROM.
5)Write the differences between SRAM and DRAM.
6)Explain secondary memory.
7)What is cache memory? Mention the two types of
cache memory.
8)Write the differences between primary memory
and secondary memory.
3 MARK QUESTIONS
1)Explain primary memory.
2)Explain RAM.
3)Write the differences between SRAM and DRAM.
4)Explain ROM.
5)Explain the types of ROM.
6)Explain secondary memory.
7)Explain hard disk.
8)Explain cache memory.
9)Write the differences between primary memory
and secondary memory.

SOFTWARE CONCEPTS
Software is the instructions or programs that makes
the computer work.
TYPES OF SOFTWARE: Software is classified into two
categories.
1)System software
A) Operating system
B) Language translators
C) Utility software
2) Application software
A) General purpose
B) Specific purpose
System software: System software is a collection of
system programs to perform common tasks.
The different types are :
1)Operating system
2)Language translators
3)Utilities
Operating system: An operating system is a set of
programs which acts as an interface between the
user and the computer.
Examples of operating systems are Unix , Linux,
MS-DOS, Microsoft Windows.
Computer languages:A computer language can be
classified in the following categories.
1) Low level languages
a) Machine level language
b) Assembly level language
2) High level language
a) General purpose languages
b) Specific purpose languages
Machine level language: Machine language is the only
language of the system and these are sequence of
machine instructions. These instructions are
represented by a sequence of 1’s and 0’s.
Example :- 0001 00110010 Load the data
Advantages

⮚ It can be directly executed.

⮚ It is the fastest because it requires no translation.

Disadvantages

⮚ Coding is difficult as the instructions are in 1’s and


0’s.

⮚ It is machine dependent.

⮚ Debugging is difficult.

⮚ It is difficult to modify.

Assembly language: A low level programming language


that allows a user to write programs using letters and
symbols which are more easily remembered. The
symbolic instruction codes of machine language are
referred to as mnemonics.
Example :- ADD for addition, SUB for subtraction
Advantages

⮚ It is easier to remember, understand and write the


code.

⮚ It is easier to modify and debug.

Disadvantages

⮚ It is machine dependent.

⮚ It takes longer to code.

High level languages: High level programming


languages are English like languages and are machine
independent. Different high languages are BASIC,
PASCAL, C, COBOL, FORTRAN, C++, JAVA etc.
Advantages

⮚ It is machine independent.

⮚ It is easy to learn, understand and write.

⮚ It is easy to modify and debug.

Disadvantages

⮚ Slower in execution.
⮚ Requires a translator or compiler to convert source
code to object code.

⮚ Requires more memory.

Language Translators: Language translators perform


the translation of high level languages or assembly
language into machine language. In addition they
check for some types of errors that may be present
in the program being translated.
There are three types of translator programs:

⮚ 1. Assemblers

⮚ 2. Compilers

⮚ 3. Interpreters

Assembler: A program written in assembly language


cannot be directly executed on the computer because
the computer understands instructions only in machine
language. Thus the program has to be translated.
Assembler is a software, which translates a program
written in assembly language in to its equivalent in
machine language.
The system software Assembler will check for the
syntax and semantics of code and translate it into its
equivalent machine code(object code).
Compilers: Compiler is a translator that translates the
program written in a high language to its equivalent
machine language code of the computer. The process
of translation is called as compilation.
A compiler will check the entire source code for syntax
errors line by line and produces an executable file only
if it is free from all errors.
Interpreters: Interpreter is a language processor that
translates a statement of a high-level language and
immediately executes it before translating the next
source language statement.
Utilities : Utilities are the programs that assist the
computer by performing useful functions like scanning
viruses, backing up disk etc. Utility software are
generally called as Application Oriented ready-made
system programs.
Some of the important utilities are Text Editor, Backup
Utility, Antivirus software etc.
Linkers and Loaders: A linker is a system software
which links the modules or program segments together
so that they can be executed properly.
Once an executable program is generated it has to be
loaded into the main memory of the computer
execution. This operation is performed by system
software called as the loader.
Application software: A Software that has been written
to process a task. It is generally written in high level
languages.
It is classified into two types - General purpose and
specific purpose. Examples of general purpose software
are - Microsoft Word, Excel etc.
Examples of specific purpose software are – payroll,
fees collection etc.
Functions of operating systems:
The functions of the operating system are

⮚ Memory management

⮚ Process management

⮚ Device management

⮚ File management

⮚ User interface or Command interpreter


Memory management:
The four functions of memory management are

⮚ Keeping track of memory status

⮚ Allocation

⮚ De allocation

⮚ Re-allocate memory to a program when a used


block is freed
Process management:
The functions are:

⮚ Control access to shared resources like file,


memory, I/O and CPU

⮚ Control execution of applications

⮚ Create, execute and delete a process

⮚ Cancel or resume a process

⮚ Schedule a process

Device management
The device management functions are

⮚ Open, close and write device drivers

⮚ Communicate, control and monitor the device


driver
File Management
It's main functions are:

⮚ Create and delete both files and directories

⮚ Provide access to files

⮚ Allocate space for files

⮚ Keep back-up of files

⮚ Secure files

User interface or Command interpreter: The user


interface is a set of commands or a graphical user
interface using which the user interacts with the
applications and the hardware.
Types of operating systems
The different types of operating systems are:
1. Single user operating systems
2. Batch operating systems
3. Multiprogramming operating systems
4. Multitasking operating systems
5. Multiuser operating systems
6. Online operating systems
7.Real time systems
8. Distributed operating systems
9. Network operating systems
10.Multithreading models
1) Single user operating system: It allows only one user
to share the system resources including the CPU. These
are mainly the operating systems configured for the
use of desktop personal computers and Laptops. DOS
and Windows-95, Windows-98 etc. are examples for
such systems.
2) Batch operating systems: To speed up the
processing, similar jobs were grouped together in the
form of batches and the user would run each batch.
The output of each batch is sent back to the
programmer.Payroll, forecasting, statistical analysis etc.
are examples for this.
3) Multiprogramming operating systems:
Multiprogramming is the capability of CPU to execute
two or more programs concurrently. Two or more
programs are stored concurrently in primary storage,
and the CPU moves from one program to another,
partially executing each in turn.
4) Multitasking operating systems: This helps to
execute many tasks at a time. For example, Windows
operating system supports editing, printing etc.
5) Multi-user/time sharing operating system: In this a
number of users can work on the same computer at
the same time. Only a little CPU time is allotted for
each user. The switching between the processes or jobs
are so fast that each user gets the impression that he is
the only person using the system. Example - Unix
operating system.
6) Online system: There are some situations where
users need to get the result immediately after the
submission of the input. For example, ATM
transactions.
7) Real-time systems: It processes the input data
individually and generates the results with high speed.
Overall processing time is very less. It is generally used
in satellite launching, flight control etc.
8) Distributed operating systems: Data and
applications are distributed among many system. It
avoids the flooding of data to a central system.
Updating of transactions take place with high speed.
ATM (Automatic Teller Machine) centers of a bank is an
example of application of distributed operating
systems.
9) Network operating systems: An operating system
oriented to computer networking, to allow shared file
and printer access among multiple computers in a
network, to enable the sharing of data, users, groups,
security, applications, and other networking functions.
Operating systems based on Microsoft Windows NT
technology, UNIX etc. are examples.
10)Multithreaded operating systems: A thread is a
lightweight process and is a basic unit of CPU
utilization. A program or process may have many
threads which share the same code section, data
section, and other OS resources. Sun Solaris, Windows
2000, Multithreaded UNIX and Linux are examples for
such systems.
Functional Features of commonly used operating
systems:
The operating system provides a user interface to
interact with the computer. The objects available on
the monitor provide the user interface to the required
program. There are two types of user interfaces.

⮚ Command-line user interface(CUI)

⮚ Graphical user Interface(GUI)

CUI interface: CUI interface allows the user to interact


with a computer through text terminal. MS-DOS is an
operating system which provides a CUI. The commands
must be given at the command prompt(C:\>). Since
both input and output are character based, the
interface is also known as Character User Interface. It is
a non-graphical and text based user interface.
Graphical User Interface (GUI): The GUI was first
introduced in 1984 by Apple with Macintosh. GUI is an
interface where the commands are selected from
menus and icons rather than typing them from the
keyboard. It allows the user to click on the required
icon with Mouse. Windows operating system is the
most popular operating system based on GUI.
Disk Operating System (DOS): DOS is a single user
operating system. It was developed by Bill Gates and
Paul Allen in 1980 for IBM PCs.
Features

❖Single user operating system.

❖File management.

❖Directory management.

❖Allocation and deallocation of memory space for


the process to be executed.
❖Command interpreter interprets commands and
executes DOS functions, utility programs or
application programs.
UNIX OS: Unix was developed by Dennis Ritchie and
Ken Thompson.
Features

❖Hierarchical directory structure.

❖Portability.

❖Multi user.

❖Multitasking.

❖Security.

❖Machine independent.

Linux OS: Linux was developed by Linus Torvalds. It is a


free download from www.linux.org.
Features

❖Downloaded from the internet free of cost.


❖Portability.

❖Multi user.

❖Multitasking.

❖Security.

❖Graphical user interface.

Windows 7: Windows 7 is the client version of


Windows, developed by Microsoft.
Features

❖Graphical user interface.

❖Sharing of files and folders.

❖Better support for multimedia.

❖Provides high security.

❖Multitasking.

❖Multiuser.
❖Switching between applications are easy.

❖Easy installation.

PROBLEM SOLVING METHODOLOGY


PROBLEM SOLVING: Problem solving is defined as the
task of expressing the solution of complex problems in
terms of simple operations understood by the
computer.
STAGES

✔ Problem Definition

✔ Problem Analysis

✔ Design of solution using design tools such as


Algorithms and Flowcharts.

✔ Coding(Programming the computer)

✔ Testing and debugging (checking and correcting


errors)

✔ Program documentation

✔ Program enhancement or maintenance

1)Problem definition: The problem should be clearly


understood by the user. After defining the problem we
will know what is to be done to get the solution to a
given problem. We analyse what must be done rather
than how to do it.
2)Problem analysis: We try to understand the
requirements
of the problem to be solved. Analysing the
problem involves identification of the following.
1)Inputs
2)Logic
3)Outputs
4)Any additional requirements or constraints on the
solution

3)Design of solution using design tools: Algorithm


and flowchart are two design tools which help in the
representation of a solution to a problem manually.
Algorithms: An algorithm is a step by step finite
sequence of instructions to solve a problem .The word
Algorithm is derived from the name of a 9Th century
Arab mathematician, Mohammed Al-Khwarizmi.

❖Characteristics of an algorithm:

❖Input :Algorithm must accept one or more data to


be processed.
❖Definite: Each and every instruction must clearly
specify what should be done.
Effective: Each operational step is carried out by a
person

❖using a paper and pencil in a minimum number of


times.

❖Terminate: After minimum number of operations


algorithm must come to an end.

❖Output: An algorithm must produce one or more


output.
Advantages of algorithm:

🞂 It is very easy to understand.

🞂 It can be executed within a period of time.

🞂 It is easy to first develop an algorithm , and then


convert it into a flowchart and then into a
computer program.

🞂 It is independent of programming language.


🞂 It is easy to debug.

Disadvantages of algorithm:
It is time consuming and cumbersome as an algorithm
is developed first which is converted into a flowchart
and then into a computer program.
Analysis of algorithm: There may be more than one
algorithm to solve a problem. The choice of a
particular algorithm depends on the following.
• Space complexity: The amount of memory needed
by the algorithm to complete its run.
• Time complexity: The amount of time needed by
the algorithm to complete its run.
When we analyse an algorithm there are three cases.

▪ Best case: The amount of time a program might be


expected to take on best possible input data.

▪ Average case: The amount of time a program


might be expected to take on average input data.

▪ Worst case: The amount of time a program might


be expected to take on the worst possible input
data.
▪ Write an algorithm to find the sum of two
numbers.

▪ Write an algorithm to find the sum and average of


four numbers.

▪ Write an algorithm to find the area and perimeter


of a rectangle.

▪ Write an algorithm to find the area of a square.

▪ Write an algorithm to calculate the simple interest.

▪ Write an algorithm to calculate the area of a


triangle given base and height.

▪ Write an algorithm to find the area of a triangle


given three sides.
Flowchart: Flow chart is a pictorial or graphical
representation of a solution to any problem.
Flowcharts are constructed by using
special geometrical symbols. Each symbol represents
an activity. The activity could be either input or output
of data ,computation or processing of data, taking a
decision or terminating the solution and so on
The symbols used in a flowchart are joined by arrows.
Flowcharts are classified into two categories
1. Program flowcharts
2. System flowcharts
Program flowchart represents : diagrammatic
representation of a sequence of instructions for solving
a problem.
System flowchart: indicates the flow of data
throughout a data processing system as well as the
flow into and out of the system.

🞂 Advantages of flowcharts:

🞂 Flowcharts are very easy to understand.

🞂 It is easy to convert it into a computer program.

🞂 It is independent of programming language.

🞂 It is easy to debug.

🞂 Problem can be analysed in more effective way.

❑Disadvantages of flowcharts: It is time consuming


and cumbersome as it requires the uses of a
number of symbols which are to be properly
represented.

❑ The representation of complex logic is very


difficult in a flowchart.

❑ Modification can be only made by redrawing


the flowchart.
1 MARK QUESTIONS
1)What is problem solving?
2)Mention the different stages in problem solving.
3)Mention the design tools used in problem solving.
4)What is an algorithm?
5)Mention the characteristics of an algorithm.
6)Explain any one characteristics of an algorithm.
7)Write any one advantage of an algorithm.
8)Write any one disadvantage of an algorithm.
9)What is meant by space complexity?
10) What is meant by time complexity?
11) What is meant by worst case?
12) What is meant by best case?
13) What is meant by average case?
14) What is a flowchart?
15) Mention the two types of flowcharts.
16) What is program flowchart?
17) What is system flowchart?
18) Write any one advantage of flowcharts.
19) Write any one disadvantage of flowcharts.
20) Explain any one symbol used in flowchart.
2 MARK QUESTIONS
1)Explain problem definition.
2)Explain problem analysis.
3)What is an algorithm? Mention the characteristics
of an algorithm.
4)Explain any two characteristics of algorithm.
5)Write any two advantages of algorithm.
6)Write any two disadvantages of algorithm.
7)What is flowchart? Mention the different types of
flowchart.
8)Explain the different types of flowchart.
9)Write any two advantages of flowchart.
10) Write any two disadvantages of flowchart.
11) Explain any two symbols used in flowchart.
12) Mention the different stages in problem
solving.
3 MARK QUESTIONS
1)What is problem solving? Mention the different
stages in problem solving.
2)Explain the characteristics of an algorithm.
3)Write the advantages of algorithm.
4)What is flowchart? Explain the different types of
flowchart.
5)Write the advantages of flowchart.
6) Write the disadvantages of flowchart.
7) Explain the different symbols used in flowchart.
5 MARK QUESTIONS
1)Explain the characteristics of an algorithm.
2)Write the advantages of algorithm.
3)Write the advantages and disadvantages of
algorithm.
4)Write the advantages of flowchart.
5)Write the advantages and disadvantages of
flowchart.
6)Explain the different symbols used in flowchart.

4) Coding : The process of converting the

representation of a solution (algorithm or


flowchart)into a set of instructions in a programming
language is referred as coding.
6)Testing and debugging:
Debugging: The process of detecting and correcting
errors in a program is referred to as debugging. This
is also known as verification.
Compiler: It is a software ,which checks the entire
program created by the user for a certain type of
errors called as syntax errors .If the program is error
free the complete program is translated into its
equivalent machine language.
Source program: The program created by the user is
referred to as source program.
Object program: The machine language program
generated by the compiler is referred to as object
program.
Syntax : It refers to the set of rules to be followed
while creating every statement and structure in a
program.
Semantic : It refers to the logic, which is followed
while representing a solution.
Sequence of steps followed in the process of
debugging:

🞂 The program is first compiled during the process of


compilation the compiler detects certain type of
errors called as syntax error.

🞂 All the detected errors are corrected and the


program is recompiled .The process is repeated till
no errors are displayed.

🞂 The program is then executed. During the


execution of a program, certain errors called as
semantic errors are detected. Semantic errors
normally occur due to the wrong use of logic.

🞂 Once all the errors are corrected ,the program is


recompiled again and executed.
Testing: It is the process of checking whether the
program works correctly according to the requirements
of the user i.e. whether the program generates the
correct result for a given input of data. Testing is also
known as validation.
Program documentation: The written text and
comments that make a program easier for other to
understand ,use and modify. There are two types of
documentation – internal documentation and external
documentation.
Internal(technical) documentation: It is meant for the
programmer who may update the programme code at
later stages.
External documentation: The program is supported
with additional textual information about the
application.
1)Program maintenance:The process of updating or
providing the new versions of a program so that
the program meets the present day requirements
of the user.
1 MARK QUESTIONS
1)What is coding?
2)What is testing?
3)What is debugging?
4)What is the function of compiler?
5)What is source program?
6)What is object code?
7)What is meant by syntax?
8)What is meant by syntax errors?
9)What is meant by semantic?
10) What is meant by semantic errors?
11) What is meant by program documentation?
12) Mention the different types of program
documentation.
13) What is meant by program maintenance?
14) What is the other name for testing?
15) What is the other name for debugging?
16) What is internal documentation?
17) What is external documentation?
2 MAK QUESTIONS
1)What is the difference between source program
and object program?
2)What is the difference between syntax and
semantics?
3)Explain program documentation.
4)Explain the different types of program
documentation.
5)Mention the different stages in problem solving.
3 MARK QUESTIONS
1)Explain program documentation.

PROGRAMMING CONSTRUCTS:
Programming constructs basically represent the
facilities available in a programming language using
which proper structured programs can be developed.

The three basic programming constructs include:

* Sequence construct
* Selection construct
* Iteration construct

SELECTION CONSTRUCT(conditional construct):


Selection is the ability of a programming language to
allow the user to decide on the execution of a certain
set of statements based on a requirement or
condition.
Selection construct can be used to implement the
following statements.
● Simple- if
● if- else
● Nested - if
● if- else- if
● Multiple selection

The block of Statements A is executed only if the test


condition is true after which the block ofStatements
B is executed. If the test condition is false, control
goes directly to Statements B.
Examples :-
1)Discount = 0;
if (billamount > 6000)
Discount = 2;
1)L = a;
if(b >L)
L = b;

The block of Statements A will be executed only if


the test conditionis true otherwise if the test
condition is false the block of Statements B will be
executed.
Example :-
if (a > b)
L = a;
else
L = b;
Output L
Example :-
if (a >b)
if(a>c)
l = a;
else
l = c;
else
if(b>c)
l=b;
else
l = c;
if- else- if STATEMENT: This structure is also called as
the “multiple- way branch” decision structure. The
structure helps the programmer to decide the set of
statements, which is to be executed, based on some
requirements or conditions.

Example 1
if (per >= 60)
output “ First class”
else if (per >= 50)
output “Second class”
else if (per >= 35)
output “Pass”
else
output “Fail”
Example 2
if((a>b) and(a>c))
l=a
else if (b>c)
l=b
else
l=c
MULTIPLE SELECTION STATEMENT: If we have to
choose from one of the many alternatives, we can
implement it using the if-else-if statement. The
complexity of such programs increases when the
number of alternatives increases.
The process can be simplified with the usage of
multiple selection decision statement. The statement
tests the value of a variable against a list of values
and when a match is found the corresponding block
of statement is executed.
Example
switch(operator)
{
case ‘+’ : {
result = a + b;
break;
}
case ‘-’ : {
result = a - b;
break;
}
case ‘*’ : {
result = a * b;
break;
}
case ‘/’ : {
result = a / b;
break;
}
default : output “wrong operator”
}
ITERATION CONSTRUCT: Iteration is the ability of a
programming language to allow the user to repeat
the execution of a certain set of statements again
and again until a requirement or condition is
satisfied. Iteration is also called as looping.
Iteration structure can be used to implement the
following statements.
► while
► do- while
► for
WHILE STATEMENT : This structure is also called as
the “pre- tested” iteration structure. In this structure,
the checking of the requirement or condition is done
at the beginning of the structure. The set of
statements in the structure is executed again and
again until the test condition is true. If the test
condition becomes false control is transferred out of
the structure.

Example
sum = 0;
while(n>0)
{
digit = n % 10;
sum = sum + digit;
n = n / 10;
}
Program to find the sum of all the dgitis of a number
using while statement.
◦ #include<iostream.h>
◦ #include<conio.h>
◦ Void main( )
◦ {
◦ int digit,num;
◦ int sum=0;
◦ clrscr();
◦ cout<<"Enter the number:"<<endl;
◦ cin>>num;
◦ while(num!=0)
◦ {
◦ digit=num%10;
◦ num=num/10;
◦ sum=sum+digit;
◦ }
◦ cout<<"The sum of the digits are:"<<sum<<endl;
◦ getch();
◦ }
do- while STATEMENT: This structure is also called as
the “post- tested” iteration structure. In this
structure, the checking of the requirement or
condition is done at the end of the structure. The set
of statements in the structure is executed again and
again until the test condition is true. If the test
condition becomes false control is transferred
outside the structure.
Example
sum = 0;
do
{
digit = n % 10;
sum = sum + digit;
n = n / 10;
}while(n>0);
FOR STATEMENT: This structure is also called the “fixed
execution” iteration structure. This is used when we
know exactly how many times a particular set of
statements is to be repeated again and again. The for
statement can be either used as the increment looping
statement or the decrement looping statement.
Syntax
for (expression 1; expression 2; expression 3)
{
Statements 1;
Statements 2;
………..
}
Statements n+1;

Example
fact = 1;
for(i=1;i<=n;i++)
fact = fact * i;
Program to find the factorial of a number using for
statement.
#include<iostream.h>
◦ #include<conio.h>
void main( )
◦ {
◦ long int fact;
◦ int num,i;
◦ clrscr();
◦ cout<<"Enter the number:"<<endl;

◦ cin>>num; fact=1;
◦ for(i=fact;i<=num;i++)
◦ {
◦ fact=fact*i;
◦ }
◦ cout<<"The factorial of a number
is:"<<fact<<endl;
◦ getch();
◦ }
1 MARK QUESTIONS
1)Name the three basic programming constructs.
2)What is sequence construct?
3)What is selection construct?
4)Mention the statements that can be implemented
using selection construct.
5)What is the other name of simple-if statement?
6)Write the syntax of simple-if statement.
7)Draw the flowchart of simple-if statement.
8)What is the other name of if-else statement?
9)Write the syntax of if-else statement.
10) Draw the flowchart of if-else statement.
11) What is meant by nested-if?
12) What is if-else-if statement also called as?
13) What is the other name of multiple selection
statement?
14) What is iteration construct?
15) What is iteration also called as?
16) Mention the statements that can be
implemented using iteration construct.
17) What is while loop also called as?
18) Write the syntax of while statement.
19) Draw the flowchart of while statement.
20) What is do-while loop also called as?
21) Write the syntax of do-while statement.
22) Draw the flowchart of do-while statement.
23) What is for loop also called as?
24) Write the syntax of for statement.
25) Draw the flowchart of for statement.
26) When is for statement used?
2 MARK QUESTIONS
1)What is selection construct? Mention the
different selection construct.
2)Write the syntax of nested-if statement.
3)Draw the flowchart of nested-if statement.
4)Write the syntax of if-else-if statement.
5)Draw the flowchart of if-else-if statement.
6)Write the syntax of multiple selection statement.
7)Draw the flowchart of multiple selection
statement.
8)What is iteration construct? Mention the different
iteration construct.
3 MARK QUESTIONS
1)Explain sequence construct.
2)Explain simple-if statement.
3)Explain if-else statement.
4)Explain if-else-if statement.
5)Explain nested-if statement.
6)Explain multiple selection statement.
7)Explain while statement.
8)Explain do-while statement.
9)Explain for statement.
5 MARK QUESTIONS
1)Explain simple-if statement with an example.
2)Explain if-else statement with an example.
3)Explain if-else-if statement with an example.
4)Explain nested-if statement with an example.
5)Explain multiple selection statement with an
example.
6)Explain while statement with an example.
7)Explain do-while statement with an example.
8)Explain for statement with an example.

❑CHARACTERISTICS OF A GOOD
PROGRAMModification

❑Easy and efficient

❑Interactive and User friendly

❑Proper documentation in code

❑Reliable

❑Portable
CHARACTERISTICS OF A GOOD PROGRAM
► Modification :A good program is the one which
allows any modifications easily whenever needed.
► Easy and efficient :The logic used in the program
should always produce correct results and the
execution should be faster.
► Interactive and User friendly: The user should
have easy interactive screen and should get correct
directions and information when they are going
through the program.
► Proper documentation in code :The
documentation will help the programmer to
identify parts of the code and clarify their meaning
in the program.
► Reliable :The good program should be able to
cope up from any unexpected situations.
► Portable :The program we create should run in
different types of machines with a minimum or no
change.
TYPES OF PROGRAM ERRORS:
There are 3 types of errors.
► Syntax errors
► Semantic errors/Logical errors
► Runtime errors
SYNTAX ERROR : An error which occurs due to the
wrong use of statements in a programming language.
SEMANTIC ERROR :An error which occurs due to the
wrong use of logic.
RUNTIME ERRORS :Errors that are detected during the
execution of the program is called as runtime errors.
APPROACHES TO PROBLEM SOLVING
1.TOP DOWN ANALYSISA given problem is not solved as
a single unit, but it is broken down into small
manageable parts called as module. The top- down
approach is based on a concept called as divide and
conquer. The top- down approach is also called as
stepwise refinement or modular programming.
Top-down design involves dividing problems into
sub problems and further dividing this sub problems
into smaller sub problems until it leads to sub
problems that can be implemented as program
statements.
By subdividing the problem, you create a hierarchical
structure called a tree structure.

Module is a self contained collection of steps


that solves a problem or sub problem.

2.BOTTOM UP ANALYSIS :This approach is the reverse


of top-down design. Lower level modules are combined
to form higher level modules. This process of
combining modules is continued until the program is
realised.
3.Programming techniques
i. Unstructured programming
ii. Procedural programming
iii.Structured programming
iv.Modular programming
v. Object oriented programming
i.Unstructured programming : It consists of only one
main program. If the same set of codes are required in
different locations within the program those code must
be copied. This increases the length of the program. It
requires more space in memory and more time to
execute.
ii.Procedural programming : A program may consists of
set of procedures. It can be invoked using the
procedure call. After processing flow of control
proceeds right after the position where the call was
made.
iii.Structured Programming :Structured programming
is a
programming process that uses a set of well- defined
structures such as sequence, selection, iteration and
modularity.
ADVANTAGES Of STRUCTURED PROGRAMMING:
► Structured programs are easy to write.
► Structured programs are easy to test and debug.
► Structured programs are easy to maintain.
► Structured programs can be functionally
decomposed into logical working units.
iv. Modular programming: It is an approach of splitting
the lengthier and complex programs into number of
smaller units called as module.
Advantages:
1)Reusability
2)Easy debugging
3)Easy to understand and implement
4)Less memory
5)Less time for execution
v. Object oriented programming: It is a concept that
combines both the data and functions that operate on
that data into a single unit called the object.
1 MARK QUESTIONS
1)Mention the characteristics of a good program.
2)Mention the types of program errors.
3)What is runtime error?
4)What is top-down analysis?
5)What is top-down analysis also called as?
6)What is module?
7)What is bottom-up analysis?
8)What is unstructured programming?
9)What is procedural programming?
10) What is structured programming?
11)What is modular programming?
12) Write the advantages of modular programming.
13) What is object oriented programming?
2 MARK QUESTIONS
1)Explain any two characteristics of a good
program.
2)What is the difference between syntax error and
semantic error?
3)What is structured programming? Write any one
advantage of it.
4)Write any two advantages of structured
programming.
3 MARK QUESTIONS
1)Explain any three characteristics of a good
program.
2)Explain the types of program errors.
3)Write any three advantages of structured
programming.
4)Apply top-down approach to find simple interest.
5 MARK QUESTIONS
1)Explain the characteristics of a good program.
2)Explain structured programming.
3)Explain top-down analysis.
INTRODUCTION TO C++
HISTORY OF C++:
C++ was developed by Bjarne Stroustrup of AT & T
Bell Laboratories. The name suggests the evolutionary
nature of the changes from C, ++ is the increment
operator. Any valid C program is a valid C++ program
but the vice versa is not true.
CHARACTERISTICS OF C++:
▀ Object- oriented programming : It uses objects to
design applications and computer programs.
▀ Portability : You can compile the same C++ code in
any type of computer and operating system
without making any changes.
▀ Brevity : Code written in C++ is very short in
comparison with other languages.
▀ C compatibility : Any code written in C can easily
be included in a C++ program without making any
change.
▀ Modular programming : An application’s body in
C++ can be made up of several source code files
that are compiled separately and then linked
together.
▀ Speed : The resulting code from C++ compilation
is very efficient and execution is fast.
▀ Wide range of library functions : Use of library
functions available reduces the code development
time and also reduces cost of software
development.
C++ CHARACTER SET:
The character set means the valid set of characters that
a language recognizes.
ALPHABETS – The uppercase alphabets A to Z and
lowercase alphabets from a to z.
DIGITS – digits from 0 to 9
SPECIAL CHARACTERS – Special characters such as :
+, -, *, /, <, >, !, =, ~, #, %, &, { }, [ ], _, \, ;, :, “, ‘, ., ?
WHITE SPACES : blank space, horizontal tabs, new line
etc.
C++ TOKENS:
A token is the smallest individual unit in a program.
This helps us to construct statements, declarations,
etc. which in turn helps to construct complete
programs. C++ has the following tokens:
● Identifiers
● Keywords
● Constants
● Variables
● Operators
KEYWORDS:
Keywords are predefined reserved words that have
special meanings to the compiler. The programmer is
not allowed to change its meaning.
Examples: float, auto, char, goto, switch, while etc.
IDENTIFIERS:
An identifier is a name given to various
programming elements such as variables, arrays,
functions, etc.
RULES FOR NAMING IDENTIFIERS:
RULE 1: The first character of an identifier should
always start with an alphabet or an underscore, which
can be followed by either alphabets
or digits .

RULE 2: Special characters or symbols except


underscore (_) should not be used in identifiers.
Successive underscores are also not allowed.
RULE 3: Identifiers should be single words i.e. blank
spaces cannot be included in identifiers.

RULE 4: Reserved words should not be used as


identifiers.

RULE 5: Identifiers are case sensitive i.e. C++ treats


lowercase and uppercase letters differently.
VARIABLE:
A variable is a quantity whose value can change
during the execution of a program. It is used to identify
the location where a certain value is stored in the
computer memory.
Syntax : datatype variable_name_list;
where data type is one of the C++ data types (int,
char, float, double or user defined data)
Example : int a,b;
CONSTANTS:
A constant is a quantity whose value does not
change during the execution of a program. Constants
are referred to as literals.
INTEGER CONSTANT: An integer is a whole number
which can be either positive or negative. They do not
have fractional part. It consists of a sequence of digits
which may start with either a “+” or “-” sign. The
different integer constants used in C++ are
► Decimal Integer Constants
► Octal Integer Constants
► Hexadecimal Integer Constants
DECIMAL INTEGER CONSTANT:
A decimal integer constant consists of any
combination of digits from 0 to 9.
Example : 98 -1258 -498
+85178
OCTAL INTEGER CONSTANT:
It consists of any combination of digits from 0
to 7. The first digit must be zero.
Example : 0136 0123
HEXADECIMAL INTEGER CONSTANT:
It consists of any combination of digits taken
from 0 to 9, alphabets from ‘a’ to ‘f’ or from ‘A’ to ‘F’. It
starts with ‘0x’ or ‘0X’.
Example : 0x34 0XA
FLOATING- POINT CONSTANT:
Floating- point constants represent number with
fractional part. It represents a real number. They may
contain either decimal point or exponent.
● In the fractional notation, the dot symbol is used
to separate the integer part and the fractional
part.
Example: 345.85 -89.787
In the exponential notation, the ‘e’ or ‘E’ symbol is
used to:
● separate the mantissa and the exponent.
Example: 5.8e5 -8e-3
5.8 x 105 -8 X 10-3
CHARACTER CONSTANT: It represents a single
character enclosed in single quotes.
Example: ‘P’ ‘\’ ‘9’
The constants that start with a back slash (\)
followed by a character are normally called as escape
sequence. These sequences are used as part of an
output statement and define a particular operation.
They occupy one byte space.

STRING CONSTANTS: A string is a sequence of


characters enclosed by double quotes. By default the
compiler adds a special character called the NULL(‘\0’)
character at the end of the string to mark the end of
the string.
Example : “C++ Programming”
“computer”
1 MARK QUESTIONS
1)Who developed C++?
2)Mention the characteristics of C++.
3)Explain any one characteristics of C++.
4)What does C++ character set consist of?
5)What is a token?
6)Mention the different tokens in C++.
7)What is a keyword?
8)Mention few keywords in C++.
9)What is an identifier?
10) Write any one rule for naming an identifier.
11) What is a variable?
12) How are variables declared?
13) What is a constant?
14) How are constants classified?
15) What is an integer constant?
16) Mention the different integer constants in C++.
17) What is decimal integer constant?
18) What is octal integer constant?
19) What is hexadecimal integer constant?
20) What is floating point constant?
21) What is character constant?
22) What is meant by escape sequence?
23) Mention few escape sequences.
24) What does ‘\n’ symbolise?
25) What is string constant?
3 MARK QUESTIONS
1)Explain the characteristics of C++.
2)Explain any three tokens.
3)Explain any 3 rules for naming identifiers.
4)Explain Integer constants.
Explain Escape sequences
5 MARK QUESTIONS
1)Explain the characteristics of C++.
2)Explain C++ tokens.
3)What is an identifier? Explain the rules for
naming identifiers.
4)Explain constants in C++.
DATATYPES
Datatype can be defined as the set of values which
can be stored in a variable along with the operations
that can be performed on those values.
Datatypes are classified as
► The fundamental datatype
► Derived datatype
► User defined datatype

THE FUNDAMENTAL OR SIMPLE DATA TYPE:


Int: The ‘int’ type is used to store integers. The integers
can be positive or negative values. They occupy two
bytes of memory space. The range of numbers that can
be stored are -32768 to 32767. The possible operations
include addition, subtraction, multiplication, division
and remainder.
Char: It is used to store any characters from the basic
character set. Characters are enclosed in single
quotation marks. When a variable of the type ‘char’ is
declared, the compiler converts the character to its
equivalent ASCII code. They occupy one byte of
memory space. The possible operations are input and
output.
Float: The ‘float’ type is used to represent real
numbers. It can be positive or negative. They occupy
four bytes of memory space. The range of numbers
that can be stored are from -3.4e-38 to 3.4e38. The
possible operations are addition, subtraction,
multiplication and division.
Double: This is the same as float with double precision.
They occupy eight bytes of space. The range of
numbers that can be stored are from -1.7e-308 to
1.74e308. The possible operations are addition,
subtraction, multiplication and division.
Void: The ‘void’ datatype is used when function does
not return any value.
MODIFIERS: A modifier is used to alter the meaning of
the base type to meet the requirements. The modifiers
are signed, unsigned, long and short.
Derived Data Type: These data types are constructed
using the fundamental data types. They include arrays,
functions, pointers and references.
User defined data types: These data types are
constructed using fundamental and derived data types.
It includes union, class and enumerated.
INITIALISING A VARIABLE:
Assigning an initial value to a variable in a program is
called initialisation. There are two ways to initialise a
variable.
► METHOD 1: In this method, values are assigned to
variables at the time of declaring the variable. The
syntax to initialise a variable is
datatype variable-name = value;
Example: int a=100;
METHOD 2: In this method, we initialise a variable
using an assignment statement.
Example: a=100;
There are two values associated with a variable known
as lvalue and rvalue. lvalue is the location value. It
holds the memory address location at which the data
value is stored. rvalue is the data value. It holds the
value assigned to the variable by the programmer.
Example
P
100
32456
In this example, lvalue = 32456 and rvalue
= 100
2 MARK QUESTIONS
1)What is a data type? Mention the different data
types in C++.
2)Mention the simple datatypes in C++.
3)Explain ‘int’ datatype.
4)Explain ‘char’ datatype.
5)Explain ‘float’ datatype.
6)Explain ‘double’ datatype.
7)Explain ‘void’ datatype.
8)What is modifier? Mention the different
modifiers.
9)What is meant by derived datatype? Mention the
different derived datatypes.
10) What is meant by user defined datatype?
Mention the different user defined datatypes.
11) Explain the method of initialising a variable.
12) Differentiate lvalue and rvalue.
INPUT AND OUTPUT OPERATORS
input and output streams: C++ offers input and output
operations by providing prewritten operations. In C++,
input or output is a sequence of bytes, called a stream,
from the source to the destination.
A stream is a sequence of characters from the
source to the destination. There are two types of
streams.
1)Input stream
2)Output stream
INPUT STREAM
A sequence of characters from an input device to the
computer program.
OR
The stream that supplies data to the program.
OUTPUT STREAM
A sequence of characters from the computer
program to an output device.
OR
The stream that receives data from the program.
To receive data from the keyboard and to send
output to the screen, every C++ program must use the
header file iostream. This header file contains the
definitions of istream(input stream) and
ostream(output stream).The header file also contains
two object declaration - one for cin(console input) and
one for cout(console output).
To use cin and cout, every C++ program must use the
preprocessor directive #include<iostream.h> at the
beginning of the program.
Standard output – cout
The cout I/O stream is used to write the output of
the program to the display screen.
The syntax is
cout<< expression or manipulator << expression or
manipulator…..;
The output operator << is known as the
insertion operator or put to operator.
Expression includes constant or variable or
text to be displayed. The manipulator is used to format
the output.
Whenever we want to display constant string , we
must enclose them within double quotes, so that they
can be clearly distinguished from variable name.
Example
1) cout<<“Sum”;
Output is Sum
2) cout<<Sum;
Output is the value that is stored in variable
Sum
Manipulators: Manipulators are used along with the
insertion operator to manipulate or modify the output.
Some of them are endl and setw.
endl is the same as the escape sequence \n.
setw is used to set the field width of the output data.
iomanip.h is the header file that holds endl and setw.
Examples :
1) cout << 20;
The value 20 will be displayed on the screen.
2) cout << “Computer Science”;
This statement causes the string Computer Science
to be displayed on the computer’s screen.
3) cout<<Sum;
The value stored in ‘Sum’ will be displayed.
cout << “PCMC”;
The output displayed will be I PUC PCMC
5) cout <<“I PUC”;
cout <<endl;
cout << “PCMC”;
The output produced will be
I PUC
PCMC
cout << endl;
If N has the value 10, the output will be
The value of N is 10
7) cout << “The value of N is “<< N << endl;
If N has the value 10, the output will be
The value of N is 10
8) cout << “The value of N is “;
cout << endl;
cout << N;
If N has the value 10, the output will be
The value of N is
10
STANDARD INPUT – cin
The input operator >> is known as extraction or get
from operator.
cin is used to input a value entered by the user from
the keyboard. The syntax of cin when used together
with the extraction operator >> is
cin >> variable >> variable …….;
Examples
1) int n;
cin >> n;
The first statement declares a variable of type int
called ‘n’ and the second one waits for an input from
cin(keyboard) in order to store it in the variable ‘n’. The
input is processed by cin after the enter key is pressed.
2) cin >> a >> b;
is equivalent to
cin >> a;
cin >> b;
Cascading of I/O operators
C++ supports the use of stream extraction(>>) and
stream insertion(<<) operators many times in a single
input (cin) and output (cout) statements. If a program
requires more than one input variable , then it is
possible to input these variables in a single ‘cin’
statement using multiple stream extraction operators.
When we want to output more than one result then
this can be done using a single ‘cout’ statement with
multiple stream insertion operators. This is called as
cascading of input and output operators.
Use of stream extraction >> and stream insertion
<<operators many times in a single input(cin) and
output(cout) statement is called cascading of input and
output operators.
Example:-
1) cin>>x>>y;
2) cout<<“The sum of ”<<x<<“ and “ <<y<<“ is
“<<sum;
1 MARK QUESTIONS
1)What is a stream?
2)Mention the different types of streams.
3)What is input stream?
4)What is output stream?
5)Mention the header file that holds cin and cout.
6)Write the syntax of cout.
7)What is the other name of ‘<<‘?
8)What are manipulators?
9)Mention two manipulators.
10) Mention the header file that holds setw() and
endl.
11) Write the syntax of cin.
12) What is the other name of ‘>>‘?
13) What is meant by cascading of operators?
3 MARK QUESTIONS
1)What is a stream? Explain the two types.
2)Explain ‘cout’.
3)Explain ‘cin’.
4)Explain manipulators.
5)Explain cascading of I/O operators.
CONTROL STATEMENTS
The statements that can alter the flow of sequence of
instructions are called control statements.
Control statements are of two types:
🖝 Selection
🖝 Iteration

Any single input statement, assignment and output


statement is called as simple statement.
A group of statements that are separated by
semicolon and enclosed within braces({ }) is called a
block or compound statement.
SELECTION STATEMENT: Selection statements allows us
to choose a set of instruction for execution depending
upon an expression’s truth value which indicates the
requirement or condition. It is also called as a
conditional or decision statement.
if STATEMENT : This statement is also called as the
“one-way branching” . This statement is used to decide
whether a particular set of statements should be
executed or not.

The block of Statements A is executed only if the test


condition is true after which the block of Statements B
is executed. If the test condition is false, control goes
directly to Statements B.
Example
dis=0;
if(amt>10000)
dis = 0.08;
C++ program to find the largest of two numbers using
simple-if statement
if- else STATEMENT: This statement is also called as the
“two- way branching”. It is used when there are
alternative statements need to be executed based on
the condition.

The block of Statements A will be executed only if the


test condition is true, otherwise if the test condition is
false the block of Statements B will be executed.
Example
if(a > b)
l= a;
else
l=b;
C++ program to determine whether the shape is a
square or rectangle.
C++ program to find the greatest of two numbers.
if- else- if STATEMENT / else if ladder: This statement is
also called as the “multiple- way branch” . This
statement will be used to verify a range of values. This
statement allows a choice to be made between two or
more different possible alternatives.

Example
C++ program to find the largest of three numbers
using if-else-if statement.
#include<iostream.h>
main()
{
int a,b,c,l;
cout<<“Enter the three numbers “;
cin>>a>>b>>c;
if((a>b) && (a>c))
l = a;
else if (b>c)
I = b;
else
l =c;
cout<<“The largest number is “<<l;
}
NESTED if STATEMENT: It is possible to write an if
statement within another if statement. Ii is called as
nested if.
SYNTAX
if (expression 1)
if (expression 2)
Statement 1;
else
Statement 2;
else
if (expression 3)
Statement 3;
else
Statement 4;

C++ program to find the largest of three numbers


using nested-if:
#include<iostream.h>
main()
{
int a,b,c,l;
cout<<“Enter the three numbers “;
cin>>a>>b>>c;
if (a>b)
if(a>c)
l=a;
else
l=c;
else
if(b>c)
l=b;
else
l=c;
cout<<“The largest number is “<<l;
}
MULTIPLE SELECTION / SWITCH STATEMENT: If we
have to choose from one of the many alternatives, we
can implement it using the if-else-if statement. The
complexity of such programs increases when the
number of alternatives increases. The process can be
simplified with the usage of multiple selection decision
statement. This successively tests the value of an
expression against a list of integer or character
constants. When a match is found, the statements
associated with that constant are executed.
SYNTAX
switch (Test expression)
{
case value 1 : {
Statements A;
break;
}
case value 2 : {
Statements B;
break;
}
……………
……………
case value N : {
Statements N;
break;
}
default : {
Default Statements;
}
}
Statements N+1;

C++ program to display the day in a week when the


day number is given using switch statement:
#include<iostream.h>
main()
{
int dayno;
cout<<“Enter the day number “;
cin>>dayno;
switch(dayno)
{
case 1 : cout<<“Sunday”;
break;
case 2 : cout<<“Monday”;
break;
case 3 : cout<<“Tuesday”;
break;
case 4 : cout<<“Wednesday”;
break;

case 5 : cout<<“Thursday”;
break;

case 6 : cout<<“Friday”;
break;

case 7 : cout<<“Saturday”;
break;

default : cout<<“Invalid day number”;


}
}
1 MARK QUESTIONS
1)What are control statements?
2)Mention the different control statements.
3)Mention the different selection statements.
4)Mention the different iteration statements.
5)What is simple statement?
6)What is compound statement?
7)Give the other name for the selection statement.
8)What is the other name of simple-if statement?
9)Write the syntax of simple-if statement.
10) Draw the flowchart of simple-if statement.
11) What is the other name of if-else statement?
12) Write the syntax of if-else statement.
13) Draw the flowchart of if-else statement.
14) What is if-else-if statement also called as?
15) What is the other name of multiple selection
statement?
5 MARK QUESTIONS
1)Explain simple-if statement with an example.
2)Explain if-else statement with an example.
3)Explain if-else-if statement with an example.
4)Explain nested-if statement with an example.
5)Explain multiple selection statement with an
example.
ITERATIVE STATEMENTS OR LOOPS:
The process of repeating the execution of a certain set
of statements based on a condition is called as iteration
or looping.
The different looping statements in C++ are:
1) while
2) do- while
3) for
The while and do while loops are used in the
situation when the programs does not know exactly the
number of executions.

for loop is used when the number of


repetition is known in advance.
while STATEMENT: This structure is also called as the
“pre- tested” looping structure. In this structure, the
checking of the requirement or condition is done at the
beginning of the structure. The set of statements in the
structure is executed again and again until the test
condition is true. If the test condition becomes false
control is transferred out of the structure.
Write a C++ program to print the numbers in
descending order.(n to 0)
#include<iostream.h>
#include<iomanip.h>
main()
{
int n;
cout<<“Enter the starting number “;
cin>>n;
while(n>=0)
{
cout<<setw(3)<<n;
n=n-1;
}
}
do- while STATEMENT: This structure is also called as
the “post- tested” looping structure. In this structure
the checking of the requirement or condition is done at
the end of the structure. The set of statements in the
structure is executed again and again until the test
condition is true. If the test condition becomes false
control is transferred outside the structure.

Write a C++ program to print all even numbers from 1


– 25 using do-while loop.
#include<iostream.h>
#include<iomanip.h>
main()
{
int i;
i = 2;
do
{
cout<<setw(3)<<i;
i = i + 2;
}while(i<= 25);
}
for STATEMENT: This structure is also called the “fixed
execution” looping structure. We know exactly how
many times a particular set of statements is to be
repeated again and again. The for statement can be
either used as the increment looping statement or the
decrement looping statement.

Examples
1) for(i= 1; i <= 10; i++)
cout << i;
2) Multiple statements can be included in an
expression of the for loop by using the comma
operator.
for (sum = 0, i =1 ; i <= 10; sum = sum +i, i++);
cout << “Sum of ten natural numbers = “ << sum;
Program to print all the odd numbers up to the given
limit
#include<iostream.h>
#include<iomanip.h>
main()
{
int n,i;
cout<<“Enter the limit “;
cin>>n;
cout<<“The odd numbers are “<<endl;
for(i=1;i<=n;i=i+2)
cout<<setw(3)<<i;
}
NESTED LOOPS: If one looping statement is enclosed in
another looping statement, then such a sequence of
statements is called as nested loops.
If one ‘for’ statement is performed within another, the
sequence is called as ‘nested- loop’.
Whenever nested loops are used the inner loop is
completely enclosed by the outer loop. The inner loop
is completely repeated for each repetition of the outer
loop.
Example
for(row=1; row<=3;row++)
{
for(column=1; column <=3; column++)
cout << column<<setw(4);
cout << endl;
}
The output generated will be 123
123
123
1 MARK QUESTIONS
1)What is iteration?
2)What is iteration also called as?
3)What is while loop also called as?
4)Write the syntax of while loop.
5)Draw the flowchart of while loop.
6)What is do-while loop also called as?
7)Write the syntax of do-while statement.
8)Draw the flowchart of do-while statement.
9)Write any one difference between while and
do-while loop.
10) What is for loop also called as?
11) Write the syntax of for statement.
12) Draw the flowchart of for statement.
13) What is meant nested loop?
5 MARK QUESTIONS
1)Explain while statement with an example.
2)Explain do-while statement with an example.
3)Compare while and do-while statements.
4)Explain for statement with an example.
JUMP STATEMENTS
The jump statements unconditionally transfer program
control within a program.
C++ has four statements that perform an unconditional
branching- goto, return, break and continue.
goto and return statements are used anywhere in the
program whereas break and continue are used inside
the loops.
BREAK STATEMENT: The break statement is used to
terminate a case in the switch statement or to
terminate the loops. When ‘break’ is encountered
inside any loop, control automatically passes to the first
statement after the loop.
The break statement is written as break;
Example
for(n=0;n<100;n++)
{
cout<<n;
if(n == 10)
break;
}
The above program segment prints the numbers
from 0 – 10. Then the loop terminates because ‘break’
causes immediate exit from the loop.
CONTINUE STATEMENT: When the keyword ‘continue’
is encountered inside any loop, control automatically
passes to beginning of the loop.
The ‘continue’ statement is written as: continue;
Example
for(n= 5; n>0 ; n--)
{
if (n = = 3)
continue;
cout<<setw(3)<<n;
}
The above program segment prints the
numbers 5 4 2 1. Here, when the ‘n’ value reaches 3
control is transferred to the beginning of the loop.
RETURN STATEMENT: The ‘return’ statement is used to
return from a function.
GOTO STATEMENT: The ‘goto’ statement is used to
transfer control from one point in a program to any
other point in that program. This action is called
branching.
SYNTAX
goto labelname;
…………….
………….....
labelname : statement;
labelname is a user defined identifier and can
appear either before or after ‘goto’. This statement
provides an unconditional jump to the statement
indicated by the labelname. No declaration is required
for the labelname.
Write a C++ program to print the numbers from 10 to
1 using goto statement:
#include<iostream.h>
#include <iomanip.h>
main()
{
int n = 10;
loop : cout<<setw(3)<<n;
n- -;
if(n>0)
goto loop;
}
exit() FUNCTION: exit() function is used to terminate
the execution of the program.‘break’ statement
terminates the execution of the loop in which it is
written, where as exit() terminates the execution of the
program itself.
1 MARK QUESTIONS
1)What is the purpose of ‘jump’ statements?
2)Mention the different ‘jump’ statements.
3)What is the purpose of the ‘jump’ statement?
4)What is the purpose of the ‘continue’ statements?
5)What is the purpose of the ‘return’ statements?
6)What is the purpose of the ‘goto’ statements?
7)What is the purpose of the exit() function?
8)What is the difference between break and exit()?
9)What is the difference between break and
continue?
10) Write the syntax of goto statement.
5 MARK QUESTIONS
1)Explain ‘jump’ statements.
ARRAYS
Normal variable can store a value. We need arrays to
store a large number of elements under a single
name. This makes the accessing of elements easier.
Array:
An array is an ordered collection of elements of same
data type that share common name.
Index
The elements of the array are stored in
consecutive memory locations and are referenced
by a number called an index or a subscript.
Subscript/index indicates the position of the
element in the array. The index is used to access
the individual element. Array subscript starts with
0.
The method of numbering the i th element with index
i-1 is called zero based indexing. For example, the
element a[3] is 3 steps from the element a[0].
Types Of Arrays
There are three types of arrays.
1) One-dimensional array
A collection of elements, all of the same type and
name, structured in one dimension. Each element is
accessed by an index that indicates the component’s
position within the collection.
2) Two-dimensional array
A collection of elements, all of the same type and
name, structured in two dimensions. Each element is
accessed by a pair of indices that represent the
element’s position in each dimension.
3) Multi-dimensional array
A collection of elements, all of the same type and
name, structured in N dimensions(N≥1). Each element
is accessed by N indices, each of which represents the
element’s position within that dimension.
One-dimensional array
A collection of elements, all of the same type and
name, structured in one dimension. Each element is
accessed by an index that indicates the component’s
position within the collection.
The general form of array declaration is
datatype arrayname[size];
where ‘datatype’ describes what type of data
is stored in the array, ‘size’ specifies the number of
elements in the array and must have a value greater
than 0 and ‘arrayname’ identifies the array.
Example
int marks[80];
declares an array named ‘marks’ to store 80
integer elements.
Initialization of one dimensional array:
You can give the values to each array elements when
the array is declared.
Example 1
int a[5]={9,1,6,2,8};
In the above example, value 9 is stored in
a[0],1 in a[1],6 in a[2],2 in a[3],8 in a[4].
If there are less number of elements specified than
the size of the array ,the remaining elements are filled
with 0 by the compiler.
Example 2
float weight[5]={1.5,2.8,2.5};
In the above example value 1.5 is stored
in weight[0],value 2.8 in weight[1],and 2.5 is stored in
weight[2].The elements weight[3],weight [4] are
initialized with 0.Thus in the initialization, the default
value is 0.
When an array has an explicit initialization ,its size can
be omitted from the declaration.
Example 3
int a[5]={9,-5,6,2,8};
is equivalent to int a[ ]={9,-5,6,2,8};
The amount of space required to hold an array is
directly related to its type and size of the array. The
total size can be calculated using
Total size = size of data type * size of array
Example
Consider the declaration int A[4];
Total size = 2 * 4 = 8
C++ program to read the elements into the array and
printing the elements
#include<iostream.h>
#include<conio.h>
#include<iomanip.h>
void main()
{
int a[10],i,n;
clrscr();
cout<<“Enter the number of elements ”;
cin>>n;
cout<<“Enter the elements ”;
for(i=0;i<n;i++)
cin>>a[i];
cout<<“The elements are ”;
for(i=0;i<n;i++)
cout<<setw(5)<<a[i];
getch();
}
Two-dimensional array
A collection of elements, all of the same type
and name, structured in two dimensions. Each element
is accessed by a pair of indices that represent the
element’s position in each dimension.
The elements of two-dimensional arrays are
represented as rows and columns. To identify any
element, we should know its row number and column
number.
The general form of array declaration is
datatype arrayname[row-size] [column-size];
where ‘datatype’ describes what type of data is
stored in the array, ‘row-size’ specifies the number of
rows, ‘column-size’ specifies the number of columns in
the array and must have a value greater than 0 and
‘arrayname’ identifies the array. The row-size and
column-size should be separately enclosed within
square brackets.
Example
int A[8][2];
declares an array named ‘A’ to store 16(8x2) integer
elements. The elements are arranged as 8 rows and 2
columns.
Initialization of TWO dimensional array
We can initialize a two dimensional array either by
initializing it in its declaration or by using assignment
statement.
Example 1
int a[2][3]={10,9,1,6,2,8};
Array ‘a’ contains 2 rows and 3 columns.
a[0][0]=10 a[0][1]=9 a[0][2]=1
a[1][0]=6 a[1][1]=2 a[1][2]=8
Example 2
int a[2][3]={
{4,9},
{1}
};
Array ‘a’ contains 2 rows and 3 columns. We
initialize the first two elements to the first row, the next
element to the second row. The remaining elements
are automatically set to zero.
a[0][0]=4 a[0][1]=9 a[0][2]=0
a[1][0]=1 a[1][1]=0 a[1][2]=0
Example 3
int a[2][3]={ {0},{0}};
Array ‘a’ contains 2 rows and 3 columns. All the
elements are automatically set to zero.
a[0][0]=0 a[0][1]=0 a[0][2]=0
a[1][0]=0 a[1][1]=0 a[1][2]=0
Accessing the elements
We need to use nested for loops. One loop
processes the rows and another loop processes the
columns. If outer loop is for rows and inner loop is for
columns, then for each row index, all the columns are
processed and then the same process is repeated for
next row index.
C++ program to read the elements into the array and
printing the elements
#include<iostream.h>
#include<conio.h>
#include<iomanip.h>

void main()
{
int a[10][10],i,n,m;
clrscr();
cout<<“Enter the order of the matrix ”;
cin>>m>>n;
cout<<“Enter the elements ”;
for(i=0;i<m;i++)
{
for(j=0;j<n;j++)
cin>>a[i][j];
}
cout<<“The elements are ”;
for(i=0;i<m;i++)
{
for(j=0;j<n;j++)
cout<<setw(5)<<a[i][j];
cout<<endl;
}
getch();
}
Multi-dimensional array
A collection of elements, all of the same type and
name, structured in N dimensions(N≥1). Each element
is accessed by N indices, each of which represents the
element’s position within that dimension.
The general form of array declaration is
datatype arrayname[s1][s2] ……..[sn];
where si is the size in the ith dimension.
1 MARK QUESTIONS

1)What is the difference between a variable and an


array?
2)What is an array?
3)What is an index?
4)What is zero based indexing?
5)Mention the types of arrays.
6)What is one dimensional array?
7)What is two dimensional array?
8)What is multi dimensional array?
9)Write the syntax of one dimensional array
declaration.
10) Write the syntax of two dimensional array
declaration
11) Write the syntax of multi dimensional array
declaration.
3 MARK QUESTIONS
1)Explain the types of arrays.
2)Write a C++ program to read and print the
elements of a one dimensional array.
3)Write a C++ program to read and print the
elements of a two dimensional array.
4)How are one dimensional array initialized?
5)How are two dimensional array initialized?
5 MARK QUESTIONS
1)What is an array? Mention and explain the types of
arrays.
Functions
If the programs are complex and lengthy ,they can be
modularized into sub-programs. The subprograms are
called as functions .The sub-programs can be
developed independently ,compiled and tested . They
can be used in other programs also.
A function is a named group of statements
developed to solve a sub-problem and return a value to
other functions when it is called.
Types of functions
There are two types of functions.
1.Library functions
2.User-defined functions
Library functions: A standard library is a collection of
pre-defined functions and other programming
elements which are accessed through header files.
Header files are the files containing standard functions
that our programs may use.
The header file should be written in angled brackets
and its functions are included into our programs by
#include directive.
USER-DEFINED FUNCTIONS: We can create our own
functions or sub-problem to solve our problem . Such
functions are normally referred to as user defined
functions.
A user defined program is a complete and independent
program ,which can be used by the main program or by
the other sub-program.
The user defined functions are written to perform
definite calculations. After performing their task they
send back the result to the calling program or
sub-problem.
Different header files
c++ contains many header files.
1) stdio.h : This header file contains the functions and
macros to perform the standard i/o operations. When
we include the header file iostream.h, the header file
stdio.h is automatically included into our program.
Few of the standard i/o functions of the
header file stdio.h are printf(), scanf(),gets() ,getchar()
,putchar() etc.
2)string.h : This header file declares functions to
manipulate strings. Few of the functions contained in
the header file string.h are strlen(), strlwr(), strupr(),
strcat(), strcmp(), strcmpi() etc.
3) stdlib.h : This header file is used to include functions
involving memory allocation, process control etc. Few
of the functions are malloc(), realloc(), free() etc.
4) iostream.h: This header file contains C++ streams
and i/o routines .Few of the functions are open(),
close() ,get(), getline(), read() ,write() ,put() etc.
5) iomanip.h: This header file contains functions and
macros for i/o manipulators. Few of the functions
setw, setprecision etc.
6) math.h: This header file declares prototypes for the
mathematical functions. Few functions are
sqrt(),exp(),log() ,tan() ,cos() ,sin(), etc.
Character and string functions
A character is any single character enclosed within
single quotes. Some functions accept a character as
argument. To use these functions, the header file
ctype.h should be included.
Inputting single character:
We can input a character using the function
get().The general form is
char ch;
ch = cin.get();
Outputting single character
We can output a character using the function
put(). The general form is
cout.put(ch);
Example
char ch;
ch = cin.get();
cout.put(ch);
Write a C++ program to determine the type of the
character:
#include<iostream.h>
#include<ctype.h>
main()
{
char ch;
cout <<“Enter a character “;
ch = cin.get();
if(isalpha(ch))
cout<<ch<< “ is an alphabet”;
else
if(isdigit(ch))
cout<<ch<< “ is a digit”;
else
cout<<ch<< “ is a special character”;
}
String: A string is a sequence of characters enclosed
within double quotes and terminated by NULL (‘\0’)
character.
Strings are manipulated as one-dimensional array of
characters terminated by NULL (‘\0’) character. The
header file ‘string.h’ should be included to manipulate
strings provided by C++.
Declaration of a string variable
Syntax
char stringname[size];
where ‘stringname’ is the name of the
string variable and ‘size’ is the number of characters in
the string.
Example
char s[50];
This declaration reserves 50 bytes to store
the characters of the string variable ‘s’.
String initialization
String can be initialized when they are declared.
Examples
1) char str[9] = “Computer”;
If an entire string is initialized to a string variable,
the NULL character is automatically appended to the
end of the string.
2) char str[] = “Computer”;
The string is initialized without specifying its size.
The size is determined automatically.
3) char str[9] = { ‘C’, ‘o’, ‘m’, ‘p’, ‘u’, ‘t’, ‘e’, ‘r’, ‘\0’ };
If the string is initialized by giving the characters,
then we must explicitly specify the string terminator
i.e., NULL character.
4) char str[12] = “Computer”;
The string is initialized with only 8 characters and
the NULL character is appended to the end of the
string.
STRING FUNCTIONS
The string functions are present in the ‘string.h’
header file.
1) strlen() function
This function returns the length of the string( the
number of characters present in the string). NULL
character is not included.
Syntax
variable = strlen(string);
Example
length = strlen(“Computer”); returns 8.
A string of length 0 is called a null string.
2) strcat() function
This function is used to concatenate two strings.
The process of combining two strings to form a string is
called as concatenation.
Syntax
strcat(string1, string2);
It concatenates string2 at the end of string1.
Example
char str1[ ]=“Comp”;
char str2[ ] =“uter”;
strcat(str1, str2);
str1 becomes “Computer”.
3) strcpy() function
A string cannot be copied to another string by
using assignment statement. The function strcpy() is
used to copy a string to another string.
Syntax
strcpy(string1, string2);
It copies all the characters of string2 to
string1.
Example
char str1[5] = “SCPC”;
strcpy(str2, str1);
str2 becomes “SCPC”.

4) strcmp() function
This function is used to alphabetically compare a
string with another string. This function is case
sensitive(it treats the uppercase letters and lowercase
letters as different).
Syntax
strcmp(string1, string2);
It compares all the characters of string2 with
string1. It returns 0 if the two strings are equal, a
positive value if string1 > string2, a negative value if
string1 < string2.
Example
char str1[5] = “PCMC”;
char str2[5] = “PCMC”;
strcmp(str1, str2); returns 0.
5) strcmpi() function
This function is used to alphabetically compare a
string with another string. This function is not case
sensitive(it treats the uppercase letters and lowercase
letters as same).
Syntax
strcmpi(string1, string2);
It compares all the characters of string2 with
string1. It returns 0 if the two strings are equal, a
positive value if string1 > string2, a negative value if
string1 < string2.
Example
char str1[5] = “PCMC”;
char str2[5] = “pcmc”;
strcmpi(str1, str2); returns 0.

6) strrev() function
It converts a string into its reverse.
Syntax
strrev(string);
Example
char str[5]= “PCMC”;
strrev(str) returns “PCMC” into “CMCP”.
7) strlwr() function
It converts a string into lowercase.
Syntax
strlwr(string);
Example
char str[4]= “PCMC”
strlwr(str) returns “PCMC” into “pcmc”.
8) strupr() function
It converts a string into uppercase.
Syntax
strupr(string);
Example
char str[4]= “pcmc”
strupr(str) returns “pcmc” into “PCMC”.

Inputting a string
The function getline() is used to read a string.
Syntax
cin.getline(string, size);
Example
cin.getline(str, 30);
Outputting a string
The function write() is used to output a string.
Syntax
cout.write(string, size);
Example
cout.write(str, 30);

2 MARK QUESTIONS
1)What is a function? Mention the types of
functions.
2)What is a header file? Mention few header files.
3)Explain any two character functions.
4)What is the difference between isupper() and
islower()?
5)What is the difference between isupper() and
toupper()?
6)What is the difference between islower() and
tolower()?
7)What is a string? Mention the header file that
should be included to manipulate strings.
8)What is a string? Write the syntax of declaration.
9)Explain the syntax of declaring a string with an
example.
10) Explain any two string functions.
11) Explain strlen() function.
12) Explain strcat() function.
13) Explain strcpy() function.
14) Explain strcmp() function.
15) Explain strcmpi() function.
16) What is the difference between strcmp() and
strcmpi() functions?
17) Explain strrev() function.
18) Explain strlwr() function.
19) Explain strupr() function.
20) What is the difference between strlwr() and
strupr() functions?
21) What is the difference between strcat() and
strcpy() functions?
22) What is the difference between strcmp() and
strcat() functions?
23) What is the difference between strcmp() and
strcpy() functions?
24) Write the syntax of inputting and outputting a
string?
25) Write the syntax of inputting and outputting a
single character?
26) Explain the syntax of inputting a string.
27) Explain the syntax of outputting a string.
28) Explain the syntax of inputting a single character.
29) Explain the syntax of outputting a single
character.

CHAPTER 13 : USER DEFINED FUNCTIONS


User Defined Function: A user defined function is a
complete and independent program ,which can be
used by the main program or by the other
sub-program.
Advantages of user defined functions:

⮚ If there is a set of statements to be repeated


several times in the program , these statements
can be replaced as a function and called whenever
and wherever.

⮚ If a task is needed in more than one program or to


a group of programmers ,a function can be
developed and made available to other programs
or other programmers.

⮚ Programs can be modularized into function .Each


function can be developed independently
,debugged and tested.

⮚ If a problem is divided into sub-problem ,a team of


programmers can be formed to solve each sub
problem ,rather solving by a single person.

⮚ If functions are developed in a program ,the


number of lines decreases.
General form or structure of user defined functions:

⮚ return_type_specifier function_name(argumentlist
with declaration) -> Function header

⮚{

⮚ Local variable declarations;

⮚ Executable-statement 1;

⮚ Executable-statement 2;

⮚ Executable-statement 3;
Body of the function

⮚ -------

⮚ ------

⮚ Executable-statement n;

⮚ return (expression);

return-type specifier: It is the data type of the value


returned by the function to another function when it
is called. It can be int ,float, char , or void .Data type
‘void’ is used when the function return no value to
the calling function.
Function name: It is the name of the function. It is an
identifier to identify the particular function in a
program . It is the name of the function. It is an
identifier to identify the particular function in a
program .
Argument list with declaration:
It is the list of arguments or parameters or variables
with their declaration .Each argument should be
declared separately. Each declaration should be
separated by comma. The list should be enclosed
within parenthesis. The complete line is called the
function header.
Local variable declaration: It is the declaration of
the variables that are used within the function. Since
these variables are local to the function ,these
variables are called as local variables.
Executable statements: These are the statements
that perform the necessary operations to solve the
problem. If the function is returning a value, a return
statement should be included. Otherwise return
statement is not necessary.
Local variable declaration and executable
statements are together called body of the function.
The body of the function should be enclosed with in
the curled braces.
Example
int sumoftwo(int c, int d)
{
int s;
s = c + d;
return(s);
}
Note :

✔ User-defined function is a function defined by


the user to solve his/her problem.

✔ There can be more than one user-defined


function in a program.

✔ To execute a user-defined function ,it must be


called by other function or the main function.
Calling a function :The definition of the function can
come either before the main ( ) function or after the
main ( ) function.
A function can be called by specifying its name,
followed by list of arguments enclosed within
parenthesis. The arguments should be separated by
commas. If the functions does not pass any arguments,
then an empty pair of parenthesis should follow the
name of the function.
Note

❖Calling function is a function that transfers control


from it to another function by specifying
the name of that function and passing arguments .

❖Called function is a function that receives the call


and arguments from another calling function.

❖Function call is the statement that is used to call or


make another functions execute.

❖When a function call is made the control jumps


from calling function to the called function.
The general form of function call is
Variable =functionname(argumentlist);
OR
Variable =functionname( );
Example
sum=sumoftwo(a,b);
Returning a value : When a function is called, the
statements in the called function are executed.
After executing the statements, the function
returns value to the calling function. The return
statement is used to return a value .A function can
return only one value or none to the calling
function, for every function call. The general form
of return statement is return (expression);

▪ Note: The usage of return statement is not


compulsory.

▪ A function can have many return statements


depending on the situation. But only one return
statement is executed since the execution of
return statement terminates the execution of the
function.

▪ Function declared as ‘void’ do not return a value.


Hence the ‘return’ statement need not be
included.
▪ The datatype of the returning value must be the
same as that of the return_type_specifier in the
function header.

▪ The return statement terminates the execution of


the function and the control is transferred back to
the calling function along with the value.
main() function:
In C++, the main() function returns a value of type
‘int’ to the operating system. If the program runs
successfully, 0 is returned. Otherwise, a non-zero
value is returned to the operating system,
indicating that the program contains errors. If the
main() function is not returning a value, the
datatype ‘void’ can be used as
return_type_specifier.
The general fom of the main() function is
int main()
{
Executable statements;
return 0 }
OR
void main()
{
Executable statements;
}
Function prototype: A function prototype is a
declaration of the function that tells the program
about the type of the value returned by the
function and the number and type of the
arguments.
The general form of function prototype is
return-type-specifier function name(type ,
type,………);
Example int sum(int , int);
TYPES OF ARGUMENTS
1) ACTUAL ARGUMENTS : The arguments or
parameters listed in the function call statement are
called as actual arguments. The arguments can be
constants , variables or expressions.
Example
In the function call g= gcd (a , b);
‘a’ and ‘b’ are the actual arguments.
Actual arguments have values stored in them
before the function call. Hence the name actual.
2) FORMAL ARGUMENTS
The arguments listed in the function header are
called as formal arguments or dummy arguments
.Formal arguments get their values from the
actual arguments.
Example
In the function header, int gcd (int x
,int y)
x and y are the formal arguments.
Note

❑The actual arguments and formal arguments


should be same in number and order.

❑The names of actual arguments and formal


arguments can be the same or different.
Local variables :The variables declared inside
function or block are called as local variables
.Values of local variables are accessible only in that
block . The function’s formal arguments are also
considered as local variables.
Example
int sumoftwo(int c , int d)
{
int s; //local variable
return(s);
}
Global variables: The variables declared outside the
function are called as global variables .These
variables are referred by the same data type and
same name throughout the program in both the
calling function and called function .
Example
int a, b; //a and b are global variables.
void main( )
{
int p , q; // local variables.
-----

-----
}
1 MARK QUESTIONS
1)What is user defined function?
2)Write one advantage of user defined function.
3)Mention the datatype used when the function
return no value to the calling function.
4)What is meant by calling function?
5)What is meant by called function?
6)What is meant by function call?
7)Write the general form of function call.
8)Write the general form of ‘return’ statement.
9)Write the general form of main() function.
10) What is function prototype?
11) Write the general form of the function
prototype.
12) What is actual argument?
13) What is formal argument?
14) What are local variables?
15) What are global variables?
5 MARK QUESTIONS
1)Write the advantages of user defined function.
2)Explain the structure of a user defined function
with an example.

Types of user defined functions:


There are different types of functions.

⮚ Function with no arguments and no return values.

⮚ Function with arguments and no return values.

⮚ Function with no arguments and with return


values.

⮚ Function with arguments and with return values.

⮚ Recursive functions.

Function with no arguments and no return values


In this method ,the function simply performs an
independent task. The function does not receive or
send any arguments.
Syntax
void function-name( )
{
statements;
}
Example
void print()
{
for(int i =0;i<10;i++)
cout<<setw(3)<<i;
}
Function with arguments and with no return values
In this method ,the function receives
some arguments and does not return any value.
The general form is
void function-name (argument–list with
declaration)
{
statements;
}
Example
void average(int x , int y, int z)
{
int sum ;
float avg;
sum=x +y + z;
avg=sum/3.0;
cout<<“Average=“<<avg;
}
Function with no arguments and with return values
In this method, the function receives no arguments
but return a value.
Syntax
return_type_specifier function name ( )
{
statements;
return (value);

}
#include<iostream.h>
void main()
{
int sumoften();
s=sumoften( );
cout<<“Sum=“<<s;
}
int sumoften()
{
int sum=0,i;
for(i=0;i<10 ; i++)
sum= sum + i;
return (sum);
}
Function with arguments and with return values
In this method, the function receives some arguments
but returns a value.
Syntax
return_type_specifier function name
(argument_list with declaration)
{
statements;
return (value/variable /expression);
}
Example
int sumoftwo(int c, int d)
{
int s;
s = c + d;
return(s);
}
Recursive functions
A function that calls itself is called recursive function .
The process of calling a function by itself is called as
recursion.
Recursive functions must have one or more terminating
conditions to terminate recursion otherwise recursion
will become infinite.
Syntax
return type specifier function_name (argument list)
{
statements;
return (function name (arguments));
}
1 MARK QUESTIONS:
1)Write the syntax of function with no argument and
no return values.
2)Write the syntax of function with argument and no
return values.
3)Write the syntax of function with argument and
with return values.
4)Write the syntax of function with no argument and
with return values.
5)Write the syntax of recursive functions.
6)What is recursion?
7)What is recursive function?
3 MARK QUESTIONS
1)Explain the syntax of function with no argument
and no return values with an example.
2)Explain the syntax of function with argument and
no return values with an example.
3)Explain the syntax of function with argument and
with return values with an example.
4)Explain the syntax of function with no argument
and with return values with an example.
5)Explain recursive functions with an example.

Scope of variables:
Scope of variables refers to the part of the
program where the value of the variables can be
used .
Passing default arguments to functions
To call a function we need not pass the values of
the arguments to a function from the calling
function . Default values can be assigned to the
formal arguments which does not have a matching
arguments in the function call. It can be assigned
only in the function prototype.
Example
float si (float p, int t ,float r=1.2);
1.2 is the default value provided to the argument
‘r’ .The function call can be S= si (1000,2);
Default arguments are used when a matching
argument is missing in the function call statement.
Any argument in the prototype cannot have a
default value. An argument in a prototype can
have default value if and only if all arguments
appearing on its right have default values .Default
values should be added from right to left.
Example :float si ( float p, int t=2,float r=1.2);
Uses of default arguments:

⮚ Default arguments are useful in situation where


some arguments have same value .

⮚ It provides flexibility to the programmers.


Passing constant arguments:
In C++, we can declare some arguments as constants.
The compiler cannot modify the arguments marked as
constants. This type of declaration is used in standard
library functions and when we pass arguments by
reference or pointers.
Example
int total(const int x, const int y);
Pass by value or call by value
The method of calling the function by passing the
arguments from the calling function to the called
function is called as pass by value or call by value.
The calling function sends the data to the called
function through actual arguments. The called function
receives the data into its corresponding formal
parameters. A copy of the data sent by the calling
function is stored in temporary storage locations. The
called function uses these values as the initial values of
the formal parameters. The formal parameters are
processed to generate the required results. These
changes are not affected to the original values stored in
the actual parameters.
Example
#include<iostream.h>
main( )
{
void swap (int, int);
int a,b;
cout<<“Enter the two numbers “;
cin>>a>>b;
cout<<“Values before function call”<<endl;
cout<<“a = “<<a<<“ and b = “<<b<<endl;
swap(a,b);
cout<<“Values after function call”<<endl;
cout<<“a = “<<a<<“ and b = “<<b;
}
void swap(int c, int d)
{
int temp;
temp = c;
c = d;
d = temp;
}
In this example, even though the formal
arguments ‘c’ and ‘d’ are changed, the original values
in the actual arguments are not changed.
Pass by reference or call by reference:
C++ allows to pass parameters to the function by using
reference variables. When we pass arguments by
reference, the formal arguments in the called function
become the aliases to the actual arguments of the
calling function. i.e., the called function is actually uses
the original data with a different name.
Example
#include<iostream.h>
main( )
{
void swap (int &, int &);
int a,b;
cout<<“Enter the two numbers “;
cin>>a>>b;
cout<<“Values before function call”<<endl;
cout<<“a = “<<a<<“ and b = “<<b<<endl;
swap(a,b);
cout<<“Values after function call”<<endl;
cout<<“a = “<<a<<“ and b = “<<b;
}
void swap(int &c, int &d)
{
int temp;
temp = c;
c = d;
d = temp;
}
In this example, the formal arguments ‘c’ and
‘d’ are changed. The original values in the actual
arguments are also changed.
Passing arrays to functions
To pass an array to a function, we just pass the name of
the array to the function. i.e., we are referring the
address of the first element of the array. Using this
address, the function can access all the elements of the
array.
When the array address is passed to the function by
giving the name of the array, the function assigns the
same address to another name declared as formal
argument in the called function. Any change made to
the array in the called function is also reflected in the
array of the calling function.
C++ compiler converts the array declaration of the
formal argument of the function into the array pointer.
The size of the array is not necessary.
Example
C++ program to sort the elements by bubble sort
#include<iostream.h>
#include<iomanip.h>
int i,n;
main( )
{
void read (int *);
void sort(int *);
void print(int *);
int n, a[50];
cout<<“Enter the number of elements “;
cin>>n;
read(a);
sort(a);
print(a);
getch();
}
void read(int b[])
{
cout<<“Enter the elements “;
for(i=0;i<n;i++)
cin>>b[i];
}
void print(int b[])
{

cout<<“Sorted array is “<<endl;


for(i=0;i<n;i++)
cout<<setw(3)<<b[i];
}
void sort(int b[])
{
int j,temp;
for(i=1;i<n;i++)
for(j=0;j<n-i;j++)
if(b[j] > b[j+1])
{
temp = b[j];
b[j] = b[j+1];
b[j+1] = temp;
}
}
Passing structures to functions:
We can pass structures to functions as we pass other
arguments. Structures are passed to functions using
pass by value method. i.e., the function works with the
copy of the structures. The function can also return a
structure after processing it. Whenever we pass the
address of the structure to the function, we should
include the address-of(&) operator.
1 MARK QUESTIONS
1)What is meant by scope of variable?
2)Mention the use of default argument.
3)What is call by value/ pass by value?
4)What is call by reference/ pass by reference?
5)What is the difference between call by value and
call by reference?
3 MARK QUESTIONS
1)Explain call by value/ pass by value.
2)Explain call by reference/ pass by reference.
3)Explain passing of an array to a function.
STRUCTURES
When we have a group of different data types to be
stored and referenced as a single element, we use
structures. For example, the elements employee
number, name, address, designation and salary may be
used to represent the data of an employee. The data is
of dissimilar types ie., employee number and salary is
of type integer, name, address and designation are
strings.
Definition: Structure is a group of logically related data
items of same type or different types.
Difference between an array and a structure:
An array is a homogeneous data element which can
store data elements of same type but a structure is a
heterogeneous data element which can store data
elements of different data types.
Defining and declaring a structure
The syntax of a structure definition is struct
structurename
{
datatype member name-1;
datatype member name-2;
…………………………………
…………………………………
datatype member-name-n;
};
The definition of structure starts with the keyword
‘struct’, followed by the name of the structure. The
pieces of data that make up the structure are called
the structure members, and they are placed in a group
between opening and closing braces. A semicolon is
used to terminate the structure to identify the end of
the structure.
Example
Consider a structure definition to hold a
student information
struct student
{
int regno;
char name[20];
char class[10];
char comb[6];
float percentage, fees;
};
This structure ‘student’ contains five
members: an integer quantity ‘regno’ which requires 2
bytes, a character array ‘name’ which requires 20
bytes, a sting ‘class’ which requires 10 bytes, a string
‘comb’ which requires 6 bytes, an float quantity ‘fees’
and percentage which requires 4 + 4 bytes. The
structure requires an area in the memory, which is 46
bytes long.
The definition of a structure does not create any
memory space in which values can be stored. This is
obtained by declaring the structure.
The syntax for declaring a structure is
structure_name structure_variable-name;

Example:
student s;
‘s’ is a structure variable of type ‘student’.
The definition and the declaration of a structure can
be combined.
Example:
struct student
{
int regno;
char name[20];
char class[10];
char comb[6];
float percentage, fees;
}s;
NOTE
1. The definition of a structure does not reserve
memory space to store values for the structure.
Definition just defines a form of the structure.

2. A semicolon should follow the last brackets of the


structure.

3. The definition of the structure should come either


before the main or before any other variables are
declared.

4. The declaration of the structure always comes after


the definition and the declaration of the structure
creates space to store the values for the structure.
Accessing the elements of the structure:
A member of the structure is always part of a structure
and it is not possible to refer to the member directly.
The individual elements of the structure is accessed
using the dot operator which is also known as the
membership operator.
Structure members are referenced using the syntax
structure-variable-name . member-name;
Example:- s.regno;
A C++ Program to input and display the information of
a student:
#include< iostream.h >
main()
{
struct student
{
int regno;
char name[50];
char class[10];
char comb[16];
float percentage, fees;
}s;
cout<<“Enter the Register Number “;
cin>>s.regno;
cout<<“Enter the Name “;
cin>>s.name;
cout<<“Enter the Class “;
cin>>s.class;
cout<<“Enter the Combination “;
cin>>s.comb;
cout<<“Enter the percentage “;
cin>>s.percentage;
cout<<“Enter the Fees “;
cin>>s.fees;
cout<<“The Register Number is ”<<s.regno<<endl;
cout<<“The Name is ”<<s.name<<endl;
cout<<“The Class studying is ”<<s.class;
cout<<“The Combination is “<<s.comb;
Cout<<“percentage = “<<s.percentage”;
cout<<“Fees paid is “<<s.fees;
}
Initializing a structure:
The member of a structure can be initialized when the
structure is declared. It is done by structure declaration
followed by a list containing values for each of its fields.
Example
student s =
{1234, “Anil”, ”II PUC”,”ECABCs”, 95 ,22000};
This initializes regno to 1234, name to Anil, class to
IIPUC, comb to ECABCs ,percentage to 95 and fees to
22000.
Nested structures:
A structure may be defined as a member of another
structure.
Structures where one structure is embedded within
another structure is called as a nested structure.
The declaration of the embedded structure must
appear before the declaration of the outer structure.
C ++ program to illustrate the use of nested structures
#include < iostream.h >
main()
{
struct date
{
int year;
int month;
int day;
};
struct student
{
int regno;
char name[40];
date dob;
}s;
cout<<“Enter the Register Number “;
cin>>s.regno;
cout<<“Enter the Name “;
cin>>s.name;
cout<<“Enter the Date of Birth “;
cin>>s.dob.day>>s.dob.month>>s.dob.year;
cout<<“The Register Number is “<<s.regno;
cout<<“Name is”<<s.name;
cout<<“The Date of Birth
is<<s.dob.day<<s.dob.month<<s.dob.year;
}
Arrays of structure: A single variable that represents a
structure creates memory space to store one set of
information. If we have to create memory space for
more instances then we may have to either increase
the number of variables used or use the facility called
array.
An array of structures is an array in which each
element of the array is a structure .
Example
struct student
{
int regno;
char name[20];
char class[10];
char comb[6];
int fees;
}s[100];
In this declaration ‘s’ is a 100 element array of
structures, each element of the array ‘s’ is a separate
structure of type ‘student’.
An array of structure can be assigned initial values.
Each element is a structure that must be assigned a
corresponding set of initial values.
Example
student s[ ] ={1,”Anil”, “II PUC”, “PCMC”, 87, 22000,
2, “Binil”, “II PUC”, “PCMC”,99, 22000}
In this example ‘s’ is an array of structures whose
size is not specified. The initial values will define the
size of the array, and the amount of memory required
for storing the array. The array contain two elements.
Word Processing Application
Word Processing Application: A word processor is a
computer software application, that performs the task
of composing, editing, formatting, and printing of
documents.
Types of word processing applications:

❑ Abiword.

❑Apple TextEdit.

❑Word perfect.

❑Microsoft Word.,etc

Microsoft Word: Microsoft Word or MS-WORD (often


called Word) is a graphical word processing program
that users can type with. It is made by the computer
company Microsoft.
Basic Windows features: Ms-Word consists of the
following features.
Frame : Using this option resizing of the windows is
possible.
Title bar : It gives the details of the file saved and name
of the application software . It can be used to move ,
maximize , minimize and close the window.
Menu bar : Standard operations can be carried using
the menu bar.
Tool bar : Some of the easy method of carrying out the
activity by seeing the icons .
Vertical scroll bar : A vertical bar commonly located on
the far right of a window allows you to move the
window viewing area up or down.
Horizontal scroll bar : A Horizontal bar commonly
located on the bottom of a window allows you to move
the window viewing area left or right.
Ruler: Ruler in MS Word can help us to set tabs , to set
indents , to change page margins.
Parts of the Menu/Windows:
The various menu options available in MS word are :

❖File Menu .

❖Edit Menu .

❖View Menu .
❖Insert Menu .

❖Format Menu .

❖Window menu .

❖File Menu: File menu appears as the first item in


the menu bar, and contains commands relating to
the handling of files such as open, save, print, etc.
❖The file menu consists of the following functions :

❖Open : It is used to open saved files.

❖New : It is used to create new files.

❖Close : It is used close the currently opened file ,


not the window.
❖Save : It is used to save the with the updated data
to the new or existing file.
❖Save As : It is used to save the file with different
name, extension or location.
❖Page setup : It helps to set up the orientation , size
, margin , etc.
❖Print preview : It shows a softcopy view of how
the file will look before printing.
❖Print : It helps to print the document and get the
hard copy of it.
❖Exit : It terminates the Word window.

❖Edit Menu: The Edit menu is a menu-type


graphical control element found in most computer
programs that handle files, text or images. It is
often the second menu in the menu bar, next to
the file menu.
The difference between file menu and edit menu is
that the file menu commonly contains commands
about handling of files such as open , save , and print.
The edit menu commonly contains commands relating
to the handling of information within a file, e.g. cut and
paste and selection commands.
The edit menu consists of the following functions :
Undo : It Undoes the last action of the user.
Cut : It cuts a selection and saves it to the clip board.
Copy : It copies the selection and saves it to the
clipboard.
Paste : It pastes the clipboard content into the
document.
Clear : It erases the selection without sending it to the
clipboard.
Select all : It selects the entire document, used for
making some global changes to the document.
Find : It lets us search the document for a desired text.
Replace : It lets us to replace certain text with some
other text.
Goto : It helps the user to navigate the document ,if
the document is too big to be scrolled. It also helps us
to directly jump to a bookmark if a bookmark is saved.
View Menu: The View menu is a menu-type graphical
control element found in most computer programs that
helps us to format how the document is seen .
The View menu consists of the following functions :
Normal : This shows the text and graphics , but not
margins, headers or footers.
Toolbar : It helps the user to enable the various tools in
toolbar if it is not present in the document window.
Ruler : It is used to display the ruler in the document.
Header and footer : Headers and footers in Microsoft
Word refer to tiny pieces of information, such as page
numbers, dates, book titles etc. that appears on every
page. A header will appear along the top of a Microsoft
Word document, and a footer will appear along the
bottom of a document.
Insert Menu: The Insert menu is a quick way to add
features like page number, date etc. to your document.
The Insert menu consists of the following functions :
Page Number :This lets you enter page numbers if you
have a long document.
Date and time : Inserts current time and date in the
word document.
Special Characters / Symbols : Lets you enter special
characters in the document.
Pictures : It helps to add certain clipart or saved
pictures in our pc.
Comment : It helps to add certain notes about certain
document parts.
Word art : It helps us to use various fancy effects on
the words or letters.
Format Menu: The Format menu is the most important
menu as it helps the user to format the text , page ,
font and other various things in the document to suit
our needs.
The Format menu consists of the following functions :
Borders and Shading : It lets the user add a border
around an selection.
Bullets : It is used to add bullets or small clipart or
numbers for our list items
Columns : It allows the user to add columns in the
document.
Text Wrap : It allows the user to decide how the text
should be displayed around a picture.
Spelling : It checks the document for grammatical and
spelling errors.
Thesauras : It provides the synonyms for certain words
.
Mail Merge: In mail Merge the letter is written only
once. This letter can be combined with a list of
addresses
and sent to all the addresses on the list.
The step involves the merging of two documents. The
main document contains the text to be send to all the
addresses. The data source contains the list of
addresses to whom these letters are to be send.
Steps to perform Mail Merge

▪ Select Mail Merge from the tools menu.

▪ Choose form letter from the Mail Merge create


button.

▪ Type the letter or document to be sent.

▪ Choose create source.

▪ The field names commonly used are displayed in


the header Row box.

▪ To delete field names, click on the name and click


remove field button.

▪ To add a new field, type in the new field name and


click on add field name.

▪ Type a name for data source and save.

▪ Click on edit data source button to type the


variable data.
▪ Enter data for each field, click on Add new to enter
more records and on OK to finish entry.

▪ In the main document click at the position where


you want the merged field to appear.

▪ Click on the insert merge field button on the Mail


Merge tool bar.

▪ Choose the field to be inserted.

▪ The fields will be inserted at that position in the


main document.

▪ Click on the merge data button on the mail merge


toolbar.

▪ The first document with the first set of variable


data will be displayed.

▪ Use the record navigator buttons to view the


remaining merged data.

SPREADSHEETS
An electronic spreadsheet is a computer application
program that can also hold formulas in a cell that serve
as a calculator. It performs calculations more accurately
and faster compared to manual calculations.
ESS document is a worksheet. Several worksheets make
up a workbook. The files with .xls or .xlsx extensions
identifies a workbook. ESS has rows numbered from 1
to 1048576 and columns represented from A to XFD.
Spreadsheets Applications:

▪ The ESS is the best tool for all the text and
calculations involved applications.

▪ The accounting balance sheet generation for the


auditing.

▪ The area where the graphical presentation is


required like statistical details presentations.

▪ In the schools and educational institutions for the


presentations of the graphs and charts.

▪ Multiple accounting is involved in the file of


budgeting for industry or company or IT firm.
The features are:
1) External Data: It allows you to retrieve data from
external data source and use it in your worksheets.
2) Financial Analysis: It can be used to make quick and
easy financial analysis. You can also analyse data and
create presentations with charts.
3) Drag and Drop Features: It helps you to reposition
the data and text by dragging the data with the help of
the mouse.
4) Auto fill: It helps you to fill rows and columns with
the series of data.
5) Shortcut Menus: Commands appropriate to the task
that you are doing by clicking the right mouse button.
Basic Concepts:

❑The intersection of row and column are called as


cell.

❑The text by default is aligned to left ,and numbers


are to the right.

❑To navigate from cell to another ,we can use


mouse or arrow keys on keyboard.

❑We can format the worksheet by changing font


style, color, alignment as per the need.
❑We can embed charts and pictures for better
analysis of data.

MENUS:
File Menu:
In file menu we have options like:-

▪ New(Ctrl+N)to open new workbook.

▪ Open(Ctrl+O)to open existing workbook.

▪ Save/Save as(Ctrl+S)to save the workbook created.


▪ Close to exit from the existing Excel.

▪ Print(Ctrl+P)to print the worksheet.

▪ Exit(Alt+F4) to go out of Excel.

Edit Menu: We have options like:

▪ Undo editing(Ctrl+Z)

▪ Cut(Ctrl+X)

▪ Copy(Ctrl+C)

▪ Paste(Ctrl+V).

▪ Del[erases the selection].

▪ Find(Ctrl+F)and Replace(Ctrl+U)-[to find a


particular entry in the sheet and to replace a
particular entry with a new one respectively].
View Menu: Using this menu we can have a look at
the worksheet in different ways.
Formulas Ribbon:- In this pre-defined formulas
relating to statistics,maths,date&time,logic,finance..etc
are available so that all the formulas need not be
memorized.
BUILT IN FUNCTIONS:
The built-in formulas are called functions. The users
have to provide the cell reference or address only.
These are called arguments of the function that are
given between a pair of parenthesis. The use of
functions shortens the formula.
Arithmetic Functions
=SUM(num1,num2,…..)
This function returns the sum of all the numbers in
the list of arguments.
=SUM(A1:A12)
=SUMIF(range, criteria, sum_range)
This function adds the cells specified by a given
criteria where range is the range of cells evaluated and
criteria is the form of a number, expression, or text that
defines which cells will be added.
=SUMIF(A1:A12,”<100”,B1:B12)
=ABS(number): This function returns the absolute
value of a number.
=ABS(-5) returns 5.
=MOD(number, divisor): This function returns the
remainder after number is divided by divisor. The result
has the same sign as divisor.
=MOD(15,2) returns 1.
=PRODUCT(number1,number2,….): This function
multiplies all the numbers given as arguments and
return the product.
=PRODUCT(5,3) returns 15.
=SQRT(number): This function returns a positive
square root.
=SQRT(24) returns 4.89879.
Statistical Functions:
=MIN(): Gives the least number among the list of
number
=MIN(A1:A8)
=MAX(): Gives the largest number among the list of
number
=MAX(A1:A8)
=AVERAGE(): Gives the mean of the numbers in the list
=AVERAGE(A1:A8)
=COUNT(): Counts how many numbers are in the list of
arguments
=COUNT(A1:A8)
=LARGE(RANGE,K): Returns the k-th largest value in a
range.
=LARGE(A1:A8,3)
=SMALL(RANGE,K): Returns the k-th smallest value in a
range.
=SMALL(A1:A8,5)
DATE AND TIME FUNCTIONS
DATE(): It returns a particular date. For example
=DATE(2010,3,23) returns 3/23/2010.
YEAR(): This function returns the year. The year is given
as an integer ranging from 1900 to 2078.
=YEAR("2017-01-15")returns 2017.
DAY(): This function returns the day of the month. The
day is given as an integer ranging from 1 to 31.
=DAY(“5-DEC”) returns 5.
=DAY("2017-3-30") returns 30.
MONTH(): This function returns the month. The month
is given as an integer ranging from 1 to 12.
=MONTH(“5-DEC”) returns 12.
=MONTH(“5-DEC-2010”) returns 12.
WEEKDAY(): This function returns the day of the week.
The day is given as an integer ranging from 1(Sunday)
to 7(Saturday).
=WEEKDAY(“2010-12-26”) returns 1.
NOW(): This function returns the current date and
time.
TODAY(): This function returns the current date.
LOGICAL FUNCTIONS:
These functions are used to test the conditions. They
return the logical values as TRUE or FALSE.
=AND(logical1, logical2,…..): This function returns
TRUE if all its arguments are TRUE, returns FALSE if one
or more arguments are FALSE. Logical1, logical2,…..
Are 1 to 30 conditions you want to test that can be
either TRUE or FALSE.
=AND(3<6, 3=3) returns TRUE.
=AND(3>6, 3=3) returns FALSE.
=OR(logical1, logical2,…..): This function returns FALSE
if all its arguments are FALSE, returns TRUE if one or
more arguments are TRUE. Logical1, logical2,….. Are 1
to 30 conditions you want to test that can be either
TRUE or FALSE.
=OR(3<6, 3=3) returns TRUE.
=OR(3>6, 3=6) returns FALSE.
=NOT(logical): This function reverses the value of its
argument.
=NOT(3>6) returns TRUE.
=NOT(3<6) returns FALSE.
=IF(logical_test, value_if_true, value_if_false): This
function returns one value if logical_test evaluates to
TRUE and another value if it evaluates to FALSE .
logical_test is any value or expression that can be
evaluated to TRUE or FALSE, value_if_true is the value
that is returned if logical_test is TRUE, value_if_false is
the value that is returned if logical_test is FALSE.
IF(5>6, 10, 20) returns 20.
WEB DESIGNING
A computer network is an inter-connection of two or
more computers for sharing resources.
INTERNET: A network of networks of computers that
links many different types of computers all over the
world.
INTERNET SERVICES:
The internet services are

❖ Electronic mail

❖ Voice mail

❖ Telnet or remote login

❖ Chat

❖ Newsgroup

❖ File transfer protocol

❖ Search engines

❖ E-Commerce

1) ELECTRONIC MAIL(EMAIL)
It is the transmission of messages over a
communication network.
ADVANTAGES OF ELECTRONIC MAIL
1)Messages can be sent at whatever time of day .
2)Messages will be in the recipient’s mailbox within
minutes.
3)No need to speak to the recipient person.
4)Delivery of messages can be confirmed.
5)Copies can be sent automatically to everyone.
6)Mails are saved in the inbox. These can be viewed
later.
7) Mails can be used as an advertising tool.
8) It reduces the volume of paper that is to be
processed.
9) It is the cheapest and best communication service.
10) Mails can be accessed globally and any time.
DRAWBACKS OF ELECTRONIC MAIL
1)Recipient must also be electronic mail users.
2)Until a mailbox is checked, there is no way of
knowing that a message has arrived.
3)There is occasional use of junk mail.
4)Viruses are transmitted through email and have
the potential to harm the computer systems.
5)Emails can be hacked.
2) VOICE MAIL: Voice-mail or voice message is a
computer based system that allows users to exchange
personal voice messages.
3) TELNET OR REMOTE LOGIN: Telnet permits your
computer to log onto another computer at some other
location and use it as if you were there.
4) CHAT: It is exchange of text between the computers.
Conversion is fast and interactive.
5) NEWSGROUP:Newsgroups are discussion groups on
internet. A user can send a message to the newsgroup.
Other users can read this message from this site and
reply.
6) FILE TRANSFER PROTOCOL: FTP is used to transfer
files on internet easily and quickly.
7) SEARCH ENGINES: These are used to search the
desired information based on text, domain name etc. It
displays the related site names which are matching
with the text or domain name. Example :- google,
gopher etc.
8) E-COMMERCE: Trading of goods or services through
internet is called as E-commerce.
OR
Electronic Commerce is the practice of conducting
business transactions online.
SOME TERMS RELATED TO WEB:
World Wide Web(WWW): It is a system of interlinked,
hypertext documents that runs over the internet.
Web page: It is a resource of information. It may
contain text, pictures, audio or video data.
Web Site: It is a collection of web pages.
Web browser: It is a software application that enables
a user to display and interact with the information
located on a web page or a web site. Some of the web
browsers are Internet Explorer, Mozilla Firefox, Google
Chrome.
HyperText Markup Language
HTML is the markup language for the creation of web
pages.
Hyper Text Transfer Protocol(HTTP)
It is a set of standards that allow users of the world
wide web to exchange information found on web
pages.
Transmission Control Protocol/Internet Protocol
TCP/IP provides the rules for communicating over the
internet.
Uniform Resource LocatorIt is also known as web
address .It is a specific character string that constitutes
a reference to a resource.
Example: ”http
://www.example.org/college/main.html”.
Domain name
A name that identifies a computer or computers on
the internet. These names appear as a component of a
Web site’s URL. This type of domain is also called a
hostname.
Example.www.computer.org
Surfing
Process of searching information by hopping from one
server to another in the internet is called as surfing.
HTML: Hyper text markup language is the markup
language, which is popularly used in the World Wide
Web. Tim Berners Lee developed it in 1989. A HTML
document can include text, pictures and links to other
related information or documents.
The tools which will help us in the process of creating
a HTML document are :
1)A Text Editor
2)A Web Browser
3)A Graphics Software
4)A Web Server
HTML tags consist of a left angle bracket(<), a tag
name, and a right angle bracket(>).Tags are paired to
start and end the tag instruction.
Example :- <html> and </html>
The end tag looks like the start tag except a slash(/)
precedes the text within the brackets.
HTML is not case sensitive.<HTML> is equivalent to
<Html>.
A html document:
Every HTML document contains two sections a head
section and a body section. The head section contains
the title, and the body contains the actual text that is
made up of paragraphs, lists, and other elements.
<Html>
<Head>
<Title>_________________________</title>
</Head>
<Body>
_______________________________
_______________________________
</Body>
</Html>
EXECUTING A HTML PROGRAM:
The first step in creating a HTML document is to write
the code in a text editor. The commonly used text
editor is notepad. Notepad can be opened as
start -> programs -> accessories -> notepad
Once notepad is opened the code can be typed in it
and then the code has to be saved using the extension
.html.
To view the created html document we will have to use
a web browser such as internet explorer.
Once the internet explorer window is opened click
File -> open to open the html document that was saved
for viewing.
To make modifications in the html code, select
View -> source. This will bring the notepad for use.
After making the necessary modifications the file
should be saved. Go back to internet explorer and click
on the refresh button. The modified page will be
displayed.
Some markup tags:
HTML: This element tells your browser that the file
contains HTML coded information.
HEAD: The head element identifies the first part of
HTML coded document that contains the title.
TITLE: The title element contains your document title.
The title is displayed in the title bar at the top of the
browser window.
BODY: The second and the largest part of your HTML
document is the body, which contains the content of
your document.
Headings: HTML has six levels of headings, numbered 1
through 6, with 1 being the largest. Headings are
displayed in larger or bolder fonts than normal body
text. The first heading in each document should be
tagged <H1>.
The syntax is <Hy> text of heading </Hy>
where ‘y’ is a number between 1 and 6 specifying the
level of heading. Do not skip levels of headings in your
document.
PARAGRAPHS: You must indicate paragraphs with <P>
elements. Without <P> elements, the document
becomes one large paragraph. The </P> closing tag
may be omitted. This is because browsers understand
that when they encounter a <P> tag, it means that the
previous paragraph has ended.
Some Tags Used For Text Formatting
Big:
If a particular text matter is to be displayed in a font
slightly bigger than the regular font then the tag <BIG>
may be used.
<Big> text to be displayed </big>
Small:
If a particular text matter is to be displayed in a font
slightly smaller than the regular font then the tag
<SMALL> may be used.
<Small> text to be displayed </small>
Font:
This tag is used to specify the font style, color and size
of the character or word or text under consideration. A
number of attributes can be considered for this tag.
A) Font Face
This attribute is use to change the font style. The name
of the font has to be identified as a value enclosed in
double quotes. If the attribute is not specified then the
default font is assumed.
B) Font Size
The size attribute indicates the size with which the data
is to be displayed.
C) Font Color
This attribute allows the user to change the color of the
text being is displayed.
Bold: This tag is used to display the data in a thicker
and darker manner.
<B> text to be displayed </b>
Italics: This tag is used to display the data in italics.
<I> text to be displayed </i>
Underline: This tag is used to display the data with an
underline below it.
<U> text to be displayed </u>
Center: This tag is used to display the data in the center
of the line.
<Center> text to be displayed </center>
Marquee: The text which is included between this tag
will scroll from one end of the document to the other
as required.
<Marquee direction = “right”> text </marquee>
Background color: The background color of a page can
be changed. This attribute is one of the attributes of
the <BODY> tag.
<Body text =“blue” bgcolor = “green”>____________
</body>
Line breaks: The <BR> tag forces a line break. The next
output will be generated from a new line.
Lists:
A list is used to display a collection of items in a
particular form. HTML supports three types of lists.
They are unnumbered, numbered and definition lists. It
is also possible to use nested lists.
Unnumbered lists
To make an unnumbered, bulleted lists
1)Start with an opening list <UL> tag
2)Enter the <LI> tag followed by the individual item;
no closing tag </LI> is needed.
3)End the entire list with a closing list </ul> tag.
<UL>
<LI> red
<LI> blue
<LI> green
</UL>
Numbered lists: A numbered list is also called as
ordered list. It uses <OL> instead of <UL>. The items are
tagged using the same<li> tag.
<OL>
<LI> red
<LI> blue
<LI> green
</OL>
NESTED LISTS:
Lists can be nested.
<Ul>
<Li> C programs
<Ul>
<Li> To find the factorial
<Li> To find the Fibonacci number
</Ul>
<Li> HTML programs
<Ul>
<Li> To create a web page
<Li> To create a web site
</Ul>
</Ul>
LINKING: HTML can link text and/or an image to
another document or section of a document. A
browser highlights the identified text or image with
color and underlines to indicate that it is a hypertext
link or hyperlink or link. Html’s single hypertext-related
tag is <a>, which stands for anchor.
To include an anchor in your document :
1)Start the anchor with <a(include a space after the
A)
2) specify the document you are linking to by
entering the parameter href=“filename” followed
by a closing right angle bracket(>)
3) Enter the text that will serve as the hypertext link
in the current document.
4) Enter the ending anchor tag</a>(no space is
needed before the end anchor tag)
<A href=“file2.html”>name</A>
This make the word name the hyperlink to the
document file2.Html, which is in the same directory as
the first document.
INLINE IMAGES:
To include an inline image enter
<IMG src = imagename>
Where SRC stands for source and imagename is the
URL of the image file. If the image file is stored on the
hard disk then the complete path along with the
filename should be included. If an URL address is
included then the file will be displayed only if there is
an internet connection.
5 MARK QUESTIONS
1)Explain internet services.
2)Write the advantages of e-mail.
3)Write the disadvantages of e-mail.
4)Explain any five HTML tags.

You might also like