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

PPS Ques Bank Answers

Pps questions

Uploaded by

vyshukodumuri
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views23 pages

PPS Ques Bank Answers

Pps questions

Uploaded by

vyshukodumuri
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 23

queslion und

Fylain "hc sfrudun of

Aps Documentakon. Commen abuut Prqram


pvom
nk Inshuck on tCompfle
Definihon denes al Sqmbolit Conshank
Gyobal deelarahon- Vanable 1hal equenty td

peclanaHon all vaiables


fstauion proqamning
Subproq1am USe defned funckons
Daw alow cha Jor findoq hiqhes common civisov
2 nombex.
(stav
de clare yoviot
ny7, c

/Input niGn

1 0
No
platn he berween odgsthrmn andlowchoy
difenee
Ans
lgurithm Flowchart
Plachart a diagram
Alqolhm skp by skp Creatd by diffevenB shapg
P1OCcdluxto So e the pvoblem shouo h flow ot cloa
Alqoi Hhm Complex to Flowchpr cosy to
Undersland. undersand.
39 alqorithm plain tex ore In fowchovh, ymbls/shapesu
Flouchart hovd to deh
Alqoihm ctasy to debu
xFlowchort " simple to
Algottm di fffault to Constuc
Conghuc

plotn djernt types of wth (xamplea

RonRme vovs
ronRme erYOYS are Thost eos thatOctor coria he

pYgyam & aneally OctuY due to sone


Cxeuion of a

1o the proqHam
ileaad OpevaHon pformeo
t dividinqa nUmber by ero.
lack of free mUnory Spate.

Conmpik XYOYS

Syntoeror whn tht ruls of the proqrcmminq


Acncuaq 0t not foloutdhe comler will sho Suntax
Syntax
Aoneua
eyos
int 0,b: ()

SemonHc eYor Semoot cwon at Atportd by he


he

Compiley when the Stutmen onttn în the


ae oo meonin q t to omper

btC 0 (x)
a-bt (V)
lmical

lqteal eAtDm in th 0upu pory a


he pYelerxe o Aogiead eno Aeolk to Undesi d 0
inconec wtpul
Couuto du
Coued d ewor
in he Aucgtc appled inhe poyom
to pvodure ht destved oukpu
Auo, Aoqical nor (Ould not be dek cltd by compiley
DYou
DYow
lowchovt to tnd all the rouyoo0+bt(ro
Any
Stat
De dot varsable
ayb, 0,xi, *2, tp

Calculate dscim
-Ynan Dl-b-4oC

vut Faue

mt(-b6ha
Y4(b+ o/1a

isplan &
stop

( ) CEFC6)1b
6

IllO 0000 ol1O

(OUOot0 OliO),
(IOO

D&Ib

(123)
1238 3X
2 x8 6

(1n26)o
6 1236
16 33
6 y (0)

4DA) r
O(AgD)

+dtubL00pi D I 0 1011 01 000

TWT (12a2)

1667
(6s)

6 65

(158 (138-5)

3 S

(10.101)

(AG 1 1o
B x6
- x 4 46 A A yI6 10x16 =Ibo
AB- 1

234)o : 18-1 0.0625

0-1 0.062J
AB.lI6
o + 0062SS
106

ins.1sho* No 0.25
0l5x8 L+ 0

0.5 ino ocal numbrv C

1452
115
(OID) und (1100)
Calaulake Complement
AM ( O o

Calculae 2(omplemen o (MDI) ond (1100)


Anu
( 1 O0

O DI0

0 0
+

Lis ouk all the tokens avalable in


n ongage!

Thy at,
tken tpeen an oSix type) Thy
Keywords (cg. int, while)
Sdenb es mafo, total)
3. Constan eg 10,20)
4. Sing (eg. total, "hete"),
5 Sqtol Symbols (a (0,t})
6 Opevak

wOYdly
9 kyoovds: Ruycod art pre- defncd o Aserved

to
in a pv0qtamming lonquaoe. tach koquoord mant

în a potam. c uppors
lonquag UPporh
penfovm a syecike unckon
Such 0 auD, double, int, btak, ehe k -
3a kqwOrds

do you mean by kuwovd Enkigt kn


ive
wha
teoovcs in Aanquoq nc aoo wik thefv
0rd UHd îo
Kuyoonos a pdefhed, erved

PYocamnminq ha hont pecfol meon inp fo the (ompile.

ond tht (onof be


Kyor da
kqwords ov
pat of 1he ynlox
wed a) an denl fper. or etomple tnt money tex,tot4
a kywonc tho ndrak mDncy a voriable oype fot
Fivt eiomples kcuwbrdb

au
beak
do

e
Ther we:

Thty help to Ose fhe unchonalthy oKangunge.


Thy hon spetod
speciol moning to the comptlers

Erlain differtnt rules o voriable dedavahon


Ary
intsors nkg% (whole numbers), uihoot deimals,
Such a 123 DY -113

double - skoyea
loohing pain numbeK, uih decimals
Such a 99 0r -199.

chav stoves sin chovocle, Such a^ o OB


shin - sho tert, Such o 4ello World

*bool sores alues th two stolu thue ov. fale.


Rul OY naming Vahoble
Vaioble nomes Con tonlain the efles o- OY A-2 ov

dioik o-9 a Mell o the dhavacs -


Nome of the Vauiabes canno bt stored ith a
digal.
Name of the voradu Canno be an CH Kuyooro

y int,look, nol, shing, te


ollowing 1Cms wihexamples
frplain 1ke
type de () &ymbolke conskant

A G)
typt a keqwovd Utd in c
def
Pedef. The hypedef
ht
th
PYOqyominq to Provide some meanin u l n a m s t
altady Cxishng Vanable in the PYcAam Tbthoves

ue
milovly aa we defnt the alios hov the commanda n sha
(on that this
Say ewOvd cd to Aedetne the
name of on oltody xisnq Vorable
(i)Sumboi conan A symbolie consBant name 9itn
to Sone numeric (onson or a choveY Constont OY
shin Cdnsant Ov any othe
consonty. Symbolic CoDston
nomes Ort gMD knduon 0 (bnstont idenk hers
Prt-proe sor dreckre idefne ú ned
Symbolic Onuant deftoing
py defioing

Entst operators Gnd th


types
Any Operohos o fhe toondakpn o proonamming kongung
lancuq pYovide diffent kind t Dprvokors
faanF type o opevoors in
in u
1 Ar?thenmehic Opevatoxs
Pelohonol Opevops
3 Loerica operaos
4 Aignman opevcuhors
ncement ond decremnt opevobs
6Cond:Horol operaos
8ihuise Opevators
8Speciol opvaon
Tuplain dfoen unhiong ud adiny ond iking
(A havodo oryuorye alon ih h a
nc eNample.
Ar
inples the (Ongole 3/0 onchony o kho),
uhich
which Aeuda a chovotkv orn th oord, nd pukchore)
whih pnts o choroc to he t
The qdhe ) uncktn onkl i
wotks on o
kay pend
and fhen, evm ih Value. 1he ky pend ts ok tchoed
to the SCn autonmokaly
The putcho ( unckon wrt th thovater ovgumenk
to the SCYeen o the wnent uvsoY pohon
1ht dedarolions ov the c ond pukehaY 0 ak
nehe (void ;
int pub chav (tnt ),

Tht htode e fov


qthe () and pwchar ) ú in
CO OI0 H

1ploin the nukd f doe wih on


pogram
pregnam

when ani
an f the
se sttoment pasent instde the bods
An bod
of nothev O h then thi's úallad nestd

The wuu of o nukd else shoktmnt au to dheck


fhe
he condiion o f stalment. if 1 is tue then
Con hec arethev if stakemen condihon uhith i
Inuid h obove istoemens
ompe ofnukd eln

d'ndude Lsdio-h >


int moln )

tnt Var , var?

pnt Inpsk tht Valu ot.var 1: ");


Scanf hd" f var 1)

Printf (nput the Volue of var :");


Scon (d, vara);

pintnt C'Vov nat equol to va 2\o


i(var 1 > VaY 1)

pRotf(Vav1 co thon va \n");

piot Vovi ugacale thon va 4 n);

printfC°Vay 1 quol to var-0);


reho 0,

tht fpllowing pathm ving fov leop.


Print
Print

ny
f inchuele stediv h»
4includec (onio.h
Void matn C)

tnt i,a D
fov(i-1i-5;ita)

int (d, a),

rh)

Psa Aht
ht fins tun prime nombery Uing while loop
loop
Any 1 in dude stdio.h >
fnt man )

fo i,a , Count
whle C4 =10)

(ount 0
while (te :
O^)

Countt
ba

1 count- o &a-1)
0vtpu
printf (1d, a),
t t ,3,S,3
aturn o,
Wha loptng rplao wih
do ou Mon b Opevatov
Ohe
Pogcom
m Tht tpeakn tht Samt PYOC
loopin
0opinq (an be dekind a

mulkple Kme onkl o pcuf Conolt ion soks Thee a


nte
p t deps Uel in tht Xonguaoe
While ioop
fov 0op
dodo while loop
nakd Aoops-
tiomyle - whileovp

Hindude < skdoh


fnt moin C)

whide es5) outpu


, 2,3,1,S
printf d,i);
3

tsplotn thet followmq tum.

Brtak The break a kuwovc o whiuh y


t d
wtd to banq
bnn the pvosaam (ontol 0u of the loop
loop
The bxak stokement ustd nide eap 0r Slh
Stakmenl. Tht bxak stalemant broks th oop 00
one, ie, fn the ca^e o nurd doops, i ?F braky th
nner doop ftrst and than preccecls ge lbtpj
Dutt
(onihut he COnRrue u std to br ht
the proorom conhot

to tht beqi nn:ng 5hek0op. The onn ue shatmenh skips


SOme nes st cOde inside the oop ond ontihua wth the hens
tHtvakon

Gshor-A qoho stakment n Xonquase - povidy

n cond?ionoX jump om the 'gob t a ohded


skukment n the tame unthon Any proqtam tho uu

0go can be onttn to aunid thom.

Rehorm A rehun stokment nd the exeuHon o a funchon,


ond
Ond selorna conhrot to the Calin
in h
funcon Eiauion ruumu
calng tunchon o the point immuoliot btle sing
th Call.

procaamto find mnimum Or maximu elament


em 9iven arvay
#incuck cstehio.h >
# defne MAY SIzE 100

oYY Ma x._ Si2¬];


int, i,mav, min, ie;
pintf ("¬nltr Size ovay: ");

pat ntv elumen in the


fov ( 0 ie siae; it+)
ova "))
&Con (-d orr [i7);

min aYY [o);

fov ( , ise; i+ +)
f (avt7 > ma)

ma YY T3
(av(ovY[i) mino)
min aYY

ren pinf (" Moxim ebmenf d o moy l;


Print(Hinim tsmun
Vd" min),
chon 0

Wik a
procam to Teyese . CAD

And 1mclude <stdig-h


in main )
int num, i,j away so), anvoy (SD
pmnt ("ntev nf elumenty în avay
In"),
SCen(1d" num);
priotf
(4nkr ay esmn
n)
fo (i-0 ; inum , i++)
SCanf( 1d d aroy1t );
o (i num -1, j i=a, î--j+t)

foi0 fenum, î*t)

paintf ( he tversed Owa


o
n");
(-0, ienom, ++)
printf d in', oray! i));
rturm 0
txploin Th (onept o oW mao ond (olumn mojoY
n

In Computng, yOu mojov OYder ind (olumn- mojtr Order e t


aie mefhads o storng mulkdemenglona) ovYays inintoy
nto
shovaor such as andbm
mMory accem
In row-mcor Orcn
the Conseuhe elamen o a rowAeside
nex to each
ofht, whert ou t SOme halos true for Conse cuhve
elamenh a st (olumn to olumn mafov 0rdev
Row-matoY ovdev Column-mafor ovdur

Os a

Explan The
dffaunt orvay nkaltoion teth
tcch nique
Any Thex ade tuo wos to
sp ty tnikaltes for aro:
t h C9 she nkaize, Oway
elumen mu
mu bbe
nithial ted n subianpt Orda
Usinq dustonakd nihialttey, which allow
he values o thu you h peti
Speti fyy
subsunpt elemenh hbe tnthalit ed
YO amenh Con bt inHo nd în on drdes
plain the fpllinq tunchn of sting ond uh thiv
Syota Cand
ind tvample ( shrta cti)shepy Ci) &hlen v)shemp
Any
() sheotEO Tht shtof unchon wwH apend pcopy
c a

osoure shi to the end oF desknokon


The shcot () unckon takes tuD Grgument
Deahnaion 2 CoUYce.
wAl value unchon lu wtto/poin
hto/poink
ht
ht svot )
to ht desinahon
shir
int maln (

chav deat [SO] " Pavul;


chav Sre To)"Univemihy",
shcat (du, sre);
Printf Cial shing is 7s, daty
Yohyrn 0

shpyO: The shrcpu unchon a shundovd Aibvav


unckon în Aarquas and ft u d to ccOP De
ghin te
anothe shing
Syota'shepyc (tons chas SYe, tons cha« * duh;
whte, sv inditaks shing which be' capiel.
whee, de inditaks point ho ht dukinehion

SYC, shin i to bt (Opitd.


whert,
n main )

ho dest 01,
chav re tso] "Paral uni
shr cpy (dest ve);
fut Sldeot)
ehum 0,
shkn) h shlen) unchion (olulgles th lenh
gfven shing.
The shlnd kunchon defincd in<shingh> htade fle.
Synton in shlen (const chav * sh);
shin Povul universiky
int main ()
cha A 2o7;
pinkf (Cntv shie);
sCan yS", A))
pntAnqh th is hd shentA)),
vehumo,

shemp) 0- he. shcmp unchon Compcs twp shigs


chov by char, ithe shinq at
tqual thon hunchon
rekn o.
The un thon take wo
written value om shtmptpavumehuu, shng and shing
o bott
shineys eguo
7D i f1if ht n-mathing thar in
ring 1
t orty i0 ASCI Volut a Compaed to shing
0 ithe hm-matthinq thor in
shhins1 u
Xeme n ASCl volut
(omportd to shino

What do you mtan b shing Explain sinifcanee

lo shing sta.
Ang shing in c is 0n
arvay of chavaceri, folla.ord
by a NULL thovader To epresent a ching, o s of
chovacen oe encloscd ihin double qpaes ().
Stgoiitanre 0 i shing
Hhot the shing i(0mplthid.
uwrd td to show
mals he tnd h shiog. malply
mafply
wtd in shig by defaull shing c0ntoo yo
chovac mcan shoL the o cho in shing
end
hd
o gway (ontoutn 0 to sop tht awo
MemOnA ollocahon
Memo p shmonom
24 h their
aplain ckiferent types o fonckon olong
tXample Jobuil 6) Uaev defoed
obuilt unchon
builtn
Tht standavc Atbrovy unckona are

unchons o prooamming9
Thest unchons on defined ta bcader l
Esormple The
The print je a tandard rbvavy uncion
to send fomatkd Dulput to the SCYeen This
funchion
deincd to stdio h heovdev sle.
Htnce to Ux pinto unchon, we ned hincuce
<sldsoha hcode fle.

Dn- defined Hrockor These ODcHons ms be dehved by


he
The progommeY OY Usey. P0qrammety the
the hos to ik

Cocling o such unchons and tat them properly befor


Drioq 1hem.
Tht syntux ven by USer So Thee 4 no need to
include an heoder le
main) Suap t) SUm C)
et
CErploío call buy yalue 4call by fecn re wiR 0ne

pgiom
Ans (i) Call by valur.

n call by valut method, 1ht valae ot he


he ackuod

povomtts i
copitel o the pvmol pa ramet (oY) the
value o 1hvoviable td in the unkon (all in
the cal by value method,

We canno mpdtfy Tht vaku


atu
he ovmo povamek pewametr by
Exompla #ncludezseo.h>
Void thanqe (ínt num)
P(Bfont adding voluc inside unckon num-7-dr
nUm nUm tIO0, num)
(AfeY addlinqvolue inside Hunchon
num-fdu-
fnt main () num)

P Befort fonckon
coa x-7d In', );
honog (x)
PE(aty funchion call
/-dn, x);
khom 0
3
i) Call by refeence o call by vefeence tht addrs of the
vorioble oxsecl hh tht funchon call ahe achiol
Povaneey. Value of the achual
Poiromets CCun be modifed
by Chonqq tht
famal povame-us Sine the
achuol
adde ot
povomehs is pomed
POMed
NONple Hchde e slelio h>
Void cha(inf Hum)
PBfot acdig salue intide bundhbn nun dp
num) + 100,

1AY adding value tnide hunchon num 7dio


int main C)

