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

What is this pointer in c plus plus?

600


How can I swap two values without using a temporary?

621


What is the purpose of the preprocessor directive error?

684


Write a c program to demonstrate character and string constants?

1687


Explain how do you override a defined macro?

590






What are qualifiers in c?

574


Explain what are binary trees?

616


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

605


a single linked list consists of nodes a to z .print the nodes in reverse order from z to a using recursion

2336


Write a Program to accept different goods with the number, price and date of purchase and display them

5454


Which header file should you include if you are to develop a function which can accept variable number of arguments?

814


What are pragmas and what are they good for?

580


Why static is used in c?

627


What is the mean of function?

651


How can I find out how much free space is available on disk?

632