Result of the following program is
main()
{
int i=0;
for(i=0;i<20;i++)
{
switch(i)
case 0:i+=5;
case 1:i+=2;
case 5:i+=5;
default i+=4;
break;}
printf("%d,",i);
}
}
a)0,5,9,13,17
b)5,9,13,17
c)12,17,22
d)16,21
e)syntax error

Answer Posted / sankar

Answer is (e) Option : Syntax error

void main()
{
int i=0;
for(i=0;i<20;i++)
{
switch(i)
case 0:i+=5; // this is illegal
case 1:i+=2; // this is illegal
case 5:i+=5; // this is illegal
default i+=4; // Colon is missing
break;
}
printf("%d,",i);
}
} // This is extra braces

Is This Answer Correct ?    4 Yes 6 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

write a c program for swapping two strings using pointer

2090


What does c mean in standard form?

593


What is main function in c?

543


What is mean by Data Driven framework in QTP? Can any one answer me in details on this regard.

1779


What is use of #include in c?

590






What is string constants?

653


What is the advantage of using #define to declare a constant?

614


Can we declare variable anywhere in c?

533


Tell us something about keyword 'auto'.

659


What is a buffer in c?

568


In a switch statement, what will happen if a break statement is omitted?

598


Can an array be an Ivalue?

657


Write program to remove duplicate in an array?

595


What are the different types of errors?

635


Explain how can you be sure that a program follows the ansi c standard?

854