Free Essay

Zsdwwwww

In:

Submitted By sikh
Words 21581
Pages 87
Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

Ref Page

Chapt er 9: I nput - Out put Dev ices

Slide 1/ 58

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

Le a r n in g Obj e ct ive s
I n t h is ch a pt e r you w ill le a r n a bou t :
§ I nput / Out put ( I / O) devices § Com m only used input devices § Com m only used out put devices § Ot her concept s relat ed t o I / O devices

Ref Page 148

Chapt er 9: I nput - Out put Dev ices

Slide 2/ 58

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

I / O D e vice s
§ Provide m eans of com m unicat ion bet ween a com put er and out er w orld § Also known as peripheral devices because t hey surround t he CPU and m em ory of a com put er syst em § I nput devices are used t o ent er dat a fr om t he out side world int o prim ary st orage § Out put devices supply r esult s of processing from prim ary st orage t o user s

Ref Page 148

Chapt er 9: I nput - Out put Dev ices

Slide 3/ 58

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

Role of I / O D e vice s

Input data from external world

Input Devices

CPU and Memory

Output Devices

Results of processing in human acceptable form

Input data coded in internal form

Processed data in internal form

Ref Page 148

Chapt er 9: I nput - Out put Dev ices

Slide 4/ 58

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

Com m on ly Use d I n pu t D e vice s
§ Keyboard devices § Point - and- draw devices § Dat a scanning devices § Digit izer § Elect ronic cards based devices § Speech r ecognit ion devices § Vision based devices

Ref Page 149

Chapt er 9: I nput - Out put Dev ices

Slide 5/ 58

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

Ke yboa r d D e vice s
§ Allow dat a ent ry int o a com put er sy st em by pr essing a set of k eys ( labeled but t ons) neat ly m ount ed on a key boar d connect ed t o a com put er sy st em § 101- keys QWERTY keyboard is m ost popular

Ref Page 149

Chapt er 9: I nput - Out put Dev ices

Slide 6/ 58

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

Th e La you t of Ke y s on a QW ERTY Ke yboa r d

Esc

F1

F2

F3

F4

F5

F6

F7

F8

F9

F10

F11

F12

Print Screen Scroll Screen Pause

Num Lock

Caps Lock

Scroll Lock

