Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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 / arvind

the answer is syntax error but if there was a : after default

the execution would be like:
for i=0 case 0 is executed and then since there is no break
statement all the cases including the default case are
executed and the 16 is printed,.then i is iterated using
i++, now i=17 ,it enters the switch statement and only
default case is executed and i=i+5=21 is printed

Is This Answer Correct ?    37 Yes 6 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is action and transformation in spark?

1170


What is a protocol in c?

1015


What is the process of writing the null pointer?

1030


What is extern variable in c with example?

1006


How do we make a global variable accessible across files? Explain the extern keyword?

1887


void main(){ int a; a=1; while(a-->=1) while(a-->=0); printf("%d",a); }

1731


What are qualifiers?

1057


What is sizeof return in c?

1042


Explain what are preprocessor directives?

1075


Explain what are run-time errors?

1099


What are the __date__ and __time__ preprocessor commands?

1125


What is a void pointer in c?

1114


Explain what is the difference between a string copy (strcpy) and a memory copy (memcpy)? When should each be used?

1102


What is the use of the function in c?

1025


Can you please explain the difference between strcpy() and memcpy() function?

1080