Sie sind auf Seite 1von 1

2614ltl-

,Dual Indian Institute of Eneineerins, ScieDce dd Technoloey, Shibpur


Desree B.Tech.-NI.Tech. 2"d Sem€ster (CS/rT/ETC/EE/ArJ) Examilations. 2012
Introducrion To Computins (CS _ 120r)
Time: 2 hous FuI Mdks: 35
(Affiuer QuTtion Na. 1 dnd ana three lrorn the rest. 1 nark is rp-serl,ed
All po.r* ol rhe sdne qu*tioa mtust be ansuered together.
lor neattuess.
For the prosrammins problems we C Lansuase. )
I fA) Consider the tollowing code segmeDr of prosams ro find ihe ourput(s) of rhe prosrms and jusut,
your answem in short:
(a) rnt x :25i
printf(,,%i, %d,,, X, x);
(b) int *P, x:50;
P:&X;
PrL' f -iod ood' 'P \
(c) intx=6*5/3+81
intY=X/2
print{{.%d, %d,,, x, yJ;

{d) intx=0j
if (++X)
prjntf(..T" )i
else if (x =: 1)
prinrf(.F" );
(B) What is the Ociol equi1?lent of rhe ,yezddeomal number E5?

[2x5:10]
2 (a) Construct the t.uth table aDd draw the tosic crcujr djasran, if possibte usina ninjmu
t elnput logic gates onllr, for a three blt Frll ,{dder The F l Ad.det musr be deslgnedEo. ol
using

[(3+(t+2)):8]
3. (a) State the diference betwee! uhi,te and da ui e Loops with suftabte exanple
(b) Wrjte a program ro compute r! , where c and s are unsigned lnregers Do nor lse
rhe standar.l
tibra.y frDction p,u0

[(2+2)+4=81
4 (a) 14ii@ a recusive tunctlon to comluie rhe facroriat of a number n and atso writ€ rhe proglan
to tsi
the irction. where n is the ilput gj./€n by the user
(b) Write a fmcuoD mt ranse (int anl), .int nlnn) thar takej m inreger era_1, and its tensth
as
af$ments, and retuns the difierence beiween the naxinuEl elemeni s;d ihe minjnu etement in
the a.rray For iLctance, (2, a.7,1. 31, s) shoxld reium 7_ 1_ 6
'anse
[3+5=8]
5 G) Wiite aJutrction tn, srrl (cnm drJl) to catcutate rh€ Lensrh of a strins wirhout using aDy standa.d
librdt, fiDcuon and also write the compLere program to iest rhe frctjon
(b) lvnte a program to alocare space for n inteser Dumbers uisns dlmamjc m€mory a[ocarion
ald ihen
populate the numbe6. Finally, sorr rhese Dumbers in mcendjng order

[3+(2+3) =8]
6 (a) Wlai ar€ ih€ diJi€r.lces beiween siru.rrre and lnion? Exptain ir wirh suitabte example(s)
(b) Write a lroeran to creaie a file (say ms,€le./ci) dd store n Dumbe. ot records ot studenrs wirh
rhe
fr€lds ,s EoliND, FLLlNane a1d FlLlylarls in rhai 6te. whe.e n 6 the input
srven bv the user

[(2+2)+!t:81

Das könnte Ihnen auch gefallen