You are on page 1of 19

ANNEXURE I

KARPAGAM COLLEGE OF ENGINEERING


(Autonomous)
coIMBATORE 641032
Register Number
2oL 339
Name
of the CandidateR- V Raga
Degree BE
Branch
ECE Semester I
Question Paper Code
20618 PCOYC
Course Code
18LCO
Course Name
Adwanued CprDYamirg
Date
O5 o8 Session FNIAN
No. of Pages used
18 Inwords Eahteen
All particularsgiven above by me are verified and found to be correct
Signature ofthe Student with date R-V-Ragau
dT821
For Office Use Only

READ THE INSTRUCTIONS GIVEN OVERLEAF BEFORE WRITING THE EXAMINATION

MARKS TO BE FILLED IN BY THE EXAMINER


Part-B
Q. No. Part-A Q No. Sub Total
(6) (ii) (iii)

13
14
15
16
17
18
19
10 20

Total (A) Total (B)


Grand Total (A+B)
Total Marks in Words:

Signature of the
Name of the Examiner Date
Examiner
NomeRV Rogaui coushe uone 8LCoy
Cese name:Adwanued c Prvgnammin9.
Relnuum: 20L339
Panu-
Symtax ho declore Pointe vaualole
datakype*Van_name;
int ptY

2 Puea C i r c l e
#inclnde LStdio.h7

veid maunC)

look = 5;
Hloak *fp= fr;
piang hf, 3:1y +fp "fe);

Gutput
18 5000oo.

3 Aay ponters
CoUecbon duteenk memhy fddresg

dmtax
Doatahype *pounten Vabuable LSiuye

Dote :sl8l21 9no:O R-URagoui


NOme R.V Ragawi CAne ode: 8LCOY
Roluunm: 20L33 Cowe name Advanced CProgamming.
4 Pnt the addbues_e couale
HinctudeLSbdio-h

i n t maunc)

iti- 5D
nt +ptr - I

pnt C Pdlduem et i=/u\ni)


pritg C Roldnes eßi = /unptr)
prwtg C value eti=hd \n , *ptr);

eubput
Addoeys i =6olo
Radress ei=6olo
Vauue iso

5 Ue stcnC)
TO nd he hast occuence e he characten

mtax
han nchn (chan a[iboChan ch)

6 Stuuctwre
Coection e dbberent en diimalan e

Hetenogeneeus Dotabypes omd Cemmen name s t a n t

Smkox
Sut tagrarme Atuctwe hame
Dtabype stuuche hamel;
Doutabype uutune name 2
poutoype u t e name n
Date: 5T|2 no. o2 R:V. Ragwi
Naurne RvRogavi COwe codle 8LCOY
Polum 20339 Cewwe name AduUaned c Progamming

77 8peakeh Ned acueing membn a uutbre


*Det openaten
A U A w OPestatoh

8 fpuntg ) fscanbC .
rube tEne Lentent nto *Reoo e entent om
ole fle
Sumtor *Smtar
pnt (fe FS vanvalue)scant p . FSvan);
whee P Jue pouteh b whene fp hle povnte o
Ae datobype FILE Ce datrbpe FlLE

TCe
TCe puopose et Y n e kuncaion fopenC ) s to

Rad tae ontent o m u e

oTpes Aeam an FILE


Stdin
Stdet

Stder

Dote:5 &(21 Po 3 Rv Ragu


Name: RV Ragai Cawie code: 18LCo
PoUhum-2o339 CeuseMame AdAOncedc Progamming9
Raul-B
1 NOLL peuntON.
NULL peunten a penten a i d h pohtng koD

notthn9
wtth O N O L L
*NULL peunte ammed

Sumtax
databype pby(databype *)o;
dotabyp
Exoumplee
int ptr Cint *)o;
iwt +Ptr=NOLL

Puogam.
tinceude LStdio. h>

int man C)

nt *p=o; i n t * 1p =NOLL)

puuntC u" ip);

Output

ote: 518/21 Pano: RVRagwi


Name RV.Ragawi Cooe Lode: 18LCOy
BOU uum: 2o339 Ceune vname AduwanLed C
Progtanmming
Geneie Ponten
tCenerie Peinten ib alo Knoun as Void peinte.

Veid PoUhters Cannot be derelenenep


t e vbid
Tt Coun be dene wwn9 bype.coabing

pounben
oduttmehic s net possiele n pountehus e
*Pounten

veid

SYmtar
det veid *Ptr;

oogam
/Pdd uoo numbes

incude 2Stdoh
tnt mauunC)

e 1025, 1b=)5,
void p) =/1o , *ip2 Q16
=

*Cint)ipa.),
prunw C"/d', *Cintt*)ip) +

Outpuut
40

ate :I8/21 Pyno:OSS RU Rogoui


Noume:RVRagawi COse ode :18LCO
Cnuuse name Pdwaned c Progammuny
|Pol nuum :20l331
and oUay
14 t 2 *2 matux wug ponien
incuode 2 stdio h >