int a =
Do
P4 ("Bcsort foockion Call x /dIn", )x

change (x),
P(After funchion call
17dto
vthosn o x);

What do you mecan by Retursive funchon.


Ans In when a fonchon Calls a topy of itkelf
thon he protes knooo 0 Reunion. po
To Pok
thlf Then this
tshort when a funckon Calls

tteniqie enouwn a4 Pecumion


have to dene an
while UsinG Secursion yoo wil
mt then it uil
eit Condikon on tho tunckon, i
0 o
in an fnfoit Xoop

Wik a puaam to pntisk tn DUmbt


Senes Uhnq ACuHie fonchon
btonocis
incude shdio h>
Hincdudee conio-h >

int tbonaer(nt);
int mosn)
int D,

P Entt the number of eltmen in


Seres:o

14(fbonocci seits à : n)
fo (i=0, ien it +
i 1d" fbonacci(0);
qprth C)
int bon ac Cint i)
.0i:-o) rthumo
eae if li1) ehvny
he rto
(frlono cui (1-)+fibonarci (l-i);

Recursive Funckon b (aleulak thu powev

number
Ap includt stdio h
int poweY (tot Di,fo nu);
i9 Main ()

int bast,a, seult;


Pt (Coler bast numbev, ");
(7-d", bout );
oter (pouikiv inkge):");
pour humbe
s d fa),
OutPouwev (bst, o)
P4
d 1.d bost, a, sesult)

int
powe (int bast, fnt a)
(a0)
Tchum (baut +
powe ( bast, a -1)
yekum 1

WAh US defincd tunckon to fnd SU of


of
dtoib
Any #incucle stdio.h>
int main ()

nt D, &Um 0,m

f("ntr a numbtr: ");


s (-d"e»)
whde (n>o)
men 10,

Jum SUM +m*

n: 910

PfSunm i td, sum)


pain h mpoonre u Moros in ongung
adeng loith
pope eompl.
A
nth po10mmfng Lancuoo,the #dene
mocros within
diveche allows tht denihon o
SOUYLe code
Matvo
deinikons O Dot Voriables and CannoF
bt
chonard
(hanged
pu Genevally
by your Vaua bles-
poqsam COde tk vaaia b
UR this
yntx when CHahn Con4kanh
tho Rpuen numbes,
shings or expreierd
The aM fuo yp macros
0bject like macros
Funchon- Atke mocos
Tampl
)DATE TepY LnH urnt dak in
MMM DD Y49y" kovmo
2) TIME
repsens unk hi în

HHMM Ss" ovmo


LINE prtnh uen Aine numbev

)-ALE_ epAtnh u n fk na

You might also like