0% found this document useful (0 votes)
110 views14 pages

Network Analysis

The document contains multiple choice questions about C programming concepts. It tests knowledge of topics like data types, operators, functions, loops, and logic. The correct answers are provided for each question.

Uploaded by

Pankaj Kale
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)
110 views14 pages

Network Analysis

The document contains multiple choice questions about C programming concepts. It tests knowledge of topics like data types, operators, functions, loops, and logic. The correct answers are provided for each question.

Uploaded by

Pankaj Kale
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/ 14

1.

Whi
chof
thef
ol
lowi
ngs
tat
eme
ntss
hou
ldbeu
sedt
oobt
ai
nar
emai
nde
raf
t
erdi
vi
di
ng3.
14by2.
1?

A.
rem=3.14%2. 1;
B.
rem=modf (
3.14,
2.1)
;
C.
rem=fmod(3.14,
2.1)
;
D.
Remai
ndercannotbeobt
ai
ninf
l
oat
i
ngpoi
ntdi
vi
si
on.
Ans
wer:
OptionC

2.
What
aret
het
ype
sof
li
nkage
s?

A.
Int
er
nalan
dE x
ter
nal B.
Ext
ern
al,
Int
er
nal
andNon
e
C.
Ext
ern
alandNone D.
Int
er
nal
An
swer:Opt
ionB

3.
Whi
chof
thef
ol
lowi
ngs
pec
ial
symbol
all
owe
dinav
ari
abl
ename
?

A.
*(ast
er
is
k) B.
|(pi
pel
i
ne)
C.
-(h
yphen
) D.
_(un
der
scor
e)
An
swer:
OptionD

4.
Ist
her
ean
ydi
f
fer
enc
ebe
twe
enf
ol
lowi
ngde
clar
at
ion
s?

1:ex
ter
nintf
un(
);
2:i
ntf
un(
);
A.
Botharei
dent
ical
B.
Nodi f
fer
ence
,e x
ce e
ptxt
er
nint
fun
();
ispr
obabl
yinan
oth
erf
i
le
i
C.nt
fun(
);i
sover
ri
dedwihe
t xt
er
nint
fun(
);
D.
Non eofth
ese
Ans
wer:Opti
onB

5.
Byde
fau
ltar
eal
numbe
rist
r
eat
edasa

A.
fl
oat B.
double
C.
lon
gdoubl
e D.
fardoubl
e
An
swer:
Opti
onB

6.I
sth
efol
lowi
ngs
tat
eme
ntade
clar
at
ionorde
fi
ni
t
ion
?
ex
ter
nint
i;

A.
Decl
arat
i
on B.
Defi
ni
t
ion
C.
Fun
cti
on D.
Err
or
An
swer:
Opti
onA

7.
Whe
nweme
nti
ont
hepr
ot
ot
ypeof
afu
nct
i
on?
A.
De f
i
nin
g B.
Dec
lar
in
g
C.
Prot
oty
pin
g D.
Cal
l
ing
An
swer:Opti
onB

8.
What
wil
lbet
heou
tpu
tof
thepr
ogr
ami
n16bi
tpl
at
for
m(T
urboCu
nde
rDOS)
?

#i
nclude<st
di
o.h
>
i
ntmain()
{
ext
e r
ninti
;
i=20;
pri
ntf
("
%d\n",s
iz
eof
(
i)
);
re
turn0;
}
A.
2
B.
4
C.
varyf
romc ompi
le
r
D.
Li
nkerEr
ror:Undef
in
eds
y '
mboli
'
Ans
we r
:Opti
onD

9.
What
ist
heou
tpu
tof
thepr
ogr
am?

#i
nclude<st
dio.
h>
i
ntmain()
{
ext
e r
ninta;
pri
ntf
("
%d\n "
,a)
;
re
turn0;
}
i
nta=20;

An
swe
r:Opt
i
onA

10.
What
ist
heou
tpu
tof
thepr
ogr
am