Veid main()

ivt ama][-J {12,3/4 ir, ic;


=

e (r= o ;irl2iY ++)

teric=0,ic 22 ic+t)

pPuunte, (rdCCamt ir)+ic)

PrutC)n

6utpuut
2

Tote:Sl821 Pno'ob RVRajawr


Nome Rv. Ragawi. CAwe uoole 18LCo
Pol nuwm 20L339 Ceunse vname Aduaunted Proyamming.

Anay peten
CeLectidn odubenent Memey addrey

Dotabype *Ponten Vauoble [sif


Dotabype
Puoha
values skoL Me addey o
| Tnubaluye 3ntep
fhe value well
vouuable .unt
poten
avay
aTvay
peute.
addbuem wung
aUay e
Os
n u d e stdio h7
Veid moun

ic =47
int ia =25, ib=16,
int1ap3J;

iop[o = ia
iap[iJ=Qb
iaP[2J-ic;
*iap[o3, tiap[ J, *iap[2]);
p r i n t C d f d tal
h,
/ u r , iaplol, iapCi3,
iapl2]);
pront C fu

8utpuut

25 16 4
2618068652
26180b86qy 2618D686y8

Tate: 5l8l21 Pho:o7. Rv Ragui


Noume: P-V. Ragani Coe code : 18LCOY
Rolwwm:2oL339 Ceue name: Adwanced Progpammuwng

15 Spulen). Smtax
TD 6und Lengt ung int rlen (chak);

print4Chd,wlen (s));
Lomam
t i n d u d e 2Stdio:h>

include L Stringhz
maunC)

Clnan S12J= Evngineering


nt len =Sulen Cs) ;

printg C-d , len)

Gutput

n)SoemPC)
Covnpoue h e hwo u n Arung a e e9ual

tuebbuns o. ethenuwue Lt e b n y AsCIValine

duuterence

int Strcmp (chan oCio0J chanb Lioo;

Date:5B 7no:08 RVRaga


Namt:R-v Ragawi. Cwue Lode: 19LCO
CAune name :Advanced C pPuogramming.
Lalwwn:20L339

Pouogam
ttinceuele Stdio. h>
Hinceude Stung-h>
Intmaun )

Cnan oCioo]=ECE
b[ioJ ="ECE
d , romp (a.b);
print

autput

) Stupy )
To copY One Soung J t o Qunethen stnng

prntg CS, ropy (S(, PcP);


Syntda
nan tbicpy (an detinabonl J,chan Seuwnce
Pouogam.
#indude Stduio h>

tinctude Lstnng h
Int maun ()
"

Unan Str Lao]- AcP


Clnan St 2 2oJ,
Strcpy (Str2, Str);
pubs str2)
yTehwn o
Pote:5l8(21 7no: o9 R.v. Ragowi
NoumeRV.Ragawi Ceuoue ode: 8LcO4
Cohye name: Advanced C Pogamming
RoU um:2oL331

eutpuut
ACP

iv)Strcat()
TDmeC hwo tungs.

print ( d,Strcat (S1, si);


Smtox +rl,can tStr >
Ccha
Pogha chan rcat
tin&ude LStdio.h

#nude stnngh7

t manC)

c h a nS i[ o J = " H e l o "

Cnah $a io]- weL4";


trcat (s1, S2)
Concakenabibrm:/S, sD;
printk CAlen
Tebono

utput
Hello Old
ALten Cencatenatibn

Dote:5|8/21 no ta R:V Ragow


Name R-V RagaAi u ecode: (8LCo4
RoU nuum.201339 Cowue name: Adwaneol C
progPam
7 ma0ocC)
ALlocate mevey pace
n a Sungle Block

dymtax
-(Eypecast *) malloc CSiae);
ptr
ptr
(veid*)malloc (sine );
gam.
DMA
/Read and punt arUay
5 numben using
Tmalloc)
tineude Stio.h>

t n c u d e L Stdlilb.h>

main C)

t ka , l i

a =malUoc (s* ) l =mallo (ro);


(=oilz5;l++)
(la =mallar (s t Cue eglint))
hen

Scamg Ctd',va[J)
printh Cd", Ca+D;
+

euput
ee Ca)

Dates 8l21 Pqno: R:V. Ragawi


Noume:R-V Ragau Ceuwue ode 18LCO4
Ceuse vmame hdWaun&ed CPYDaammun9
RoUnuum 20L339.

ii)CallcL) muutiple Lloce


A C r a t e memoy
Spaue un a

*Conbinues memey allocotibn.

Smtax
(no eg blE,wiage);
Pta-Cbypecant*)calloc
ptx - (veid*) collo Cno. o6 Wk , Aime)

Pooram
IRead and punt
aay e 5 numbern ng calloeO
#rnclude ZstdiD.hz
inceuole L s t d l h

maun C

