Vous êtes sur la page 1sur 8

All theses are Downloaded from www.Freshersworld.

com/papers Check this


site for more papers on Sonata.
C TEST
Sonata Software
1. Point out error, if any, in the following program
main()
{
int i=1;
switch(i)
{
case 1:
printf("\na!ioacti"e cats ha"e 1# half$li"es");
%rea&;
case 1'()*:
printf("\n+ottle for rent $in,uire within");
%rea&;
-
-
.ns. /o error. 0onstant e1pression li&e 1'()* are accepta%le in cases of a switch.
(. Point out the error, if any, in the following program
main()
{
int a=12,%;
a3= 4 5 %=122 : %=(22;
printf("\n6!",%);
-
.ns. l"alue re,uire! in function main(). 7he secon! assignment shoul! %e written in
parenthesis as follows:
a3= 4 5 %=122 : (%=(22);
8. 9n the following co!e, in which or!er the functions woul! %e calle!5
a= f1((8,1*)'f((1(:*))f8();
a) f1, f(, f8 %) f8, f(, f1
c) 7he or!er may "ary from compiler to compiler !) /one of the a%o"e
*. ;hat woul! %e the output of the following program5
main()
{
int i=*;
switch(i)
{
!efault:
printf("\n . mouse is an elephant %uilt %y the <apanese");
case 1:
printf(" +ree!ing ra%%its is a hair raising e1perience");
%rea&;
case (:
printf("\n =riction is a !rag");
%rea&;
case 8:
printf("\n 9f practice ma&e perfect, then no%o!y>s perfect");
-
-
a) . mouse is an elephant %uilt %y the <apanese %) +ree!ing ra%%its is a hare raising
e1perience
c) .ll of the a%o"e !) /one of the a%o"e
4. ;hat is the output of the following program5
?!efine @A(1) (1'1)
main()
{
int a,%=8;
a= @A(%)();
printf("6!",a);
-
a) (4 %) 11 c) error !) gar%age "alue
B. 9n which line of the following, an error woul! %e reporte!5
1. ?!efine 090CD() (8.1*'');
(. main()
8. {
*. float r=1.2,c;
4. c= 090CD(r);
B. printf("\n6f",c);
E. if(090CD(r))==B.(#)
#. printf("\nFo%%le!ygoo&");
G. -
a) line 1 %) line 4 c) line B !) line E
E. ;hat is the type of the "aria%le % in the following !eclaration5
?!efine =HI.7P7 float'
=HI.7P7 a,%;
a) float %) float pointer c) int !) int pointer
#. 9n the following co!e;
?inclu!eJst!io.h3
main()
{
=9HK 'fp;
fp= fopen("trial","r");
-
fp points to:
a) 7he first character in the file.
%) . structure which contains a "char" pointer which points to the first character in the file.
c) 7he name of the file. !) /one of the a%o"e.
G. ;e shoul! not rea! after a write to a file without an inter"ening call to fflush(), fsee&() or
rewin!() J 7CK:=.H@K3
.ns. 7rue
12. 9f the program (myprog) is run from the comman! line as myprog 1 ( 8 , ;hat woul! %e
the output5
main(int argc, char 'arg"LM)
{
int i;
for(i=2;iJargc;i)))
printf("6s",arg"LiM);
-
a) 1 ( 8 %) 0:\DNPIF.KOK 1 ( 8
c) DNP !) /one of the a%o"e
11. 9f the following program (myprog) is run from the comman! line as myprog 1 ( 8, ;hat
woul! %e the output5
main(int argc, char 'arg"LM)
{
int i,P=2;
for(i=2;iJargc;i)))
P=P) atoi(arg"LiM);
printf("6!",P);
-
a) 1 ( 8 %) B c) error !) "1(8"
1(. 9f the following program (myprog) is run from the comman! line as myprog mon!ay
tues!ay we!nes!ay thurs!ay,
;hat woul! %e the output5
main(int argc, char 'arg"LM)
{
while($$argc 32)
printf("6s",'))arg");
-
a) myprog mon!ay tues!ay we!nes!ay thurs!ay %) mon!ay tues!ay we!nes!ay thurs!ay
c) myprog tues!ay thurs!ay !) /one of the a%o"e
18. 9n the following co!e, is p( an integer or an integer pointer5
type!ef int' ptr
ptr p1,p(;
.ns. 9nteger pointer
1*. Point out the error in the following program
main()
{
const int 1;
1=1(#;
printf("6!",1);
-
.ns. 1 shoul! ha"e %een initialiQe! where it is !eclare!.
14. ;hat woul! %e the output of the following program5
main()
{
int y=1(#;
const int 1=y;
printf("6!",1);
-
a) 1(# %) Far%age "alue c) Krror !) 2
1B. ;hat is the !ifference %etween the following !eclarations5
const char 's;
char const 's;
.ns. /o !ifference
1E. ;hat is the !ifference %etween the following !eclarations5
const char 'const s; char const 'const s;
.ns. /o !ifference
1#. ;hat woul! %e the output of the following program5
main()
{
char near ' near 'ptr1;
char near ' far 'ptr(;
char near ' huge 'ptr8;
printf("6! 6! 6!",siQeof(ptr1),siQeof(ptr(),siQeof(ptr8));
-
a) 1 1 1 %) 1 ( * c) ( * * !) * * *
1G. 9f the following program (myprog) is run from the comman! line as myprog fri!ay tues!ay
sun!ay,
;hat woul! %e the output5
main(int argc, char'arg"LM)
{
printf("6c",''))arg");
-
a) m %) f c) myprog !) fri!ay
(2. 9f the following program (myprog) is run from the comman! line as myprog fri!ay tues!ay
sun!ay,
;hat woul! %e the output5
main(int argc, char 'arg"LM)
{
printf("6c",'))arg"L1M);
-
a) r %) f c) m !) y
(1. 9f the following program (myprog) is run from the comman! line as myprog fri!ay tues!ay
sun!ay,
;hat woul! %e the output5
main(int argc, char 'arg"LM)
{
while(siQeofarg")
printf("6s",arg"L$$siQeofarg"M);
-
a) myprog fri!ay tues!ay sun!ay %) myprog fri!ay tues!ay
c) sun!ay tues!ay fri!ay myprog !) sun!ay tues!ay fri!ay
((. Point out the error in the following program
main()
{
int a=12;
"oi! f();
a=f();
printf("\n6!",a);
-
"oi! f()
{
printf("\nRi");
-
.ns. 7he program is trying to collect the "alue of a ""oi!" function into an integer "aria%le.
(8. 9n the following program how woul! you print 42 using p5
main()
{
int aLM={12, (2, 82, *2, 42-;
char 'p;
p= (char') a;
-
.ns. printf("\n6!",'((int')p)*));
(*. ;oul! the following program compile5
main()
{
int a=12,'P;
"oi! '&;J +3 P=&=Sa;
P));
&));
printf("\n6u6u",P,&);
-
a) Nes %) /o, the format is incorrect
c) /o, the arithmetic operation is not permitte! on "oi! pointers
!) /o, the arithmetic operation is not permitte! on pointers
(4. .ccor!ing to ./@9 specifications which is the correct way of !eclaring main() when it
recei"es comman! line arguments5
a) main(int argc, char 'arg"LM) %) main(argc,arg") int argc; char 'arg"LM;
c) main() {int argc; char 'arg"LM; - !) /one of the a%o"e
(B. ;hat error woul! the following function gi"e on compilation5
f(int a, int %)
{
int a;
a=(2;
return a;
-
a) missing parenthesis in the return statement %) 7he function shoul! %e !eclare! as int f(int
a, int %)
c) re!eclaration of a !) /one of the a%o"e
(E. Point out the error in the following program
main()
{
const char 'fun();
'fun()=>.>;
-
const char 'fun()
{
return "Rello";
-
.ns. fun() returns to a "const char" pointer which cannot %e mo!ifie!
(#. ;hat woul! %e the output of the following program5
main()
{
const int 1=4;
int 'ptr1;
ptr1=S1;
'ptr1=12;
printf("6!",1);
-
a) 4 %) 12 c) Krror !) Far%age "alue
(G. . switch statement cannot inclu!e
a) constants as arguments %) constant e1pression as arguments
c) string as an argument !) /one of the a%o"e
82. Row long the following program will run5
main()
{
printf("\n@onata @oftware");
main();
-
a) infinite loop %) until the stac& o"erflows
c) .ll of the a%o"e !) /one of the a%o"e
81. In com%ining the following statements, you will get char'p; p=malloc(122);
a) char 'p= malloc(122) %) p= (char')malloc(122)
c) .ll of the a%o"e !) /one of the a%o"e
8(. ;hat is the output of the following program5
main()
{
int n=4;
printf("\nn=6'!",n,n);
-
a) n=4 %) n=4
c) n= 4 !) error
Sonata Software
1. Hast month of an year
(a) <anuary (%) =e%ruary (c) Tecem%er (!) /o"em%er
(. @elect the o!! one
(a) <anuary (%) =e%ruary (c) ;e!nes!ay (!) /o"em%er
8. @elect the antonym of capture from the following
(a) attac& (%) elease (c) con!emn (!) /one of the a%o"e
*. =in! the antonym of autumn
(a) @pring (%) ;inter (c) @ummer (!) /one of the a%o"e
4. Ine s&irt re,uires 8.E4 yar!s of cloth. Row many s&irts you can ma&e from *4 yar!s5
.ns: 1( s&irts
B. Row can you ma&e a s,uare from two triangles5
E. 9s the meaning of 0lient an! 0ustomer,
(a) same (%) contra!ictory (c) no relation
#. 9s the meaning of 9t>s an! 9ts,
(a) same (%) contra!ictory (c) no relation
G. 9s the meaning of 0an"as an! 0an"ass,
(a) same (%) contra!ictory (c) no relation
12. 9s the meaning of 9ngenious an! 9ngenuous,
(a) same (%) contra!ictory (c) no relation
11. 9s the meaning of 0re!i%le an! 0re!ulous,
(a) same (%) contra!ictory (c) no relation
1(. @elect the o!! one out.
(a) 1:* (%) 1:8 (c) 1:B (!) 1:1#
18. @elect the least from the following.
(a) 2.GG (%) 1 (c) #1 (!) 2.888
1*. =in! the ne1t num%er in the series. 1, 2.4, 2.(4, 2.1(4
.ns: 2.2B(4
14. Ine !ollar is sa"e! in one month. 7hen how much !ollar is sa"e! in one !ay5
.ns: 1:82 =2.2888U
1B. N catches 4 times more fishes than O. 9f total num%er of fishes caught %y O an! N is *#,
then num%er of fishes caught %y O5
.ns: #
1E. N catches 4 times more fishes than O. 9f total num%er of fishes caught %y O an! N is *(,
then num%er of fishes caught %y O5
.ns: E
1#. 9f a train co"ers B22m in 2.4 secon!s, how long it will co"er in 12 secon!s5
.ns: 8222m = 8&m
1G. 7he girl>s age is twice that of %oy, if the %oy is four years ol!. .fter four years the age
of the girl is
.ns: 1( years
(2. @ister>s age is twice than that of the %rother. 9f the %rother>s age is si1, what is the sister>s
age after two years5
.ns: 1* Nrs.
(1. 7wo lemons cost 12 cents. 7hen one an! a half !oQen cost
.ns: G2 cents
((. . cloc& is late %y 1 minute (E secon!s in a month. 7hen how much will it %e late in 1 !ay5
.ns: (.G secon!s
(8. ;hich of the following figures together will ma&e a triangle5
.ns: a,%,c,!
(*. Da&e a s,uare %y !rawing only one line
.ns: line ($4, s,uare ($8$*$4$(
(4. ;hich of the following is the o!! one5 crew, constellation, companion, league,
participants.
.ns: companion
(B. Ipposite of emote5
(a) =ar (%) /ear (c) Ruge (!) Village
(E. @tatement .: .ll great men are ri!iculous;
@tatement +: 9 am ri!iculous ;
9nference : 9 am a great man;
(a) 7rue (%) =alse (c) /ot clear
(#. @tatement: /ormal chil!ren are acti"e;
9nference: .ll chil!ren are acti"e;
(a) 7rue (%) =alse (c) Cncertain
(G. /e1t num%er in the series 1, 1:(, 1:*, 1:# 5
.ns: 1:1B
82. 9n B secon!s a light flashes once. 9n one hour how many times it will flash5
.ns: B21 times
81. .t (26 !iscount, a cycle is sol! at a selling price of (422 s. ;hat is the actual price5
.ns: s. 81(4
8(. @tatement .: . S + ha"e same age;
@tatement +: + is younger than 0;
9nference : . is younger than 0;
(a) 7rue (%) =alse (c) Cncertain
88. .ll chic&ens lay eggs (7rue:=alse)
.ns: =alse
8*. . in"ests U1(222, + in"ests U#222, 0 in"ests UB222 an! they got a profit of U1(22. Row
much share . got more than + an! 05
.ns: (:18 an! 8:18

Vous aimerez peut-être aussi