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 code fragment:
int main(void) {
int m = 4;
mystery ( m );
mystery ( m );
printf("%d", m);
return 0;
}

What is the output on the monitor if mystery is defined as
follows ?

void mystery (int m) {
m = m+3;
}

Answers were Sorted based on User's Feedback



Consider the following code fragment: int main(void) { int m = 4; mystery ( m ); ..

Answer / c++ coder

Output will be 4 only.

since the argument is not passed by reference so a local
copy of m is used in the function call which is local to
mystery() it will not have any impact on the variable m
which is used in main() function.

Is This Answer Correct ?    6 Yes 1 No

Consider the following code fragment: int main(void) { int m = 4; mystery ( m ); ..

Answer / rahul darekar

since in c lang we have to define fun first before we use it
but in this program fun mystery() in not defined and still
it is called so it will give error.

Is This Answer Correct ?    3 Yes 1 No

Post New Answer

More C++ General Interview Questions

write a C++ programming :if the no is between 32 to 50 it will be odd.

3 Answers   NIIT,


Does a derived class inherit or doesn't inherit?

0 Answers  


What does 7/9*9 equal ? a) 1 b) 0.08642 c) 0

0 Answers  


What is the difference between object-oriented programming and procedural programming?

0 Answers  


Write a corrected statement in c++ so that the statement will work properly. x + y=z;

2 Answers  


What is virtual destructor ans explain its use?

0 Answers  


What is an adaptor class in c++?

0 Answers  


Why should we use null or zero in a program?

0 Answers  


What is void pointer in c++ with example?

0 Answers  


What is a tree in c++?

0 Answers  


What is exception handling in C++?

1 Answers  


What is the cout in c++?

0 Answers  


Categories