nt ta, ,
a (alloc (Si4) l a =CallocS,Sice4 Cint))
enL-o ; l L5, t+)

Scant C-d 'ua[A])


prirt C1d', alJ),

4ee Ca),
put

Dote: 5121 Prno: 12 R.v. Raqawi


Name RV Ragau CeUe code 18Lco
BoU nuum 20339 Ceuursename:Aoluoced C PYogaummug.
i ) Juea0loc)
Rea00ocate tChe memety Pace (e) orink (e)
enla n e Memouy pace

mba
ptr-Yealloc (dataubype pbuten,Meumm);
nd calusake Sum
calculateSu
PYOgam= Read 5nuwmben bava
#inceude stdio-hz
tinceude 2Stalib.h>

main C)

mtp=malloc ( S*y);

jnd,s1=Oo, S2=o;

4e Cl-o :LL5, Lt+)

Scanb C1-d ", LP[A);


S1=S1+ PCLJ

5 etomeuts 1d \n,SD;
printf CSum et
/Rea0locate Memony spae
Cp,1ofu);
E9Lealloc
Leio;lt+)
4en (= o;

Scant Cd',p ( )
S2-S2+PCAJ:
Date 52 PgnD:3 PV Ragou
Name: RV e a j a Cawe loste: 18LLO
Ceuwse name
pdvanced c Dyorammang
Roll num:200339
phontt C Slum s 1o nos d , S2)

ee (P);

ubput
123 A5
5 elemenb) 15
Sume
2 3 4 5678 9 1o

S5
Suum e lo hos

iv) reet) neleaue


the space ) d e l e t e
() Bemove
ee
decllocate
he memoty pace

Simtay
4ee Cpeutenvanialble);

Boeram
Reverse to numbers usung DMA
h>
#incluuoe LStdio
Hinceude LStoldb- h>

ivt *pmalloc (1oty );


ntR
4en (l-o ;lcio;l++)

Date5/sl Pgno:4 RPajau


Name RV Ragaui Ceyccode:18LCOY
Rolnum:20L339. CewUe name: Adwaned C Drorammun
Scane Crd",ap[);

eh-9;L>=o ;R--)

privnt Crd", P[LJ);

ee Cp)

ouout 6 7 891o
23 S
Lo 9 8 76 5 y 32

20 D fgets)
entine fle Cevtent
to 9uead

Smtax

fqets (Van, ugt,SP


Sqets (dan *a int ine FIUE *SP);
Proham
tnceude stdio. h>

mainC)

FILE +pi
=
fopen Ctle 1tct, "wt );
Date: sl8/21 Pgno: 1S PV Ragou
Narme R V. Ragaw Cewveuode 18Lc Oy
Cewse name: PdWamed CProramnAng
Rolnum'20L339
t t ",o);
FILEp2 fepen C" fle 2
fpmnt Cp1, "fdvanued C Progham);
Clhan aCioo],
euwund P D

fgetaCa,too, Jp), (( Pead Gule Content hom tiel-tt


prin (fp2."s', a);
putsCa)
fcloseall0;

Ouutpuit
Phdonced CProam

i)epenc)
epen a nes tie (O) existing hde
Supmtay
ptr openflename, Mode o6 operahbn );
Proamn
wute a content favanced intd a hle
tinclude / Stdio h7
main ()

FILE+$P
fpfopen C pdvamced',"w");
fprinth CtP dwanced
ylose(Sp);
Date: 5/8/21 P9no: 16 RV Ragaui
Nane P:VRagawi Cowyecode 18LCoy
Ceuye ame Pdwonced C Oroenammun
Rouunm: 2o331.
ile veateo
Advonoed
Pdvanced
t fprintg 0
wibe ttie centent n t o a fule

Spata
print CHP. FS Van oluue),

Exomple
pmint CHp. Pruo97ram)
4printt (H,"S", Duogram),
Poam
wwte a_Content Progpam Intoa hle
tincludL Lstdio.h>
maun

FILE SP
p fepen poram.bat,w)
pmint CAp puoam
Lose (Sp)

F lO
eueated
B0gam. txt
Proam
Date'S8l21 Pgno: RV Ragow
Name: RV.Rapui CBueode: 18UOy
RoUnwm: 20L331. Ceuove name: pdwoned CCrogrammang

iv)fscant)
Pead fne
uentbent bm tile

Supntay
scaung Gp. FS,qvan),

PrOgham and e n read


cebent AcP Anto a e
Iwwwte a
and diplay he tle centent
e covmtent nom l e
inbo euuput Aoeen

n c u d e Lstdio:h>

Ymaun C)

FILE p =jepenC Kee .tt", "w')


CnanoloD]
fprintß Hp, "fcp" )
fdoe (P)
sp-openC Cce tet ", "Y,
fscang 4p ,"s"1a);
puuds (a)
fclose Cp)
Output
fcp
Frle create
Cce.t

Date.5 2 Pgno: 1 R-VRagw.

You might also like