#i
nclude<stdi
o.h>
i
ntmain()
{
st
ru
c temp
{
charn ame[20];
i
n tage ;
f
loat s
al;
}
;
st
ru
c tempe={ "T
iger
"}
;
pri
ntf
("%d,%f\n",
e .
age,
e.s
al)
;
re
turn0;
}
A.
0,0.000000 B.
Gar
bagevalu
es
C.
Err
or D.
Non
eof abov
e
An
swe
r:Opt
i
onA

11.
Howman
yti
mes"
Indi
aBI
X"i
sge
tpr
i
nte
d?

#i
ncl
u de <st
di
o.h>
i
ntmain()
{
i
ntx;
f
or(x=-1;x<=10;x
++)
{
i
f(x<5)
conti
nue;
else
break;
printf
(
"Indi
aBI
X")
;
}
r
et
u rn0;
}

A.
Inf
i
nit
eti
mesB.
11t
i
mesC.
0ti
mesD.
10t
i
me

An
swe
r:Opt
i
onC

12.
Whi
chof
thef
ol
lowi
ngi
snot
logi
cal
ope
rat
or
?

A.
& B.
&&
C.
|| D.
!

An
swe
r:Opt
i
onA

13.
Inmat
hemat
i
csan
dcompu
terpr
ogr
ammi
ng,
whi
chi
st
hec
orr
ect
orde
rof
mat
hemat
i
cal
ope
rat
or
s?

A.
Addit
ion,Subt
ract
ion,Mult
i
pli
cat
i
on,Di
vis
ion
B.
Divi
si
on,Mu lt
i
pli
cati
on,Addi
ti
on,
Subtr
act
ion
C.
Mu l
ti
pli
cati
on,Addit
ion
,Divi
si
on,
Subtr
act
ion
D.
Addit
ion,Div
is
ion,Modu l
us,
Subt
rac
ti
on
Ans
wer:Opt i
onB

14.
Whi
chof
thef
ol
lowi
ngc
ann
otbec
hec
ke nas
di wit
ch-
cas
est
at
eme
nt?

A.
Char
act
er B.
Int
ege
r
C.
Fl
oat D.
enum
An
swer
:Opt
ionC

15.
What
wil
lbet
heou
tpu
tof
thepr
ogr
am?
#i
ncl
u de<st
di
o.h>
i
ntmain()
{
i
nti
=0;
f
or(;i
<=5;i++)
;
pri
ntf
(
"%d",i
);
r
et
u rn0;
}

An
swe
r:Opt
i
onD

16.
What
wil
lbet
heou
tpu
tof
thepr
ogr
am?

#i
nclude<st
di
o.
h>
i
ntmain()
{
uns
ignedint
i=65535;
/*As
sume2by
tei
nt
ege
r*/
whil
e(i
++!=0)
pri
ntf
("
%d",
++i
)
;
pri
ntf
("
\n")
;
re
turn0;
}
A.
I
nf
in
it
eloop
B.
012.
.
.65535C.
012.
.
.32767-
32766-
32765-
10D.
Noou
tpu
t

An
swe
r:Opt
i
onA

16.
What
wil
lbet
heou
tpu
tof
thepr
ogr
am?

#i
nc l
u de<st
di
o.h>
i
ntmai n()
{
i
nt x=3;
f
loat y=3. 0;
i
f(x==y )
pri
ntf
(
"xandyar
eequ
al"
);
else
pri
ntf
(
"xandyar
enot
equal
")
;
r
e t
u rn0;
}
A.
xandyar
eequ
al
B.
xan
dyar
enot
equ
alC.
Unpr
edi
ct
abl
eD.
Noou
tpu
t

An
swe
r:Opt
i
onA

17.
What
wil
lbet
heou
tpu
tof
thepr
ogr
am?

#i
ncl
ude
<st
di
o.
h>
i
ntmai n(
)
{
f
loat a=0.7;
i
f(0.7>a)
pr
int
f
("Hi
\n")
;
else
pr
int
f
("Hel
l
o\n")
;
r
e t
u r
n0;
}
A.
Hi B.
Hel
l
o
Noneof
abov
e
C.
HiHe
ll
o D.

An
swe
r:Opt
i
onA

18.
Poi
ntou
tth
eer
ror
,i
fan
yint
hef
orl
oop.

#i
ncl
u de<st
di
o.
h>
i
ntmain()
{
i
nti
=1;
f
or(;
;)
{
pri
ntf
("
%d\n"
,i
++)
;
i
f(i
>10)
bre
ak;
}
r
et
u rn0;
}

A.Th
eres
houl
dbeac
ondi
t
ioni
ntheforl
oopB.T
het
wos
emi
col
onss
hou
ldbedr
oppe
dC.
Thef
orl
oop
sh
oul
dberepl
ace
dwi
thwh
il
eloop.D.Noerr
or

An
swe
r:Opt
i
onD

19.
Poi
ntou
tth
eer
ror
,i
fan
yint
hepr
ogr
am.

#i
nclude<st
dio.
h>
i
ntmain()
{
i
nta=10;
swi
tch(a)
{
}
pri
ntf
("
T h
isi
scprogr
am.
")
;
ret
urn0;
}
A.
Err
orNoc
: ases
tat
eme
nts
pec
if
ie
dB.
Err
orNode
: fau
lts
pec
if
ie
dC.
NoE
rr
o

r
D.E
rr
or:
inf
i
nit
eloopoc
cur
s

An
swe
r:Opt
i
onC
20.
Poi
ntou
tth
eer
ror
,i
fan
yint
hewh
il
eloop.

#i
ncl
u de<st
di
o.
h>
i
ntmain()
{
i
nti
=1;
whil
e()
{
pri
ntf
("
%d\n"
,i
++)
;
i
f(i
>10)
bre
ak;
}
r
et
u rn0;
}

A.T
her
esh
oul
dbeac ondi
t
ionint
hewhil
eloopB.T
her
esh
oul
dbeat
leas
tas
emi
col
oni
ntewh
h il
eC.
Thewh
il
e
l
oopsh
oul
dbere
plac
e dwi
thforl
oop.
D.Noe rr
or

An
swe
r:Opt
i
onA

21.
Whi
chof
thef
ol
lowi
ngi
st
hec
orr
ect
usageof
con
dit
i
onal
ope
rat
or
sus
edi
nC?

A.
a>b?c=30:
c=40; B.
a>b?c =30;
C.
max=a>b?a>c?
a:c
:b>c
?b:
c D.
ret
ur
n(a>b)?
(a:
b)

An
swe
r:Opt
i
onC

22.
Whi
chof
thef
ol
lowi
ngar
eun
aryope
rat
or
sinC?

1.
!
2.
si
zeof
3.
~
4.
&&
A.
1,2 B.
1,3
C.
2,4 D.
1,2,3
An
swer:
Opt
i
onD

23.I
nwh i
chst
agethefol
l
owin
gcode
#i
ncl
ude<st
di
o.h
>
get
sre
placedbyth
ec ont
ent
soft
hef
i
les
tdi
o.
h

A.
Dur
i
ngedi
t
ing B.
Dur
i
ngl
in
kin
g
C.
Dur
i
ngexe
cut
ion D.
Dur
i
ngpr
eproc
ess
in
g
An
swer
:Opt
i
onD
24.

Whatwi
ll
happeni
fi
naCpr
ogr
amy
ouas
si
gnav
alu
etoanar
raye
leme
ntwh
oses
ubs
cri
pte
xce
eds
t
hesi
zeofar
ray
?

A.
Theel
e me
n t
wil
lbesett
o0.
B.
Thecompil
erwoul
drepor
tane r
ror.
C.
Theprogr
ammayc r
ashifsomeimport
ant
dat
age
tsov
erwr
i
tt
en.
D.
Thearr
aysiz
ewou l
dappropri
at
elygrow.
Ans
wer:Opt
ionC

25.
What
aret
hedi
f
fer
ent
type
sof
real
dat
aty
pei
nC?

A.
fl
oat
,doubl
e B.
shor
ti
nt
,doubl
e,l
ongi
nt
C.
fl
oat
,doubl
e,l
ongdou
ble D.
doubl
e,l
ongin
t,f
l
oat
An
swer
: Opti
onC

26.
Whi
chs
tat
eme
ntwi
l
lyouaddi
nth
efol
l
owi
ngpr
ogr
amt
owor
kit
cor
rec
tl
y?

#i
nclude<st
di
o.h
>
i
ntmain()
{
pri
ntf
("
%f\n"
,l
og(
36.
0))
;
re
turn0;
}

A.
#in
clu
de<c
onio.
h> B.
#in
clu
de<mat
h.
h>
C.
#in
clu
de<s
tdl
i
b.h
> D.
#in
clu
de<dos
.h
>
An
swer:
Opti
onB

27.
Ach
arac
terv
ari
abl
ecans
tor
e xc
har
act
er
sat
ati
me:

A.

1c
har
act
er

B.

8c
har
act
er

C.

256c
har
act
er

D.
Non
eof
theabov
e

Cor
rec
tan
swe
ris:
A

28.
Clan
guagewasde
vel
ope
dby
?

A.

De
nni
sRi
chi
e

B.

Mar
t
inR
ich
ards

C.

Bi
l
lGat
es

D.

Ke
nTh
omps
on

Cor
rec
tan
swe
ris:
A

29.
Ide
nti
f
ywh
ichar
ede
clar
at
ion
s?(
sel
ect
2)

A.

dou
blepow(
dou
ble
,dou
ble
);

B.

f
l
oat
squ
ar(
f
loat
a){
}

C.

f
l
oat
b;

✓D.

e
xte
rni
nta;

Cor
rec
tan
swe
ris:
A,D

30.
What
ist
heou
tpu
tof
:
#i
nclude<st
di
o.h>
i
ntmain()
{
 
  
 i
ntx=40;
 
  
 {
 
  
  
  
 i
n tx
=20;
 
  
  
  
 pri
ntf
("
%d",x
)
;
 
  
 }
 
  
 pri
ntf
("
%d",x
);
 
  
 re
turn0;
}
A.

4040

B.

2040

C.

4020

D.

Compi
l
ati
onE
rr
or

Cor
rec
tan
swe
ris:
B

31.
What
ist
heou
tpu
tof
thef
ol
lowi
ngpr
ogr
am?

v
oidmain()
{
 
  
 i
ntc=1;
 
  
 whil
e(
c<100)
 
  
  
  
 pri
nt
f(
"%d"
,c)
;
 
  
  
  
 c++;
}
A.

pr
i
ntst
hen
umbe
rsf
r
om1t
o99.

B.

I
nf
in
it
eLoop

C.
Compi
l
ati
onE
rr
or

D.

pr
i
ntst
hen
umbe
rsf
r
om1t
o100

Cor
rec
tan
swe
ris:
B

32.
What
ist
heou
tpu
tof
:

main()
{
f
loata=5,b=2;
i
ntc;
c=a%b;
pri
nt
f("%d"
,c);
}
A.

B.

C.

D.

Compi
l
eTi
meE
rr
or

Cor
rec
tan
swe
ris:
D

33.
Thek
eywor
dus
edt
otr
ans
ferc
ont
r
olf
r
omaf
unc
ti
onbac
ktot
hec
all
i
ngf
unc
ti
oni
s

A.
swi
t
ch B.
got
o
C.
gobac
k D.
ret
ur
n

An
swe
r:Opt
i
onD

34.#i
ncl
ude<s
tdi
o.
h>
i
ntadd(
i
nt,i
nt
);
/*F u
nct
i
onpr
ot
ot
ype*/

i
ntmai
n(
)
{
i
nta=4, b=3,c;
c=add(a,b)
;
pri
nt
f(
"c=%d\n"
,c)
;
re
tur
n0;
}
i
ntadd(i
nta,i
ntb)
{
/*ret
urnsth
evalu
ean
dcon
tr
olbac
ktomai
n(
)fu
nct
i
on*/
ret
urn(
a+b);
}

35.
Whi
chof
thef
ol
lowi
ngs
tat
eme
ntsar
ecor
rec
tabou
tth
epr
ogr
am?

#i
ncl
ude
<st
di
o.
h>

i
ntmain(
)
{
pri
nt
f(
"%p\n
",mai
n(
))
;
re
tur
n0;
}
A.
Itpri
nt
sgarbageval
uesi
n f
i
nit
el
y
B.
Run si
nfi
ni
t
elywit
hou
tpri
nti
nganyt
hi
ng
C.
Errormai
: n()c
annot
bec al
ledi
nsdepr
i in
tf
()
D.
NoE rr
orandpri
ntn
othi
ng
Ans
we r:Opti
onB

36.
her
eisae
rrori
nth
ebe
lowpr
ogr
am.
Whi
chs
tat
eme
ntwi
l
lyouaddt
ore
mov
eit
?

#i
ncl
ude
<st
di
o.
h>

i
ntmain(
)
{
i
nta;
a=f (
10, 3.
14);
pri
nt
f(
"%d\n ",
a);
re
tur
n0;
}
f
l
oat f
(i
ntaa, f
l
oatbb)
{
re
tur
n((f
loat)
aa+bb);
}
A.
Addprot
ot
ype
:fl
oat
f(
aa,bb)
B.
Addprot
ot
ype
:fl
oat
f(
in
t,f
l
oat)
C.
Addprot
ot
ype
:fl
oat
f(
fl
oat
,in
t)
D.
Addprot
ot
ype
:fl
oat
f(
bb,aa)
Ans
wer
:Opti
onB

37.
Whi
chof
thef
ol
lowi
ngs
tat
eme
ntsar
ecor
rec
tabou
tth
efu
nct
i
on?
l
ongfun(
in
tnum)
{
i
nti
;
l
ongf=1;
f
or
(i
=1; i
<=nu
m;i
++)
f
=f *i;
r
et
urnf;
}
A.
Thef
unc
ti
oncal
cul
at
est
hev
alu
eof 1rai
sedtopowernum.
B.
Thef
unc
ti
oncal
cul
at
est
hes
quar
erootofanint
eger
C.
Thef
unc
ti
oncal
cul
at
est
hef
act
ori
alval
ueofanint
eger
D.
Noneofabov
e
Ans
wer
:Opti
onC

38.
Poi
ntou
tth
eer
rori
nth
epr
ogr
am

f
(
inta,i
ntb)
{
i
nta;
a=20;
r
etur
na;
}
A.
Mi s
si
ngparen
the
si nr
si e
tur
nstat
ement
B.
Thefunc
ti
onshou
ldbedefi
nedasin
tf(
i
nta,
int
b)
C.
Redecl
arat
i
onofa
D.
Non eofabov
e
Ans
we r
:Opti
onC

39.
Poi
ntou
tth
eer
rori
nth
epr
ogr
am

#i
ncl
ude
<st
di
o.
h>

i
ntmain(
)
{
i
nta=10;
voi
df()
;
a=f (
);
pri
nt
f(
"%d\n"
,a)
;
ret
ur
n0;
}
v
oidf()
{
pri
nt
f(
"Hi
");
}
A.
Er
ror
:Notal
l
owedassi
gnment
B.Er
ror
:Doe
sn'
tpr
i
ntanyt
hi
ngC.Noe
rror
D.Non
eof
abov
e

An
swe
r:Opt
i
onA
41.
What
aret
het
ype
sof
li
nkage
s?

A.
Int
er
nalan
dE x
ter
nal B.
Ext
ern
al,
Int
er
nal
andNon
e
C.
Ext
ern
alandNone D.
Int
er
nal
An
swer:Opt
ionB

42.
Whi
chof
thef
ol
lowi
ngs
pec
ial
symbol
all
owe
dinav
ari
abl
ename
?

A.
*(ast
er
is
k) B.
|(pi
pel
i
ne)
C.
-(h
yphen
) D.
_(un
der
scor
e)
An
swer:
OptionD

43.
Wh at
wil
lhappe
nif
inaCpr
ogr
amy
ouas
si
gnav
alu
etoanar
raye
leme
ntwh
oses
ubs
cri
pte
xce
eds
t
hesi
zeofar
ray?

A.
Theel
e me
n t
wil
lbesett
o0.
B.
Thecompil
erwoul
drepor
tane r
ror.
C.
Theprogr
ammayc r
ashifsomeimport
ant
dat
age
tsov
erwr
i
tt
en.
D.
Thearr
aysiz
ewou l
dappropri
at
elygrow.
Ans
wer:Opt
ionC

44.
.Wh
atar
eth
edi
f
fer
ent
type
sof
real
dat
aty
pei
nC?

A.
fl
oat
,doubl
e B.
shor
ti
nt
,doubl
e,l
ongi
nt
C.
fl
oat
,doubl
e,l
ongdou
ble D.
doubl
e,l
ongin
t,f
l
oat
An
swer
: Opti
onC

45.
Whi
chof
thef
ol
lowi
ngi
st
hec
orr
ect
usageof
con
dit
i
onal
ope
rat
or
sus
edi
nC?

A.
a>b?c=30:
c=40; B.
a>b?c =30;
C.
max=a>b?a>c?
a:c
:b>c
?b:
c D.
ret
ur
n(a>b)?
(a:
b)

An
swe
r:Opt
i
onC

46.
Whi
chof
thef
ol
lowi
ngar
eun
aryope
rat
or
sinC?

1.
!
2.
si
zeof
3.
~
4.
&&
A.
1,2 B.
1,3
C.
2,4 D.
1,2,3
An
swer:
Opt
i
onD
47.I
nwh i
chst
agethefol
l
owin
gcode
#i
ncl
ude<st
di
o.h
>
get
sre
placedbyth
ec ont
ent
soft
hef
i
les
tdi
o.
h

A.
Dur
i
ngedi
t
ing B.
Dur
i
ngl
in
kin
g
C.
Dur
i
ngexe
cut
ion D.
Dur
i
ngpr
eproc
ess
in
g
An
swer
:Opt
i
onD

48.

Whatwi
ll
happeni
fi
naCpr
ogr
amy
ouas
si
gnav
alu
etoanar
raye
leme
ntwh
oses
ubs
cri
pte
xce
eds
t
hesi
zeofar
ray
?

A.
Theel
e me
n t
wil
lbesett
o0.
B.
Thecompil
erwoul
drepor
tane r
ror.
C.
Theprogr
ammayc r
ashifsomeimport
ant
dat
age
tsov
erwr
i
tt
en.
D.
Thearr
aysiz
ewou l
dappropri
at
elygrow.
Ans
wer:Opt
ionC

49.
What
aret
hedi
f
fer
ent
type
sof
real
dat
aty
pei
nC?

A.f
l
oat
,doubl
e B.shor
ti
nt
,doubl
e,l
ongint
C.f
l
oat
,doubl
e ,
lon
gdoubl
e D.doubl
e,l
ongin
t,f
l
oat
50.Whatwil
lbeth
eout
putof
thepr
ogr
ami
n16bi
tpl
at
for
m(Tur
boCu nderDOS)
?

#i
nclude<st
di
o.h
>
i
ntmain()
{
ext
e r
ninti
;
i=20;
pri
ntf
("
%d\n",s
iz
eof
(
i)
);
re
turn0;
}
A.
2
B.
4
C.
varyf
romc ompi
le
r
D.
Li
nkerEr
ror:Undef
in
eds
y '
mboli
'
Ans
we r
:Opti
onD

You might also like