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...

consider the following program sigment
int n,sum=1;
switch(n) {
case 2:sum=sum+2;
case 3:sum*=2;
break;
default:sum=0;}
if n=2, what is the value of sum
a.0
b.6
c.3
d.none

Answer Posted / manishsoni

# define prod(a,b) a*b
main()
{
int n=2,sum=1; //here given n=2 so
switch(n) //switch(2)
{
case 2: //encounter this case 2;
sum=sum+2; //add sum=1+2;sum=3
case 3: //here no break statement so case
// 3 is checked by this and
// remained that sum=3;
sum*=2; //so sum =3*2;sum=6
break; //here switch is break and sum=6;
default: //default is don't check ;
sum=0;
}
printf("%d",sum); //so print sum=6;
getch();
}
by manish soni MCA first sem (by rawatsar);

Is This Answer Correct ?    5 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are volatile variables in c?

882


What extern c means?

929


What should malloc(0) do? Return a null pointer or a pointer to 0 bytes?

1017


Explain how can you restore a redirected standard stream?

1029


What is structure data type in c?

967


Explain what is a 'locale'?

1013


Why we write conio h in c?

963


Please send me WIPRO technical question to my mail ID.. its nisha_g28@yahoo.com please its urgent

2073


process by which one bit patten in to another by bit wise operation is? (a) masking, (b) pruning, (c) biting, (d) chopping,

2354


How can I check whether a file exists? I want to warn the user if a requested input file is missing.

1084


How is null defined in c?

1098


What are header files in c programming?

1072


Is c is a high level language?

1123


List out few of the applications that make use of Multilinked Structures?

2107


What are global variables?

1112