~ `

! 1

@ 2 Q

#

3

$ 4

% 5 T

^ 6

& 7 Y U

* 8 I

( 9 O

) 0 P

_ { [

+ = } ]

← Backspace

Insert

Home

Page Up

Num Lock

/ 8 ↑

*

-

Tab

← →

W

E

R

| \

Delete

End

Page Down

7
Home

9
Pg Up

+ Caps Lock A S D F G H J K L : ; > . “ ‘ ? / ← Enter 4 ← 5 6 →

Shift

Z

X

C

V

B

N

M

< ,

? Shift / ←



1
End

2 ↓

3
Pg Dn Enter

Ctrl

Alt

Alt

Ctrl





0
Ins

.
Del

Ref Page 149

Chapt er 9: I nput - Out put Dev ices

Slide 7/ 58

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

Poin t - a n d- D r a w D e vice s
§ Used t o rapidly point t o and select a graphic icon or m enu it em from m ult iple opt ions displayed on t he Graphical User I nt er face ( GUI ) of a screen § Used t o cr eat e graphic elem ent s on t he screen such as lines, curv es, and freehand shapes § Som e com m only used point - and- draw devices are m ouse, t rack ball, j oy st ick, light pen, and t ouch scr een

Ref Page 149

Chapt er 9: I nput - Out put Dev ices

Slide 8/ 58

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

M ou se

Com m only used in personal com put ers and w or kst at ions

Ref Page 150

Chapt er 9: I nput - Out put Dev ices

Slide 9/ 58

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

Tr a ck ba ll

Click but t ons

Ball t o be rolled wit h fingers

Com m only used in lapt op ( not ebook) com put ers

Ref Page 151

Chapt er 9: I nput - Out put Dev ices

Slide 10/ 58

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

Joyst ick
Click but t on St ick Light indicat or Ball Socket

Com m only used for video gam es, flight sim ulat ors, t raining sim ulat ors, and for cont rolling indust rial robot s

Ref Page 152

Chapt er 9: I nput - Out put Dev ices

Slide 11/ 58

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

Ele ct r on ic Pe n
§ Pen- based point - and- draw device § Used t o direct ly point wit h it on t he screen t o select m enu it em s or icons or direct ly draw graphics on t he screen § Can writ e wit h it on a special pad for direct input of writ t en inform at ion t o a syst em § Pressure on t ip of a side but t on is used t o cause sam e act ion as right - but t on- click of a m ouse

Ref Page 152

Chapt er 9: I nput - Out put Dev ices

Slide 12/ 58

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

Tou ch Scr e e n
§ Most sim ple, int uit ive, and easiest t o learn of all input devices § Enables users t o choose from available opt ions by sim ply t ouching wit h t heir finger t he desired icon or m enu it em displayed on t he screen § Most prefer red hum an- com put er int erface used in inform at ion kiosks ( unat t ended int eract ive inform at ion syst em s such as aut om at ic t eller m achine or ATM)

Ref Page 152

Chapt er 9: I nput - Out put Dev ices

Slide 13/ 58

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

D a t a Sca n n in g D e vice s
§ I nput devices t hat enable direct dat a ent ry int o a com put er syst em fr om source docum ent s § Elim inat e t he need t o k ey in t ext dat a int o t he com put er § Due t o r educed hum an effort in dat a ent ry, t hey im prov e dat a accuracy and also increase t he t im eliness of t he inform at ion processed § Dem and high qualit y of input docum ent s § Som e dat a scanning devices are also capable of recognizing m arks or charact ers § Form design and ink specificat ion usually becom es m or e crit ical for accuracy

Ref Page 153

Chapt er 9: I nput - Out put Dev ices

Slide 14/ 58

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

I m a ge Sca n n e r
§ I nput device t hat t ranslat es paper docum ent s int o an elect ronic form at for st orage in a com put er § Elect ronic form at of a scanned im age is it s bit m ap repr esent at ion § St ored im age can be alt ered or m anipulat ed wit h an im age- processing soft w are

Ref Page 153

Chapt er 9: I nput - Out put Dev ices

Slide 15/ 58

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

Tw o Com m on Type s of I m a ge Sca n n e r s

A flat - bed scanner

A hand- held scanner

Ref Page 153

Chapt er 9: I nput - Out put Dev ices

Slide 16/ 58

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

Opt ica l Ch a r a ct e r Re cogn it ion ( OCR) D e v ice
§ Scanner equipped wit h a charact er recognit ion soft war e ( called OCR soft war e) t hat convert s t he bit m ap im ages of charact ers t o equivalent ASCI I codes § Enables word pr ocessing of input t ext and also requires less st orage for st oring t he docum ent as t ext rat her t han an im age § OCR soft war e is ext r em ely com plex because it is difficult t o m ak e a com put er r ecognize an unlim it ed num ber of t ypefaces and font s § Two st andard OCR font s are OCR- A ( Am erican st andard) and OCR- B ( European st andard)

Ref Page 154

Chapt er 9: I nput - Out put Dev ices

Slide 17/ 58

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

Opt ica l M a r k Re a de r ( OM R)
§ Scanner capable of recognizing a pre- specified t ype of m ark by pencil or pen § Very useful for grading t est s wit h obj ect ive t ype quest ions, or for any input dat a t hat is of a choice or select ion nat ure § Technique used for recognit ion of m ar ks involves focusing a light on t he page being scanned and det ect ing t he reflect ed light pat t ern fr om t he m arks

Ref Page 155

Chapt er 9: I nput - Out put Dev ices

Slide 18/ 58

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

Sa m ple Use of OM R
For each quest ion, four opt ions are given out of which only one is correct . Choose t he correct opt ion and m ark your choice against t he corresponding quest ion num ber in t he given answer sheet by darkening t he corresponding circle wit h a lead pencil. 1. The binary equivalent of decim al 4 is: a) 101 b) 111 c) 001 d) 100 2. The full form of CPU is: a) Cursor Posit ioning Unit b) Cent ral Power Unit c) Cent ral Processing Unit d) None of t he abov e 3. Which is t he largest unit of st orage am ong t he following: a) Teraby t e b) Kiloby t e c) Megaby t e d) Gigaby t e
Indicates direction in which the sheet should be fed to the OMR 1. a 2. a 3. a b c d b c d b c d

( b) Pre- print ed answer sheet

( a) Quest ion sheet A sam ple use of OMR for grading t est s wit h obj ect ive type quest ions

Ref Page 155

Chapt er 9: I nput - Out put Dev ices

Slide 19/ 58

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

Ba r - code Re a de r
§ Scanner used for reading ( decoding) bar- coded dat a § Bar codes represent alphanum eric dat a by a com binat ion of adj acent vert ical lines ( bars) by varying t heir widt h and t he spacing bet ween t hem § Scanner uses laser- beam t o st r ok e across pat t ern of bar code. Differ ent pat t erns of bars reflect t he beam in different ways sensed by a light - sensit ive det ect or § Universal Product Code ( UPC) is t he m ost widely known bar coding syst em

Ref Page 155

Chapt er 9: I nput - Out put Dev ices

Slide 20/ 58

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

An Ex a m ple of UPC Ba r Code

Product category charact er 0 – grocery product s 3 – drugs and healt h relat ed product s, et c.

0

21000

67520

Manufact urer/ supplier ident ificat ion num ber

Specific product code num ber

Ref Page 156

Chapt er 9: I nput - Out put Dev ices

Slide 21/ 58

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

M a gn e t ic- I n k Ch a r a ct e r Re cogn it ion ( M I CR)
§ MI CR is used by banking indust ry for fast er processing of large v olum e of cheques § Bank’s ident ificat ion code ( nam e, branch, et c.) , account num ber and cheque num ber are pre- print ed ( encoded) using charact ers from a special charact er set on all cheques § Special ink is used t hat cont ains m agnet izable part icles of iron oxide § MI CR reader- sort er reads dat a on cheques and sort s t hem for dist ribut ion t o ot her banks or for furt her processing

Ref Page 156

Chapt er 9: I nput - Out put Dev ices

Slide 22/ 58

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

M I CR Cha r a ct e r Se t ( E1 3 B Font )

§ I t consist s of num erals 0 t o 9 and four special charact ers § MI CR is not adopt ed by ot her indust ries because it support s only 14 sym bols

Ref Page 157

Chapt er 9: I nput - Out put Dev ices

Slide 23/ 58

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

D igit iz e r
§ I nput device used for convert ing ( digit izing) pict ures, m aps and drawings int o digit al form for st orage in com put er s § Com m only used in t he area of Com put er Aided Design ( CAD) by archit ect s and engineers t o design cars, buildings m edical devices, robot s, m echanical part s, et c. § Used in t he area of Geographical I nform at ion Syst em ( GI S) for digit izing m aps available in paper for m

Ref Page 157

Chapt er 9: I nput - Out put Dev ices

Slide 24/ 58

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

A D igit ize r
Digit izing t ablet St ylus in t he form of cross- hair cursor Table t op

Ref Page 158

Chapt er 9: I nput - Out put Dev ices

Slide 25/ 58

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

Ele ct r on ic- ca r d Re a de r
§ Elect ronic cards ar e sm all plast ic cards having encoded dat a appropriat e for t he applicat ion for which t hey are used § Elect ronic- card r eader ( norm ally connect ed t o a com put er) is used t o r ead dat a encoded on an elect ronic card and t ransfer it t o t he com put er for furt her pr ocessing § Used t oget her as a m eans of direct dat a ent ry int o a com put er sy st em § Used by banks for use in aut om at ic t eller m achines ( ATMs) and by organizat ions for cont rolling access of em ployees t o physically secured ar eas

Ref Page 158

Chapt er 9: I nput - Out put Dev ices

Slide 26/ 58

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

Spe e ch Re cogn it ion D e vice s
§ I nput device t hat allows a per son t o input dat a t o a com put er sy st em by speaking t o it § Today’s speech r ecognit ion syst em s are lim it ed t o accept ing few words wit hin a relat ively sm all dom ain and can be used t o ent er only lim it ed kinds and quant it ies of dat a

Ref Page 158

Chapt er 9: I nput - Out put Dev ices

Slide 27/ 58

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

Type s of Spe e ch Re cogn it ion Syst e m s
( Cont inued from previous slide..)

§ Single word r ecognit ion syst em s can r ecognize only a single spoken w ords, such as YES, NO, MOVE, STOP, at a t im e. Speak er- independent syst em s are m ost ly of t his t ype § Cont inuous speech recognit ion syst em s can r ecognize spok en sent ences, such as MOVE TO THE NEXT BLOCK. Such syst em s are norm ally speakerdependent

Ref Page 158

Chapt er 9: I nput - Out put Dev ices

Slide 28/ 58

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

Use s of Spe e ch Re cogn it ion Syst e m s
§ For input t ing dat a t o a com put er syst em by a person in sit uat ions where his/ her hands are busy , or his/ her eyes m ust be fixed on a m easuring inst rum ent or som e ot her obj ect § For dat a input by dict at ion of long t ext or passage for lat er edit ing and review § For aut hent icat ion of a user by a com put er syst em based on voice input § For lim it ed use of com put ers by individuals wit h physical disabilit ies

Ref Page 159

Chapt er 9: I nput - Out put Dev ices

Slide 29/ 58

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

Vision - I n pu t Syst e m s V ision
§ Allow com put er t o accept input j ust by seeing an obj ect . § I nput dat a is norm ally an obj ect ’s shape and feat ures in t he form of an im age § Mainly used t oday in fact ories for designing indust rial robot s t hat are used for qualit y- cont rol and assem bly processes

Ref Page 159

Chapt er 9: I nput - Out put Dev ices

Slide 30/ 58

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

Com m on ly Use d Ou t pu t D e vice s
§ Monit ors § Print ers § Plot t ers § Screen im age proj ect or § Voice response syst em s

Ref Page 160

Chapt er 9: I nput - Out put Dev ices

Slide 31/ 58

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

Type s of Ou t pu t
§ Soft - copy ou t pu t § Not produced on a paper or som e m at erial t hat can be t ouched and carried for being shown t o ot hers § Tem porary in nat ure and vanish aft er use § Exam ples are out put display ed on a t erm inal screen or spoken out by a voice response syst em § H a r d- copy ou t pu t § Produced on a paper or som e m at erial t hat can be t ouched and carried for being shown t o ot hers § Perm anent in nat ure and can be kept in paper files or can be looked at a lat er t im e when t he person is not using t he com put er § Exam ples are out put produced by print ers or plot t ers on paper

Ref Page 160

Chapt er 9: I nput - Out put Dev ices

Slide 32/ 58

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

M on it or s
§ Monit ors are t he m ost popular out put devices used for producing soft - copy out put § Display t he out put on a t elevision like scr een § Monit or associat ed wit h a keyboard is called a video display t erm inal ( VDT) . I t is t he m ost popular I / O device

Ref Page 160

Chapt er 9: I nput - Out put Dev ices

Slide 33/ 58

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

M on it or s

Monit or

Keyboard

A video display t erm inal consist s of a m onit or and a key boar d

Ref Page 160

Chapt er 9: I nput - Out put Dev ices

Slide 34/ 58

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

Type s of M on it or s
§ Cat hode- ray- t ube ( CRT) m onit ors look like a t elevision and are nor m ally used wit h non- port able com put er syst em s § Flat - panel m onit ors are t hinner and light er and are com m only used wit h port able com put er syst em s like not ebook com put ers. Now t hey are also used w it h nonport able deskt op com put er syst em s because t hey occupy less t able space.

Ref Page 160

Chapt er 9: I nput - Out put Dev ices

Slide 35/ 58

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

Pr in t e r s
Most com m on out put devices for producing hard- copy out put

Ref Page 160

Chapt er 9: I nput - Out put Dev ices

Slide 36/ 58

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

D ot - M a t r ix Pr in t e r s
§ Charact er print ers t hat form charact ers and all kinds of im ages as a pat t ern of dot s § Print m any special charact ers, different sizes of print and graphics such as chart s and graphs § I m pact print ers can be used for generat ing m ult iple copies by using carbon paper or it s equivalent § Slow, wit h speeds usually ranging bet ween 30 t o 600 charact ers per second § Cheap in bot h init ial cost and cost of operat ion

Ref Page 161

Chapt er 9: I nput - Out put Dev ices

Slide 37/ 58

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

For m a t ion of Ch a r a ct e r s a s a pa t t e r n of dot s

ABCDEFGHIJKLMNO PQRSTUVWXYZ 0123456789-., &/$*#%@=(+)

Ref Page 161

Chapt er 9: I nput - Out put Dev ices

Slide 38/ 58

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

A D ot M a t r ix Pr in t e r

Ref Page 161

Chapt er 9: I nput - Out put Dev ices

Slide 39/ 58

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

I n k j e t Pr in t e r s
§ Charact er print ers t hat form charact ers and all kinds of im ages by spraying sm all drops of ink on t o t he paper § Print head cont ains up t o 64 t iny nozzles t hat can be select ively heat ed up in a few m icr o seconds by an int egrat ed circuit regist er § To print a charact er, t he print er select ively heat s t he appropriat e set of nozzles as t he print head m oves horizont ally § Can print m any special charact ers, differ ent sizes of print , and graphics such as chart s and graphs

(Continued on next slide)

Ref Page 161

Chapt er 9: I nput - Out put Dev ices

Slide 40/ 58

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

I n k j e t Pr in t e r s
( Cont inued from previous slide..)

§ Non- im pact print ers. Hence, t hey cannot produce m ult iple copies of a docum ent in a single print ing § Can be bot h m onochrom e and color § Slower t han dot - m at rix print ers wit h speeds usually ranging bet ween 40 t o 300 charact ers per second § Mor e expensive t han a dot - m at rix print er

Ref Page 162

Chapt er 9: I nput - Out put Dev ices

Slide 41/ 58

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

An I n k j e t Pr in t e r s

Ref Page 162

Chapt er 9: I nput - Out put Dev ices

Slide 42/ 58

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

D r u m Pr in t e r s
§ Line print ers t hat print one line at a t im e § Have a solid cylindrical drum wit h charact ers em bossed on it s surface in t he for m of circular bands § Set of ham m ers m ount ed in front of t he drum in such a m anner t hat an inked ribbon and paper can be placed bet ween t he ham m er s and t he drum § Can only print a pre- defined set of charact ers in a predefined st yle t hat is em bossed on t he drum § I m pact print ers and usually m onochrom e § Typical speeds are in t he range of 300 t o 2000 lines per m inut e

Ref Page 162

Chapt er 9: I nput - Out put Dev ices

Slide 43/ 58

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

Pr in t in g M e ch a n ism of a D r u m Pr in t e r
Ham m ers ( one for each band) Paper Ribbon
WW W WWWWWWWWWWW V V V V V V V V V V VV V V U U U U U U U U U U U U U U T T T T T T T T T T T T T T S S S S S S S S S S S S S S R R R R R R R R R R R R R R QQ Q Q Q Q Q Q Q Q Q Q Q Q P P P P P P P P P P P P P P O O O O O O O O O O O O O O N N N N N N N N N N NN N N

Solid cylindrical drum wit h em bossed charact ers

Tot al num ber of bands is equal t o t he m axim um num ber of charact ers ( print posit ions) on a line

Ref Page 163

Chapt er 9: I nput - Out put Dev ices

Slide 44/ 58

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

Ch a in / Ba n d Pr in t e r s
§ Line print ers t hat print one line at a t im e § Consist of a m et allic chain/ band on which all charact ers of t he charact er set support ed by t he print er are em bossed § Also have a set of ham m ers m ount ed in front of t he chain/ band in such a m anner t hat an inked ribbon and paper can be placed bet ween t he ham m ers and t he chain/ band

Ref Page 163

Chapt er 9: I nput - Out put Dev ices

Slide 45/ 58

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

Ch a in / Ba n d Pr in t e r s
§ Can only print pre- defined set s of charact ers t hat are em bossed on t he chain/ band used wit h t he print er § Cannot print any shape of charact ers, different sizes of print , and graphics such as chart s and graphs § Are im pact print ers and can be used for generat ing m ult iple copies by using carbon paper or it s equivalent § Are usually m onochrom e § Typical speeds are in t he range of 400 t o 3000 lines per m inut e

Ref Page 164

Chapt er 9: I nput - Out put Dev ices

Slide 46/ 58

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

La se r Pr in t e r s
§ Page print ers t hat print one page at a t im e § Consist of a laser beam source, a m ult i- sided m irror, a phot oconduct ive drum and t oner ( t iny part icles of opposit ely charged ink) § To print a page, t he laser beam is focused on t he elect ro st at ically charged drum by t he spinning m ult i- sided m irror § Toner st icks t o t he drum in t he places t he laser beam has charged t he drum ’s surface. § Toner is t hen perm anent ly fused on t he paper wit h heat and pressure t o generat e t he print er out put § Laser print ers produce very high qualit y out put having resolut ions in t he range of 600 t o 1200 dpi

(Continued on next slide)

Ref Page 164

Chapt er 9: I nput - Out put Dev ices

Slide 47/ 58

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

La se r Pr in t e r s
( Cont inued from previous slide..)

§ Can print m any special charact ers, differ ent sizes of print , and graphics such as chart s and graphs § Are non- im pact print ers § Most laser print ers are m onochrom e, but color laser print ers are also available § Low speed laser print ers can print 4 t o 12 pages per m inut e. Very high- speed laser print ers can print 500 t o 1000 pages per m inut e § Mor e expensive t han ot her print ers

Ref Page 165

Chapt er 9: I nput - Out put Dev ices

Slide 48/ 58

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

A La se r Pr in t e r s

Ref Page 164

Chapt er 9: I nput - Out put Dev ices

Slide 49/ 58

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

Plot t e r s
§ Plot t ers are an ideal out put device for archit ect s, engineers, cit y planners, and ot hers who need t o rout inely generat e high- precision, hard- copy graphic out put of widely varying sizes § Two com m only used t ypes of plot t ers are: – Drum plot t er, in which t he paper on which t he design has t o be m ade is placed ov er a drum t hat can rot at e in bot h clockwise and ant i- clockwise direct ions – Flat bed plot t er, in which t he paper on which t he design has t o be m ade is spr ead and fixed over a rect angular flat bed t able

Ref Page 165

Chapt er 9: I nput - Out put Dev ices

Slide 50/ 58

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

A D r u m Plot t e r

Paper Design drawn on t he paper

Ref Page 166

Chapt er 9: I nput - Out put Dev ices

Slide 51/ 58

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

A Fla t be d Plot t e r

Design drawn on t he paper Paper

Ref Page 166

Chapt er 9: I nput - Out put Dev ices

Slide 52/ 58

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

Scr e e n I m a ge Pr oj e ct or
§ An out put device t hat can be direct ly plugged t o a com put er sy st em for pr oj ect ing inform at ion from a com put er on t o a large screen § Useful for m aking present at ions t o a group of people wit h direct use of a com put er § Full- fledged m ult im edia present at ion wit h audio, video, im age, and anim at ion can be prepar ed and m ade using t his facilit y

Ref Page 166

Chapt er 9: I nput - Out put Dev ices

Slide 53/ 58

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

Voice Re spon se Syst e m s V oice
§ Voice response syst em enables a com put er t o t alk t o a user § Has an audio- response device t hat produces audio out put § Such syst em s are of t w o t ypes: § Voice repr oduct ion syst em s § Speech synt hesizers

(Continued on next slide)

Ref Page 167

Chapt er 9: I nput - Out put Dev ices

Slide 54/ 58

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

Voice Re pr odu ct ion Syst e m s V oice
( Cont inued from previous slide..)

§ Produce audio out put by select ing an appropriat e audio out put from a set of pr e- r ecorded audio responses § Applicat ions include audio help for guiding how t o operat e a sy st em , aut om at ic answering m achines, video gam es, et c.

Ref Page 167

Chapt er 9: I nput - Out put Dev ices

Slide 55/ 58

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

Spe e ch Syn t h e siz e r s
§ Convert s t ext inform at ion int o spok en sent ences § Used for applicat ions such as: § Reading out t ext inform at ion t o blind persons § Allowing t hose persons who cannot speak t o com m unicat e effect ively § Translat ing an ent ered t ext int o spok en words in a select ed language

Ref Page 168

Chapt er 9: I nput - Out put Dev ices

Slide 56/ 58

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

Ke y W or ds/ Ph r a se s
§ § § § § § § § § § § § § § § § § Bard code reader Cat hode Ray Tube ( CRT) Chain/ Band pr int er Dat a scanning dev ice Digit izer Digit izing t ablet Dot - Mat r ix pr int er Dr um plot t er Dr um pr int er Elect r onic car d reader Elect r onic Pen Flat bed plot t er Flat bed Scanner Graphical User I nt er face Hand- held scanner Hard- copy out put I m age Scanner § § § § § § § § § § § § § § § § § § I nfor m at ion Kiosk I nkj et pr int er I nput / Out put dev ice Joy st ick Keyboard dev ice Laser pr int er Magnet ic- I nk Charact er Recognit ion ( MI CR) Monit or Mouse Opt ical Charact er Recognit ion ( OCR) Opt ical Mark Reader ( OMR) Per ipheral dev ice Phonem es Plot t er Point - and- draw dev ice Pr int er QWERTY key board Screen I m age Proj ect or

(Continued on next slide)

Ref Page 168

Chapt er 9: I nput - Out put Dev ices

Slide 57/ 58

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

Ke y W or ds/ Ph r a se s
( Cont inued from previous slide..)

§ § § § § § § § § § §

Soft - copy out put Speech synt hesizer St ylus Touch Screen Trackball Universal Product Code ( UPC) Video Display Term inal ( VDT) Vision- input syst em Voice recognit ion device Voice reproduct ion syst em Voice response system

Ref Page 168

Chapt er 9: I nput - Out put Dev ices

Slide 58/ 58

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

Ref Page

Chapt er 10: Com put er Soft ware

Slide 1/ 17

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

Le a r n in g Obj e ct ive s
I n t h is ch a pt e r you w ill le a r n a bou t :
§ Ter m “ Soft ware” and it s relat ionship wit h “ Hardware” § Various t ypes of soft war e and t heir exam ples § Relat ionship am ong hardware, sy st em soft ware, applicat ion soft ware, and users of a com put er syst em § Different ways of acquiring soft war e § Various st eps involved in soft war e developm ent § Firm ware § Middleware

Ref Page 172

Chapt er 10: Com put er Soft ware

Slide 2/ 17

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

Soft w a r e
§ H a r dw a r e r efers t o t he physical devices of a com put er sy st em . § Soft w a r e r efers t o a collect ion of program s § Pr ogr a m is a sequence of inst ruct ions writ t en in a language t hat can be underst ood by a com put er § Soft w a r e pa ck a ge is a group of pr ogram s t hat solve a specific problem or perform a specific t ype of j ob

Ref Page 172

Chapt er 10: Com put er Soft ware

Slide 3/ 17

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

Re la t ion sh ip Be t w e e n H a r dw a r e a n d Soft w a r e
§ Bot h hardwar e and soft ware are necessar y for a com put er t o do useful j ob. They are com plem ent ary t o each ot her § Sam e hardwar e can be loaded wit h different soft ware t o m ak e a com put er sy st em perform differ ent t y pes of j obs § Except for upgrades, hardwar e is norm ally a onet im e expense, whereas soft war e is a cont inuing expense § Upgrades refer t o renew ing or changing com ponent s like increasing t he m ain m em or y, or hard disk capacit ies, or adding speakers, m odem s, et c.

Ref Page 173

Chapt er 10: Com put er Soft ware

Slide 4/ 17

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

Type s of Soft w a r e
Most soft war e can be divided int o t wo m aj or cat egories: § Syst e m soft w a r e ar e designed t o cont rol t he operat ion and ext end t he pr ocessing capabilit y of a com put er sy st em § Applica t ion soft w a r e are designed t o solve a specific problem or t o do a specific t ask

Ref Page 173

Chapt er 10: Com put er Soft ware

Slide 5/ 17

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

Syst e m Soft w a r e
§ Make t he operat ion of a com put er sy st em m ore effect ive and efficient § Help hardware com ponent s work t oget her and provide support for t he dev elopm ent and ex ecut ion of applicat ion soft war e § Program s included in a syst em soft war e package ar e called syst e m pr ogr a m s and pr ogram m er s w ho prepar e t hem are called syst e m pr ogr a m m e r s § Exam ples of syst em soft ware are operat ing syst em s, program m ing language t ranslat ors, ut ilit y progr am s, and com m unicat ions soft war e

Ref Page 173

Chapt er 10: Com put er Soft ware

Slide 6/ 17

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

Applica t ion Soft w a r e
§ Solve a specific problem or do a specific t ask § Program s included in an applicat ion soft ware package are called a pplica t ion pr ogr a m s and t he program m ers who pr epare t hem are called a pplica t ion pr ogr a m m e r s § Exam ples of applicat ion soft war e ar e w ord processing, invent ory m anagem ent , pr eparat ion of t ax ret urns, banking, et c.

Ref Page 174

Chapt er 10: Com put er Soft ware

Slide 7/ 17

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

Logica l Syst e m Ar ch it e ct u r e

H ARD W ARE ( Phy sical dev ices/ com ponent s of t he com put er syst em ) SYSTEM SOFTW ARE
( Soft ware t hat const it ut e t he operat ing and progr am m ing environm ent of t he com put er syst em )

APPLI CATI ON SOFTW ARE
( Soft ware t hat do a specific t ask or solve a specific problem )

USERS ( Nor m ally int er act w it h t he syst em v ia t he user int er face prov ided by t he applicat ion soft ware)

Relationship among hardware, system software, application software, and users of a computer system.

Ref Page 175

Chapt er 10: Com put er Soft ware

Slide 8/ 17

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

W a ys of Acqu ir in g Soft w a r e
§ Buying pre- writ t en soft ware § Ordering cust om ized soft ware § Dev eloping cust om ized soft war e § Downloading public- dom ain soft ware
Each of t hese ways of acquiring soft ware has it s own advant ages and lim it at ions

Ref Page 176

Chapt er 10: Com put er Soft ware

Slide 9/ 17

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

Adva n t a ge s a n d Lim it a t ion s of Bu yin g Pr e - w r it t e n Soft w a r e
§ Usually cost s less § Planned act ivit y can be st ared alm ost im m ediat ely § Oft en, operat ing efficiency and t he capabilit y t o m eet specific needs of user m ore effect ively in not as good for pre- writ t en soft war e packages as for in- house dev eloped soft war e packages

Ref Page 176

Chapt er 10: Com put er Soft ware

Slide 10/ 17

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

Adva n t a ge s & Lim it a t ion s of Or de r in g Cu st om ize d Soft w a r e
§ User need not maintain its own software development team, which is an expensive affair § User needs to always depend on the vendor for carrying out the changes and the vendor may separately charge for every request for change

Ref Page 177

Chapt er 10: Com put er Soft ware

Slide 11/ 17

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

Adva n t a ge s & Lim it a t ion s of D e ve lopin g Cu st om ize d Soft w a r e
§ Easier t o carr y out changes in t he soft war e, if it is dev eloped in- house § Dev eloping soft ware in- house m eans a m aj or com m it m ent of t im e, m oney, and resources § I n- house soft ware dev elopm ent t eam needs t o be m aint ained and m anaged

Ref Page 177

Chapt er 10: Com put er Soft ware

Slide 12/ 17

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

Adva n t a ge & Lim it a t ion s of D ow n loa din g Pu blic- dom a in Soft w a r e
§ Available for free or as shareware, and are usually accom panied wit h source code § Usually com m unit y- support ed as aut hor does not support users direct ly § Can be downloaded and used im m ediat ely § They m ay not be properly t est ed before release § Open Source Soft ware ( OSS) are becom ing popular due t o: § Allows any user t o download, view, m odify, and redist ribut e § User can fix bugs or change soft ware t o suit needs § Copyright is prot ect ed for bot h original and subsequent aut hors § Not all open source soft ware are free and vise- verse

Ref Page 178

Chapt er 10: Com put er Soft ware

Slide 13/ 17

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

Soft w a r e D e ve lopm e n t St e ps
Dev eloping a soft ware and put t ing it t o use is a com plex process and involves following st eps:
§ § § § § Analyzing t he problem at hand and planning t he program ( s) t o solve t he problem Coding t he program ( s) Test ing, debugging, and docum ent ing t he program ( s) I m plem ent ing t he program ( s) Evaluat ing and m aint aining t he program ( s)

Ref Page 178

Chapt er 10: Com put er Soft ware

Slide 14/ 17

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

Fir m w a r e
§ Firm ware is soft war e subst it ut ed for hardwar e and st ored in read- only m em or y § Firm ware t echnology has enabled product ion of various t ypes of sm art m achines having m icropr ocessor chips wit h em bedded soft war e

Ref Page 179

Chapt er 10: Com put er Soft ware

Slide 15/ 17

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

M iddle w a r e
§ Basic idea is t o have a separat e soft ware layer t o: § Act as “ glue” bet ween client and server part s of applicat ion § Provide program m ing abst ract ion § Mask het er ogeneit y of underlying net work , hardware, and OS § Encourages t hree- t ier soft war e archit ect ure against t wot ier popularized by Ser v er- Client archit ect ure

Ref Page 179

Chapt er 10: Com put er Soft ware

Slide 16/ 17

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

Ke y W or ds/ Ph r a se s
§ § § § § § § § § § § § § § § Applicat ion program m ers Applicat ion program s Applicat ion soft ware Com put er program Cust om ized soft ware Dat abase Educat ion software End- t o- end solut ion Ent ert ainm ent software Firm ware Graphics software Hardware Middleware Open Source Software Personal assist ance soft ware § § § § § § § § § § § § § Pre- writ t en soft ware Public- dom ain soft ware Shareware Soft ware Soft ware package Spreadsheet Syst em program m ers Syst em program s Syst em soft ware Turnkey solut ion User- support ed soft ware Ut ilit ies Word- processing

Ref Page 181

Chapt er 10: Com put er Soft ware

Slide 17/ 17

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

Ref Page

Chapt er 11: Planning t he Com put er Program

Slide 1/ 44

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

Le a r n in g Obj e ct ive s
I n t h is ch a pt e r you w ill le a r n a bou t :
§ Program s m ust be planned before t hey are w rit t en § Algorit hm § Flowchart § Pseudocode § Plan t he logic of a com put er pr ogram § Com m only used t ools for pr ogram planning and t heir use

Ref Page 183

Chapt er 11: Planning t he Com put er Program

Slide 2/ 44

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

Pu r pose of Pr ogr a m Pla n n in g
§ To w rit e a corr ect pr ogr am , a pr ogram m er m ust writ e each and ev er y inst ruct ion in t he cor rect sequence § Logic ( inst ruct ion sequence) of a pr ogram can be v er y com plex § Hence, pr ogram s m ust be planned befor e t hey are writ t en t o ensure pr ogram inst ruct ions are: § Appropriat e for t he problem § I n t he corr ect sequence

Ref Page 183

Chapt er 11: Planning t he Com put er Program

Slide 3/ 44

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

Algor it h m
§ Refer s t o t he logic of a program and a st ep- by- st ep descript ion of how t o ar rive at t he solut ion of a given problem I n order t o qualify as an algorit hm , a sequence of inst ruct ions m ust have following charact erist ics:
§ Each and every inst ruct ion should be precise and unam biguous § Each inst ruct ion should be such t hat it can be perform ed in a finit e t im e § One or m ore inst ruct ions should not be repeat ed infinit ely. This ensures t hat t he algorit hm will ult im at ely t erm inat e § Aft er perform ing t he inst ruct ions, t hat is aft er t he algorit hm t erm inat es, t he desired result s m ust be obt ained

§

Ref Page 184

Chapt er 11: Planning t he Com put er Program

Slide 4/ 44

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

Sa m ple Algor it h m ( Ex a m ple 1 )
Ther e ar e 50 st udent s in a class who appear ed in t heir final exam inat ion. Their m ark sheet s hav e been given t o you. The division colum n of t he m ark sheet cont ains t he division ( FI RST, SECOND, THI RD or FAI L) obt ained by t he st udent . Writ e an algorit hm t o calculat e and print t he t ot al num ber of st udent s who passed in FI RST division.

Ref Page 184

Chapt er 11: Planning t he Com put er Program

Slide 5/ 44

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

Sa m ple Algor it h m ( Ex a m ple 1 )
St ep 1: I nit ialize Tot al_First_Division and Tot al_Marksheet s_Checked t o zero. St ep 2: Take t he m ark sheet of t he next st udent . St ep 3: Check t he division colum n of t he m ark sheet to see if it is FI RST, if no, go t o Step 5. St ep 4: Add 1 t o Tot al_First_Division. St ep 5: Add 1 t o Tot al_Marksheet s_Checked. St ep 6: I s Tot al_Marksheet s_Checked = 50, if no, go t o St ep 2. St ep 7: Print Tot al_First_Division. St ep 8: Stop.
( cont d…)

Ref Page 184

Chapt er 11: Planning t he Com put er Program

Slide 6/ 44

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

Sa m ple Algor it h m ( Ex a m ple 2 )
There are 100 em ployees in an organizat ion. The organizat ion want s t o dist ribut e annual bonus t o t he em ployees based on t heir perform ance. The perform ance of t he em ployees is recorded in t heir annual appraisal form s. Every em ployee’s appraisal form cont ains his/ her basic salary and t he grade for his/ her perform ance during t he year. The grade is of t hree cat egories – ‘A’ for out st anding perform ance, ‘B’ for good perform ance, and ‘C’ for average perform ance. I t has been decided t hat t he bonus of an em ployee will be 100% of t he basic salary for out st anding perform ance, 70% of t he basic salary for good perform ance, 40% of t he basic salary for average perform ance, and zero for all ot her cases. Writ e an algorit hm t o calculat e and print t he t ot al bonus am ount t o be dist ribut ed by t he organizat ion.

Ref Page 185

Chapt er 11: Planning t he Com put er Program

Slide 7/ 44

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

Sa m ple Algor it h m ( Ex a m ple 2 )
St ep 1: St ep 2: St ep 3: St ep 4: St ep 5: St ep 6: St ep 7: St ep 8: St ep 9: I nit ialize Tot al_Bonus and Tot al_Em ployees_Checked t o zero. I nit ialize Bonus and Basic_Salary t o zero. Take t he appraisal form of t he nex t em ployee. Read t he em ployee’s Basic_Salary and Grade. I f Gr ade = A, t hen Bonus = Basic_Salary. Go t o St ep 8. I f Gr ade = B, t hen Bonus = Basic_Salary x 0.7. Go t o St ep 8. I f Gr ade = C, t hen Bonus = Basic_Salary x 0.4. Add Bonus t o Tot al_Bonus. Add 1 t o Tot al_Em ployees_Check ed.

( cont d…)

St ep 10: I f Tot al_Em ployees_Check ed < 100, t hen go t o St ep 2. St ep 11: Print Tot al_Bonus. St ep 12: St op.

Ref Page 185

Chapt er 11: Planning t he Com put er Program

Slide 8/ 44

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

Re pr e se n t a t ion of Algor it h m s
§ As program s § As flowchart s § As pseudocodes When an algorit hm is represent ed in t he form of a program m ing language, it becom es a pr ogram Thus, any pr ogram is an algorit hm , alt hough t he rev er se is not t rue

Ref Page 185

Chapt er 11: Planning t he Com put er Program

Slide 9/ 44

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

Flowchart
§ Flowchart is a pict orial represent at ion of an algorit hm § Uses sym bols ( box es of different shapes) t hat have st andardized m eanings t o denot e different t ypes of inst ruct ions § Act ual inst ruct ions are writ t en wit hin t he boxes § Box es are connect ed by solid lines having arrow m ar ks t o indicat e t he exact sequence in which t he inst ruct ions are t o be ex ecut ed § Process of drawing a flowchart for an algorit hm is called flowchart ing

Ref Page 186

Chapt er 11: Planning t he Com put er Program

Slide 10/ 44

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

Ba sic Flow ch a r t Sym bols

Ter m inal

I nput / Out put

Processing

Decision

Flow lines

Connect ors

Ref Page 187

Chapt er 11: Planning t he Com put er Program

Slide 11/ 44

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

Examples of Decision Symbol

I s I = 10?

No

A< B

Com pare A& B

A> B

Yes

A= B

( a) A two- way branch decision.

( b) A t hree- way br anch decision.

Ref Page 188

Chapt er 11: Planning t he Com put er Program

Slide 12/ 44

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

Examples of Decision Symbol
( cont d…)

I = ?

= 0

= 1

= 2

= 3

= 4

= 5

= Ot her

( c) A m ult iple- way branch decision.

Ref Page 188

Chapt er 11: Planning t he Com put er Program

Slide 13/ 44

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

Sa m ple Flow ch a r t ( Ex a m ple 3 )
A st udent appears in an exam inat ion, which consist s of t ot al 10 subj ect s, each subj ect having m axim um m arks of 100. The r oll num ber of t he st udent , his/ her nam e, and t he m arks obt ained by him / her in various subj ect s ar e supplied as input dat a. Such a collect ion of relat ed dat a it em s, which is t reat ed as a unit is known as a record. Draw a flowchart for t he algorit hm t o calculat e t he percent age m ar ks obt ained by t he st udent in t his exam inat ion and t hen t o print it along wit h his/ her r oll num ber and nam e.

Ref Page 188

Chapt er 11: Planning t he Com put er Program

Slide 14/ 44

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

Sa m ple Flow ch a r t ( Ex a m ple 3 )
St art Read input dat a
( cont d…)

Add m arks of all subj ect s giving Tot al

Percent age = Tot al / 10

Writ e out put dat a

St op

Ref Page 189

Chapt er 11: Planning t he Com put er Program

Slide 15/ 44

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

Sa m ple Flow ch a r t ( Ex a m ple 4 )
50 st udent s of a class appear in t he exam inat ion of Exam ple 3. Draw a flowchart for t he algorit hm t o calculat e and print t he percent age m arks obt ained by each st udent along wit h his/ her roll num ber and nam e.

Ref Page 189

Chapt er 11: Planning t he Com put er Program

Slide 16/ 44

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

Sa m ple Flow ch a r t ( Ex a m ple 4 )
St art Read input dat a Flowchart for t he solut ion of Exam ple 4 wit h an infinit e ( endless) process loop.
( cont d…)

Add m arks of all subj ect s giving Tot al

Percent age = Tot al / 10

Writ e out put dat a

Ref Page 190

Chapt er 11: Planning t he Com put er Program

Slide 17/ 44

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

Sa m ple Flow ch a r t ( Ex a m ple 4 )
St art Count = 0 Read input dat a Add m arks of all subj ect s giving Tot al Percent age = Tot al/ 10 Writ e out put dat a Add 1 t o Count No I s Count = 50? Yes St op Flowchart for t he solut ion of Exam ple 4.
( cont d…)

Ref Page 191

Chapt er 11: Planning t he Com put er Program

Slide 18/ 44

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

Sa m ple Flow ch a r t ( Ex a m ple 4 )
St art Read input dat a
( cont d…)

I s Rollno = 0000000? No Add m arks of all subj ect s giving Tot al

Yes Generalized flowchart for t he solut ion of Exam ple 4 using t he concept of t r a ile r r e cor d. Here t he process loop is t erm inat ed by detect ing a special non- dat a record.

St op

Percent age = Tot al / 10

Writ e out put dat a

Ref Page 191

Chapt er 11: Planning t he Com put er Program

Slide 19/ 44

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

Sa m ple Flow ch a r t ( Ex a m ple 5 )
For t he exam inat ion of Exam ple 3, we want t o m ak e a list of only t hose st udent s who have passed ( obt ained 30% or m or e m arks) in t he exam inat ion. I n t he end, w e also want t o print out t he t ot al num ber of st udent s who have passed. Assum ing t hat t he input dat a of all t he st udent s is t erm inat ed by a t railer record, which has sent inel value of 9999999 for Rollno, draw a flowchart for t he algorit hm t o do t his.

Ref Page 192

Chapt er 11: Planning t he Com put er Program

Slide 20/ 44

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

Sa m ple Flow ch a r t ( Ex a m ple 5 )
St art Count = 0 Read input dat a I s Rollno = 9999999? No
Add m arks of all subj ect s giving Tot al
( cont d…)

Yes Writ e Count St op

Percent age = Tot al/ 10
I s Per cent age = > 30?

No

Yes Writ e out put dat a Add 1 t o Count

Ref Page 193

Chapt er 11: Planning t he Com put er Program

Slide 21/ 44

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

Sa m ple Flow ch a r t ( Ex a m ple 6 )
Suppose t he input dat a of each st udent for t he exam inat ion of Exam ple 3 also cont ains inform at ion regarding t he sex of t he candidat e in t he field nam ed Sexcode having values M ( for m ale) or F ( for fem ale) . We want t o m ake a list of only t hose fem ale st udent s w ho have passed in second division ( obt ained 45% or m ore but less t han 60% m arks) . I n t he end, we also want t o print out t he t ot al num ber of such st udent s. Assum ing t hat t he input dat a of all t he st udent s is t erm inat ed by a t railer record, which has a sent inel value of Z for Sexcode, draw a flowchart for t he algorit hm t o do t his.

Ref Page 193

Chapt er 11: Planning t he Com put er Program

Slide 22/ 44

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

Sa m ple Flow ch a r t ( Ex a m ple 6 )
St art Count = 0 1 Read input dat a

I s Sex code = Z? No 1 No I s Sex code = F?

Yes

2

Yes Add m ark s of all subj ect s giv ing Tot al Per cent age = Tot al / 10 3

Ref Page 195

Chapt er 11: Planning t he Com put er Program

Slide 23/ 44

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

Sa m ple Flow ch a r t ( Ex a m ple 4 )
( cont d…) 3

1

No

I s Per cent age = > 45? Yes

1

No

2

I s Per cent age < 60? Yes Wr it e out put dat a St op Add 1 t o Count 1 Wr it e Count

Ref Page 195

Chapt er 11: Planning t he Com put er Program

Slide 24/ 44

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

Le ve ls of Flow ch a r t
§ Flowchart t hat out lines t he m ain segm ent s of a program or t hat shows less det ails is a m a cr o flow ch a r t § Flowchart wit h m ore det ails is a m icr o f low ch a r t , or det ailed flowchart § Ther e ar e no set st andards on t he am ount of det ails t hat should be provided in a flowchart

Ref Page 196

Chapt er 11: Planning t he Com put er Program

Slide 25/ 44

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

Ex a m ple of M icr o Flow ch a r t

Part of a m acro flowchart

1 I = 1 Tot al = 0 A m icro Flowchart

Add m arks of all subj ect s giving Tot al

Tot al = Tot al + Marks ( I ) I = I + 1 No I s I > 10? Yes 1

Ref Page 196

Chapt er 11: Planning t he Com put er Program

Slide 26/ 44

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

Flow ch a r t in g Ru le s
§ First chart t he m ain line of logic, t hen incorporat e det ail § Maint ain a consist ent level of det ail for a given flowchart § Do not chart ev ery det ail of t he program . A reader who is int erest ed in great er det ails can refer t o t he pr ogram it self § Words in t he flowchart sym bols should be com m on st at em ent s and easy t o underst and

Ref Page 196

Chapt er 11: Planning t he Com put er Program

Slide 27/ 44

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

Flow ch a r t in g Ru le s
§ Be consist ent in using nam es and variables in t he flowchart § Go from left t o right and t op t o bot t om in const ruct ing flowchart s § Keep t he flowchart as sim ple as possible. Crossing of flow lines should be avoided as far as pract icable § I f a new flowchart ing page is needed, it is recom m ended t hat t he flowchart be br ok en at an input or out put point . § Properly labeled connect ors should be used t o link t he port ions of t he flowchart on different pages
( cont d…)

Ref Page 197

Chapt er 11: Planning t he Com put er Program

Slide 28/ 44

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

Adva n t a ge s of Flow ch a r t
§ Bet t er Com m unicat ion § Proper program docum ent at ion § Efficient coding § Syst em at ic debugging § Syst em at ic t est ing

Ref Page 197

Chapt er 11: Planning t he Com put er Program

Slide 29/ 44

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

Lim it a t ion s of Flow ch a r t
§ Flowchart s are ver y t im e consum ing and laborious t o draw ( especially for large com plex pr ogram s) § Redrawing a flowchart for incorporat ing changes/ m odificat ions is a t edious t ask § Ther e ar e no st andards det er m ining t he am ount of det ail t hat should be included in a flowchart

Ref Page 198

Chapt er 11: Planning t he Com put er Program

Slide 30/ 44

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

Pse u docode
§ A program planning t ool where pr ogram logic is writ t en in an ordinary nat ural language using a st ruct ure t hat resem bles com put er inst ruct ions § “ Pseudo” m eans im it at ion or false and “ Code” refers t o t he inst ruct ions writ t en in a program m ing language. Hence, pseudocode is an im it at ion of act ual com put er inst ruct ions § Because it em phasizes t he design of t he pr ogram , pseudocode is also called Pr ogr a m D e sign La n gu a ge ( PD L)

Ref Page 198

Chapt er 11: Planning t he Com put er Program

Slide 31/ 44

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

Ba sic Logic ( Con t r ol) St r u ct u r e s
Any program logic can be expr essed by using only following t hree sim ple logic st ruct ures: 1. Sequence logic, 2. Select ion logic, and 3. I t erat ion ( or looping) logic Program s st ruct ured by using only t hese t hree logic st ruct ures ar e called st r u ct u r e d pr ogr a m s, and t he t echnique of writ ing such program s is known as st r u ct u r e d pr ogr a m m in g

Ref Page 199

Chapt er 11: Planning t he Com put er Program

Slide 32/ 44

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

Se qu e n ce Logic
I t is used for perform ing inst ruct ions one aft er anot her in sequence.

Process 1 Process 1 Process 2

Process 2

( a) Flowchart

( b) Pseudocode

Ref Page 199

Chapt er 11: Planning t he Com put er Program

Slide 33/ 44

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

Se le ct ion Logic
• Also known as decision logic, it is used for m aking decisions Three 1. 2. 3. popularly used select ion logic st ruct ures are I F…THEN…ELSE I F…THEN CASE



Ref Page 200

Chapt er 11: Planning t he Com put er Program

Slide 34/ 44

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

Se le ct ion Logic

( I F…THEN…ELSE St ruct ure)

Yes

I F ( condit ion)

No

I F Condit ion THEN Process 1 Process 2

THEN Process 1

ELSE Process 2

ELSE ENDI F

( a) Flowchart

( b) Pseudocode

Ref Page 200

Chapt er 11: Planning t he Com put er Program

Slide 35/ 44

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

Se le ct ion Logic

( I F…THEN St ruct ure)

Yes

I F ( condit ion)

No I F Condit ion

THEN Process 1

THEN ENDI F

Process 1

( a) Flowchart

( b) Pseudocode

Ref Page 200

Chapt er 11: Planning t he Com put er Program

Slide 36/ 44

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

Se le ct ion Logic
Yes

( CASE St ruct ure)

Type 1 No Type 2 No

Process 1

Yes

Process 2

CASE Type Case Type 1: Case Type 2: Process 1 Process 2

Type n No

Yes

Process n Case Type n: ENDCASE Process n

( a) Flowchart ( b) Pseudocode

Ref Page 201

Chapt er 11: Planning t he Com put er Program

Slide 37/ 44

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

I t e r a t ion
§

( or Loopin g) Logic

Used t o produce loops in program logic when one or m or e inst ruct ions m ay be execut ed several t im es depending on som e condit ions Two popularly used it erat ion logic st ruct ures ar e 1. DO…WHI LE 2. REPEAT…UNTI L

§

Ref Page 201

Chapt er 11: Planning t he Com put er Program

Slide 38/ 44

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

I t e r a t ion ( or Looping) Logic
( DO…WHI LE St ruct ure)

Condit ion? True Process 1 Block

False

DO WHI LE Condit ion Process 1 Process n

Process n

ENDDO

( a) Flowchart

( b) Pseudocode

Ref Page 202

Chapt er 11: Planning t he Com put er Program

Slide 39/ 44

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

I t e r a t ion ( or Looping) Logic
( REPEAT…UNTI L St ruct ure)

Process 1

REPEAT Process n Process 1

False

Process n Condit ion? True ( a) Flowchart ( b) Pseudocode UNTI L Condit ion

Ref Page 202

Chapt er 11: Planning t he Com put er Program

Slide 40/ 44

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

Sa m ple Pse u docode ( for Ex a m ple 6 )
Set Count t o zero Read first st udent record DO WHI LE Sexcode is not equal t o Z I F Sexcode = F THEN Calculat e Percent age I F Percent age = > 45 THEN I F Percent age < 60 THEN Writ e out put dat a Add 1 t o Count ENDI F ENDI F ENDI F Read next st udent record ENDDO Writ e Count St op

Ref Page 203

Chapt er 11: Planning t he Com put er Program

Slide 41/ 44

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

Adva n t a ge s of Pse u docode
§ Convert ing a pseudocode t o a program m ing language is m uch m ore easier t han convert ing a flowchart t o a program m ing language § As com pared t o a flowchart , it is easier t o m odify t he pseudocode of a pr ogram logic when program m odificat ions are necessary § Writ ing of pseudocode involves m uch less t im e and effort t han drawing an equivalent flowchart as it has only a few rules t o follow

Ref Page 204

Chapt er 11: Planning t he Com put er Program

Slide 42/ 44

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

Lim it a t ion s of Pse u docode
§ I n case of pseudocode, a graphic repr esent at ion of program logic is not available § Ther e ar e no st andard r ules t o follow in using pseudocode § Different program m ers use t heir own st yle of w rit ing pseudocode and hence com m unicat ion problem occurs due t o lack of st andardizat ion § For a beginner, it is m or e difficult t o follow t he logic of or w rit e pseudocode, as com pared t o flowchart ing

Ref Page 204

Chapt er 11: Planning t he Com put er Program

Slide 43/ 44

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

Ke y W or ds/ Ph r a se s
§ § § § § § § § § § § § § § § Algorit hm Basic logic st ruct ures Cont rol st ruct ures Flowchart I t erat ion logic Looping logic Micro flowchart Macro flowchart Pseudocode Program Design Language ( PDL) Sequence logic Select ion logic Sent inel value St ruct ured program m ing Trailer record

Ref Page 204

Chapt er 11: Planning t he Com put er Program

Slide 44/ 44

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

Ref Page

Chapt er 12: Com put er Languages

Slide 1/ 59

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

Le a r n in g Obj e ct ive s
I n t h is ch a pt e r you w ill le a r n a bou t :
§ Com put er languages or program m ing languages § Three broad cat egories of program m ing languages – m achine, assem bly, and high- level languages § Com m only used program m ing language t ools such as assem bler, com piler, linker, and int erpret er § Concept s of obj ect - orient ed program m ing languages § Som e popular program m ing languages such as FORTRAN, COBOL, BASI C, Pascal, C, C+ + , C# , Java, RPG, LI SP and SNOBOL § Relat ed concept s such as Subprogram , Charact erist ics of a good program m ing language, and fact ors t o consider while select ing a language for coding an applicat ion

Ref Page 208

Chapt er 12: Com put er Languages

Slide 2/ 59

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

Br oa d Cla ssifica t ion of Com pu t e r La n gu a ge s
§ Machine language § Assem bly language § High- level language

Ref Page 209

Chapt er 12: Com put er Languages

Slide 3/ 59

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

M a ch in e La n gu a ge
§ Only language of a com put er underst ood by it wit hout using a t ranslat ion program § Nor m ally writ t en as st rings of binary 1s and 0s § Writ t en using decim al digit s if t he circuit ry of t he com put er being used perm it s t his

Ref Page 209

Chapt er 12: Com put er Languages

Slide 4/ 59

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

A Typica l M a ch in e La n gu a ge I n st r u ct ion For m a t
OPCODE ( operat ion code) OPERAND ( Address/ Locat ion)

§ OPCODE t ells t he com put er which operat ion t o perform from t he inst ruct ion set of t he com put er § OPERAND t ells t he addr ess of t he dat a on which t he operat ion is t o be perfor m ed

Ref Page 210

Chapt er 12: Com put er Languages

Slide 5/ 59

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

A Sa m ple M a ch in e La n gu a ge Pr ogr a m
001000000000001100111001 001100000000010000100001 011000000000011100101110 101000111111011100101110 000000000000000000000000
I n Binary
( Difficult t o read and underst and)

10001471 14002041 30003456 50773456 00000000
I n Decim al
( Easier t o r ead and underst and)

Ref Page 210

Chapt er 12: Com put er Languages

Slide 6/ 59

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

Adva n t a ge s & Lim it a t ion s of M a ch in e La n gu a ge
Adv a n t a ge § Can be execut ed v er y fast Lim it a t ion s § § § § Machine Dependent Difficult t o program Err or pr one Difficult t o m odify

Ref Page 210

Chapt er 12: Com put er Languages

Slide 7/ 59

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

Asse m bly/ Sy m bolic La n gu a ge
Program m ing language t hat overcom es t he lim it at ions of m achine language program m ing by:
§ Using alphanum eric m nem onic codes inst ead of num eric codes for t he inst ruct ions in t he inst ruction set e.g. using ADD inst ead of 1110 ( binary) or 14 ( decim al) for inst ruct ion t o add Allowing st orage locat ions t o be represent ed in form of alphanum eric addresses inst ead of num eric addresses e.g. r epresent ing m em ory locat ions 1000, 1001, and 1002 as FRST, SCND, and ANSR respect ively Providing pseudo- inst ruct ions t hat are used for inst ruct ing the syst em how we want t he program t o be assem bled inside t he com put er’s m em ory e.g. START PROGRAM AT 0000; SET ASI DE AN ADRESS FOR FRST

§

§

Ref Page 211

Chapt er 12: Com put er Languages

Slide 8/ 59

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

Asse m ble r
§ Soft ware t hat t ranslat es as assem bly language program int o an equivalent m achine language program of a com put er
Assem bly language program I nput Assem bler Machine language program

Out put

One- t o- one correspondence ( Source Program ) ( Obj ect Program )

Ref Page 212

Chapt er 12: Com put er Languages

Slide 9/ 59

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

An Ex a m ple of Asse m bly La n gu a ge Pr ogr a m

M ne m onic HLT CLA ADD SUB STA

Opcode 00 10 14 15 30

M e a ning Halt , used at t he end of pr ogram t o st op Clear and add int o A regist er Add t o t he cont ent s of A regist er Subt ract from t he cont ent s of A regist er St ore A regist er

A subset of t he set of inst ruct ions support ed by a com put er

Ref Page 213

Chapt er 12: Com put er Languages

Slide 10/ 59

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

An Ex a m ple of Asse m bly La n gu a ge Pr ogr a m
START PROGRAM AT 0000 START DATA AT 1000 SET ASI DE AN ADDRESS FOR FRST SET ASI DE AN ADDRESS FOR SCND SET ASI DE AN ADDRESS FOR ANSR CLA FRST ADD SCND STA ANSR HLT

Sam ple assem bly language program for adding t wo num bers and st oring t he result

Ref Page 213

Chapt er 12: Com put er Languages

Slide 11/ 59

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

An Ex a m ple of Asse m bly La n gu a ge Pr ogr a m
Sym bolic n a m e FRST SCND ANSR M e m or y loca t ion 1000 1001 1002

Mapping t able set up by t he assem bler for t he dat a it em s of t he assem bly language pr ogram

Ref Page 213

Chapt er 12: Com put er Languages

Slide 12/ 59

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

An Ex a m ple of Asse m bly La n gu a ge Pr ogr a m
M e m or y loca t ion 0000 0001 0002 0003 1000 1001 1002 Con t e nt s Opcode 10 14 30 00 Addr e ss 1000 1001 1002 Clear and add t he num ber st ored at FRST t o A regist er Add t he num ber st ored at SCND t o t he cont ent s of A regist er St ore t he cont ent s of A regist er int o ANSR Halt Com m e n t s

Reser ved for FRST Reser ved for SCND Reser ved for ANSR

Equivalent m achine language program for t he assem bly language pr ogram

Ref Page 214

Chapt er 12: Com put er Languages

Slide 13/ 59

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

Adva n t a ge s of Asse m bly La n gu a ge Ove r M a ch in e La n gu a ge
§ Easier t o underst and and use § Easier t o locat e and cor r ect err ors § Easier t o m odify § No w or ry about addr esses § Easily relocat able § Efficiency of m achine language

Ref Page 214

Chapt er 12: Com put er Languages

Slide 14/ 59

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

Lim it a t ion s of Asse m bly La n gu a ge
§ Machine dependent § Knowledge of hardware required § Machine level coding

Ref Page 215

Chapt er 12: Com put er Languages

Slide 15/ 59

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

Typica l Use s of Asse m bly La n gu a ge
§ Mainly used t oday t o fine- t une im port ant part s of program s w rit t en in a high- level language t o im prove t he program ’s execut ion efficiency

Ref Page 215

Chapt er 12: Com put er Languages

Slide 16/ 59

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

Asse m bly La n gu a ge s w it h M a cr o I n st r u ct ions
§ Any assem bly language inst ruct ion t hat get s t ranslat ed int o sev eral m achine language inst ruct ions is called a m a cr o in st r u ct ion § Several assem bly languages support such m acr o inst ruct ions t o speed up t he coding process § Assem blers of such assem bly languages are designed t o produce m ult iple m achine language inst ruct ions for each m acro inst ruct ion of t he assem bly language

Ref Page 215

Chapt er 12: Com put er Languages

Slide 17/ 59

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

H igh - Le ve l La n gu a ge s
§ Machine independent § Do not r equire program m ers t o know anyt hing about t he int ernal st ruct ure of com put er on which high- level language program s will be execut ed § Deal wit h high- level coding, enabling t he program m er s t o writ e inst ruct ions using English words and fam iliar m at hem at ical sym bols and expr essions

Ref Page 216

Chapt er 12: Com put er Languages

Slide 18/ 59

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

Com pile r
§ Translat or pr ogram ( soft ware) t hat t ranslat es a highlevel language program int o it s equivalent m achine language program § Com piles a set of m achine language inst ruct ions for every pr ogram inst ruct ion in a high- level language

Ref Page 217

Chapt er 12: Com put er Languages

Slide 19/ 59

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

Com pile r

High- level language program

I nput

Com piler

Out put

Machine language program

( Source Program )

One- t o- m any correspondence ( Obj ect Program )

Ref Page 217

Chapt er 12: Com put er Languages

Slide 20/ 59

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

Com pile r
Program P1 in high- level language L1 Com piler for language L1

Machine code for P1

Program P2 in high- level language L2

Com piler for language L2

Machine code for P2

A com puter support ing languages L1 and L2 I llust rat ing t he r equirem ent of a separat e com piler for each high- level language support ed by a com put er

(Continued on next slide)

Ref Page 218

Chapt er 12: Com put er Languages

Slide 21/ 59

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

Com pile r
( Cont inued from previous slide..)

Com piler for language L1 on com puter A

Machine code for P1 t hat will r un on com puter A

Execut ed on com put er A

Program P1 in highlevel language L1

Sam e result s obt ained

Com piler for language L1 on com puter B

Machine code for P1 t hat will r un on com put er B

Execut ed on com put er B

I llust rat ing t he m achine independence charact erist ic of a high- level language. Separate com pilers are required for t he sam e language on different com put ers

Ref Page 218

Chapt er 12: Com put er Languages

Slide 22/ 59

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

Syn t a x Er r or s
I n addit ion t o doing t ranslat ion j ob, com pilers also aut om at ically det ect and indicat e synt ax er ror s Synt ax er rors ar e t ypically of following t ypes: § I llegal charact ers § I llegal com binat ion of charact ers § I m proper sequencing of inst ruct ions in a program § Use of undefined variable nam es
Not e : A com piler cannot det ect logic errors in a program

Ref Page 219

Chapt er 12: Com put er Languages

Slide 23/ 59

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

Th e Pr oce ss of Fr om A Sou r ce

Re m ovin g Syn t a x Er r or s Pr ogr a m
START Edit source program Source program Com pile source program

Synt ax errors det ected? Yes

No

Generate obj ect program Obj ect program STOP

Generate list of coded error m essages

Ref Page 219

Chapt er 12: Com put er Languages

Slide 24/ 59

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

Lin k e r
§ For a large soft ware, st oring all t he lines of pr ogram code in a single source file will be: – Difficult t o work wit h – Difficult t o deploy m ult iple program m ers t o concurr ent ly work t owar ds it s developm ent – Any change in t he source pr ogram would require t he ent ire source pr ogram t o be recom piled § Hence, a m odular approach is generally adapt ed t o dev elop large soft ware where t he soft ware consist s of m ult iple source pr ogram files § No need t o writ e pr ogram s for som e m odules as it m ight be available in library offering t he sam e funct ionalit y
(Continued on next slide)

Ref Page 219

Chapt er 12: Com put er Languages

Slide 25/ 59

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

Lin k e r
( Cont inued from previous slide..)

§ Each source program file can be independent ly m odified and com piled t o cr eat e a corr esponding obj ect pr ogram file § Linker program ( soft war e) is used t o properly com bine all t he obj ect program files ( m odules) § Creat es t he final execut able program ( load m odule)

Ref Page 220

Chapt er 12: Com put er Languages

Slide 26/ 59

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

I n t e r pr e t e r
§ I nt erpret er is a high- level language t ranslat or § Tak es one st at em ent of a high- level language program , t ranslat es it int o m achine language inst ruct ions § I m m ediat ely execut es t he result ing m achine language inst ruct ions § Com piler sim ply t ranslat es t he ent ire source program int o an obj ect pr ogram and is not involved in it s execut ion

Ref Page 220

Chapt er 12: Com put er Languages

Slide 27/ 59

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

Role of a n I n t e r pr e t e r

High- level language program ( Source Program )

I nput

I nt erpret er ( t ranslat es and executes st at em ent - byst at em ent )

Out put

Result of program execut ion

Ref Page 220

Chapt er 12: Com put er Languages

Slide 28/ 59

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

I n t e r m e dia t e La n gu a ge Com pile r & I n t e r pr e t e r
§ New t ype of com piler and int erpret er com bines t he speed, ease, and cont rol of bot h com piler and int erpret er § Com piler first com piles t he source pr ogram t o an int erm ediat e obj ect program § I nt erm ediat e obj ect program is not a m achine language code but writ t en in an int erm ediat e language t hat is virt ually m achine independent § I nt erpret er t ak es int erm ediat e obj ect pr ogram , convert s it int o m achine language program and execut es it

Ref Page 221

Chapt er 12: Com put er Languages

Slide 29/ 59

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

Be n e fit s of I n t e r m e dia t e La n gu a ge Com pile r & I n t e r pr e t e r
§ I nt erm ediat e obj ect program is in com piled form and t hus is not original source code, so safer and easier t o share § I nt erm ediat e obj ect program is based on a st andard I nt erm ediat e Definit ion Language ( I DL) § I nt erpret er can be writ t en for any com put er archit ect ure and operat ing syst em providing virt ual m achine environm ent t o t he execut ing program § Newer I nt erpret er com piles int erm ediat e program , in m em ory, int o final host m achine language program and execut es it § This t echnique is called Just - I n- Tim e ( JI T) Com pilat ion

Ref Page 221

Chapt er 12: Com put er Languages

Slide 30/ 59

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

Adva nt a ge s of H igh- Le ve l La ngua ge s
§ Machine independent § Easier t o learn and use § Fewer err ors during program developm ent § Low er program preparat ion cost § Bet t er docum ent at ion § Easier t o m aint ain

Ref Page 222

Chapt er 12: Com put er Languages

Slide 31/ 59

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

Lim it a t ions of H igh- Le ve l La ngua ge s
§ Low er ex ecut ion efficiency § Less flexibilit y t o cont rol t he com put er’s CPU, m em ory and regist ers

Ref Page 222

Chapt er 12: Com put er Languages

Slide 32/ 59

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

Obj e ct - Or ie n t e d Pr ogr a m m in g La n gu a ge s
§ Program m ing languages are used for sim ulat ing realworld problem s on com put ers § Much of t he r eal world is m ade up of obj ect s § Essence of OOP is t o solve a problem by: § I dent ifying t he real- world obj ect s of t he problem § I dent ifying processing r equired of t hem § Creat ing sim ulat ions of obj ect s, processes, and t heir com m unicat ions

Ref Page 223

Chapt er 12: Com put er Languages

Slide 33/ 59

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

FORTRAN
§ St ands for FORm ula TRAN slat ion § Originally developed by John Backus and his t eam at I BM followed by several revisions § St andardized by ANSI as FORTRAN- 77 and FORTRAN- 90 § Designed for solving scient ific & engineering problem s § Orient ed t owards solving problem s of a m at hem at ical nat ure § Popular language am ongst scient ist s and engineer s

Ref Page 223

Chapt er 12: Com put er Languages

Slide 34/ 59

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

A Sa m ple FORTRAN Pr ogr a m
C C FORTRAN PROGRAM TO COMPUTE THE SUM OF 10 NUMBERS SUM = 0 DO 50 I = 1, 10 READ ( 5, 10) N SUM = SUM + N 50 CONTI NUE WRI TE ( 6, 20) SUM 10 FORMAT ( F6.2) 20 FORMAT ( 1X, ’THE SUM OF GI VEN NUMBERS = ’, F10.2) STOP END

Ref Page 224

Chapt er 12: Com put er Languages

Slide 35/ 59

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

COBOL
§ St ands for COm m on Business Orient ed Language § Originally developed st art ed under Grace Hopper followed by COnfer ence on DAt a SYst em s Languages ( CODASYL) § St andardized by ANSI as COBOL- 74, COBOL- 85, and COBOL- 2002 § Designed for program m ing business dat a processing applicat ions § Designed t o have t he appearance and st ruct ur e of a business report writ t en in English, hence oft en r eferred t o as a self- docum ent ing language

Ref Page 224

Chapt er 12: Com put er Languages

Slide 36/ 59

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

A Sa m ple COBOL Pr ogr a m
I DENTI FI CATI ON DI VI SI ON. PROGRAM_I D. SUMUP. AUTHOR. P K SI NHA. * THI S PROGRAM COMPUTES AND PRI NTS * THE SUM OF GI VEN NUMBERS. ENVI ROMENT DI VI SI ON. CONFI GURATI ON SECTI ON. SOURCE_COMPUTER. BURROUGHS_6700. OBJECT_COMPUTER. BURROUGHS_6700. I NPUT_OUTPUT SECTI ON. FI LE_CONTROL. SELECT DATA_FI LE ASSI GN TO DI SK. SELECT OUTPUT_FI LE ASSI GN TO PRI NTER. DATA DI VI SI ON. FI LE SECTI ON.
(Continued on next slide)

Ref Page 226

Chapt er 12: Com put er Languages

Slide 37/ 59

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

A Sa m ple COBOL Pr ogr a m
( Cont inued from previous slide..)

FD DATA_FI LE RECORD CONTAI NS 80 CHARACTERS LABEL RECORD I S OMI TTED DATA RECORD IS I NPUT_DATA_ RECORD. 01 I NPUT_DATA_RECORD. 05 NPI CTURE 9( 6) V99. 05 FI LLER PI CTURE X( 72) . OUTPUT_FI LE RECORD CONTAI NS 132 CHARACTERS LABEL RECORD I S OMI TTED DATA RECORD I S OUTPUT_RECORD.
(Continued on next slide)

FD

Ref Page 226

Chapt er 12: Com put er Languages

Slide 38/ 59

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

A Sa m ple COBOL Pr ogr a m
( Cont inued from previous slide..)

OUTPUT_RECORD. 05 FI LLER PI CTURE X. 05TI TLE PI CTURE X( 25) . 05 SUM PI CTURE 9(10) V99. 05 FI LLER PI CTURE X(94) . WORKI NG_STORAGE SECTI ON. 77MESSAGE PI CTURE X(25) VALUE I S “ THE SUM OF GI VEN NUMBERS= ” . PROCEDURE DI VI SI ON. OPEN_FI LES. OPEN I NPUT DATA_FI LE. OPEN OUTPUT OUTPUT_FI LE. I NI TI ALI ZATI ON. MOVE SPACES TO OUTPUT_RECORD. MOVE ZERO TO SUM.
(Continued on next slide)

01

Ref Page 226

Chapt er 12: Com put er Languages

Slide 39/ 59

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

A Sa m ple COBOL Pr ogr a m
( Cont inued from previous slide..)

PROCESS_LOOP. READ DATA_FI LE AT END PRI NT_PARA. ADD N TO SUM. GO TO PROCESS_LOOP. PRI NT_PARA. MOVE MESSAGE TO TI TLE. WRI TE OUTPUT_RECORD. END_OF_JOB. CLOSE DATA_FI LE. CLOSE OUTPUT_FI LE. STOP RUN.

GO

TO

Ref Page 226

Chapt er 12: Com put er Languages

Slide 40/ 59

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

BASI C
§ St ands for Beginners All- purpose Sy m bolic I nst ruct ion Code § Dev eloped by Professor John Kem eny and Thom as Kurt z at Darm out h College in t he Unit ed St at es § St andardized by ANSI as BASI C- 78 § Designed t o be an int eract ive language and t o use an int erpret er inst ead of a com piler § Sim ple t o im plem ent , learn and use language. Hence, it is a widely used language on personal com put ers § Flexible and reasonably powerful language and can be used for bot h business and scient ific applicat ions

Ref Page 227

Chapt er 12: Com put er Languages

Slide 41/ 59

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

A Sa m ple BASI C Pr ogr a m
5 6 10 20 30 40 50 60 70 80 90 REM PROGRAM TO COMPUTE REM THE SUM OF 10 NUMBERS LET S = 0 FOR I = 1 TO 10 READ N LET S = S + N NEXT I PRI NT “ THE SUM OF GI VEN NUMBERS = ” ; S DATA 4, 20, 15, 32, 48 DATA 12, 3, 9, 14, 44 END;

Ref Page 227

Chapt er 12: Com put er Languages

Slide 42/ 59

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

Pa sca l
§ Nam ed aft er t he fam ous sevent eent h- cent ury French m at hem at ician Blaise Pascal § Developed by Professor Nicklaus Wirt h of Federal I nst it ut e of Technology in Zurich § Encourages program m ers t o writ e well- st ruct ured, m odular program s, inst ills good program pract ices § Recognized as an educat ional language and is used t o t each program m ing t o beginners § Suit able for bot h scient ific & business applicat ions § Has feat ures t o m anipulat e num bers, vect ors, m at rices, st rings, set s, records, files, and list s

Ref Page 228

Chapt er 12: Com put er Languages

Slide 43/ 59

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

A Sa m ple Pa sca l Pr ogr a m
PROGRAM SUMNUMS (I NPUT, OUTPUT) ; ( * PROGRAM TO COMPUTE THE SUM OF 10 NUMBERS * ) ( * DECLARATI ON OF VARI ABLES * ) VAR SUM, N : REAL; VAR I : I NTEGER; ( * MAI N PROGRAM LOGI C STARTS HERE * ) BEGI N SUM : = 0; FOR I : = 1 TO 10 DO BEGI N READ ( N) ; SUM : = SUM + N; END; WRI TELN ( ‘THE SUM OF GI VEN NUMBERS= ’, SUM) ; END;

Ref Page 228

Chapt er 12: Com put er Languages

Slide 44/ 59

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

C
§ Dev eloped in 1972 at AT&T’s Bell laborat ories, USA by Dennis Rit chie and Brian Kernighan § St andardized by ANSI and I SO as C89, C90, C99 § High- level program m ing languages ( m ainly m achine independence) wit h t he efficiency of an assem bly language § Language of choice of program m ers for port able syst em s soft war e and com m ercial soft ware packages like OS, com piler, spreadsheet , w ord pr ocessor, and dat abase m anagem ent syst em s

Ref Page 229

Chapt er 12: Com put er Languages

Slide 45/ 59

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

A Sa m ple C Pr ogr a m
/ * PROGRAM TO COMPUTE THE SUM OF 10 NUMBERS * / / * Direct ives to include st andard library and header * / # include < stdlib.h> # include < stdio.h> / * Main funct ion st art s here * / void m ain ( ) { / * Declarat ion of variables * / float Sum = 0.0, N = 0.0; int Count = 0; for (Count = 0; Count < 10; Count + + ) { print f( “ \ nGive a num ber: ” ) ; scanf( “ % f” , N) ; Sum + = N; } print f( “ THE SUM OF GI VEN NUMBERS = % f” , &Sum ) ; }

Ref Page 230

Chapt er 12: Com put er Languages

Slide 46/ 59

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

C+ +
§ Nam ed C+ + as + + is increm ent operat or and C language is increm ent ed t o it s next level wit h C+ + § Dev eloped by Bj arne St roust rup at Bell Labs in t he early 1980s § Cont ains all elem ent s of t he basic C language § Expanded t o include num er ous obj ect - orient ed program m ing feat ures § Provides a collect ion of predefined classes, along wit h t he capabilit y of user- defined classes

Ref Page 229

Chapt er 12: Com put er Languages

Slide 47/ 59

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

Ja va
§ Dev elopm ent st art ed at Sun Microsyst em s in 1991 by a t eam led by Jam es Gosling § Dev eloped t o be sim ilar t o C+ + wit h fewer feat ures t o keep it sim ple and easy t o use § Com piled code is m achine- independent and developed program s are sim ple t o im plem ent and use § Uses j ust - in- t im e com pilat ion § Used in em bedded sy st em s such as hand- held devices, t elephones and VCRs § Com es in t wo variant s – Java Runt im e Engine ( JRE) and Java Soft ware Dev elopm ent Kit ( SDK)

Ref Page 231

Chapt er 12: Com put er Languages

Slide 48/ 59

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

C# ( C Sh a r p)
§ Obj ect - orient ed program m ing language dev eloped by Anders Hej lsberg and r eleased by Microsoft as part of Microsoft ’s .NET t echnology init iat ive § St andardized by ECMA and I SO § Synt act ically and sem ant ically very close t o C+ + and adopt s various obj ect - orient ed feat ures from bot h C+ + and Java § Com pilers t arget t he Com m on Language I nfrast ruct ure ( CLI ) im plem ent ed by Com m on Language Runt im e ( CLR) of .NET Fram ew or k § CLR pr ovides im port ant ser vices such as, m em ory m anagem ent , except ion handling, and securit y

Ref Page 232

Chapt er 12: Com put er Languages

Slide 49/ 59

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

RPG
§ St ands for Report Progr am Generat or § Dev eloped by I BM t o m eet cust om er r equest s for an easy and econom ic m echanism for producing report s § Designed t o generat e t he out put report s result ing from t he processing of com m on business applicat ions § Easier t o learn and use as com pared t o COBOL § Program m ers use v er y det ailed coding sheet s t o writ e specificat ions about input , calculat ions, and out put

Ref Page 232

Chapt er 12: Com put er Languages

Slide 50/ 59

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

LI SP
§ St ands for LI St Pr ocessing § Dev eloped in 1959 by John McCart hy of MI T § Designed t o have feat ur es for m anipulat ing nonnum eric dat a, such as sym bols and st rings of t ext § Due t o it s powerful list processing capabilit y, it is ext ensively used in t he areas of pat t ern recognit ion, art ificial int elligence, and for sim ulat ion of gam es § Funct ional program m ing language in which all com put at ion is accom plished by applying funct ions t o argum ent s

Ref Page 232

Chapt er 12: Com put er Languages

Slide 51/ 59

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

SN OBOL
§ St ands for St riN g Orient ed sy m BOlic Language § Used for non- num eric applicat ions § Powerful st ring m anipulat ion feat ures § Widely used for applicat ions in t he area of t ext processing

Ref Page 233

Chapt er 12: Com put er Languages

Slide 52/ 59

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

Ch a r a ct e r ist ics of a Good Pr ogr a m m in g La n gu a ge
§ Sim plicit y § Nat uralness § Abst ract ion § Efficiency § St ruct ured Program m ing Support § Com pact ness § Localit y § Ext ensibilit y § Suit abilit y t o it s environm ent

Ref Page 233

Chapt er 12: Com put er Languages

Slide 53/ 59

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

Fa ct or s for Se le ct in g a La n gu a ge for Codin g a n Applica t ion
§ Nat ure of t he applicat ion § Fam iliarit y wit h t he language § Ease of learning t he language § Availabilit y of program dev elopm ent t ools § Ex ecut ion efficiency § Feat ures of a good pr ogram m ing language

Ref Page 234

Chapt er 12: Com put er Languages

Slide 54/ 59

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

Su bpr ogr a m
§ Program w rit t en in a m anner t hat it can be brought int o use in ot her program s and used whenev er needed wit hout rewrit ing § Also referred t o as subrout ine, sub- procedur e, or funct ion § Subprogram call st at em ent cont ains t he nam e of t he subprogram followed by a list of param et ers enclosed wit hin a pair of par ent heses § I nt rinsic subprogram s ( also called built - in- funct ions) are t hose pr ovided wit h t he program m ing language § Program m er- writ t en subprogram s ar e writ t en and used as and when t hey ar e needed

Ref Page 235

Chapt er 12: Com put er Languages

Slide 55/ 59

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

St r u ct u r e of a Su bpr ogr a m
Subprogram nam e Param et er

sqrt

(x)

Subprogram header

Set of inst ruct ions t hat perform t he int ended t ask

Subprogram body

Ref Page 235

Chapt er 12: Com put er Languages

Slide 56/ 59

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

Flow of Con t r ol in Ca se of Su bpr ogr a m Ca lls
2 3 subprogram body 7 5 subprogram call st at em ent 8 9 next st at em ent 6 4 1 subprogram call st at em ent next st at em ent

subprogram header

A subprogram

Flow of control

A program t hat calls t he subprogram t wice

Ref Page 236

Chapt er 12: Com put er Languages

Slide 57/ 59

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

Ke y W or ds/ Ph r a se s
§ § § § § § § § § § § § § § § § § § Assem bler Assem bly language BASI C Built - in funct ion C C+ + C# COBOL Coding Com piler Com put er language FORTRAN Funct ion High- level language Hot Java I nt er pret er I nt r insic subpr ogram I nt er m ediat e com piler and I nt er pret er Java § § § § § § § § § § § § § § § § § § § § Just - in- t im e com pilat ion Language processor Linker LI SP Load m odule Logic er r or Low- level language Machine language Macro inst ruct ions Obj ect pr ogram Obj ect - or ient ed program m ing Opcode Oper and Pascal Program m er Program m ing Program m ing language Pseudo inst ruct ion RPG Self- docum ent ing language
(Continued on next slide)

Ref Page 236

Chapt er 12: Com put er Languages

Slide 58/ 59

Com put er Fundam ent als: Pradeep K. Sinha & Pr it ii Sinha Com put er Fundam ent als: Pradeep K. Sinha & Pr it Sinha

Ke y W or ds/ Ph r a se s
( Cont inued from previous slide..)

§ § § § § § § § §

SNOBOL Source program Sub- procedur e Subprogram Subrout ine Sym bolic language Synt ax er ror Synt ax rules Writ t en subprogram s

Ref Page 236

Chapt er 12: Com put er Languages

Slide 59/ 59

Similar Documents