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 | 8 No |
Post New Answer View All Answers
What is volatile variable how do you declare it?
Write an algorithm for implementing insertion and deletion operations in a singly linked list using arrays ?
Are local variables initialized to zero by default in c?
How do I swap bytes?
Explain what are multidimensional arrays?
What is the behavioral difference when include header file in double quotes (“”) and angular braces (<>)?
What are the 4 types of functions?
#include main() { char s[] = "Bouquets and Brickbats"; printf(" %c, ",*(&s[2])); printf("%s, ",s+5); printf(" %s",s); printf(" %c",*(s+2)); }
Which is the best website to learn c programming?
What is the use of typedef in structure in c?
what is the difference between 123 and 0123 in c?
What is the condition that is applied with ?: Operator?
What would be an example of a structure analogous to structure c?
What is meant by initialization and how we initialize a variable?
What is meant by 'bit masking'?