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

Evaluate:
int fn(int v)
{
if(v==1 || v==0)
return 1;
if(v%2==0)
return fn(v/2)+2;
else
return fn(v-1)+3;
}
for fn(7);

a) 10
b) 11
c) 1

Answer Posted / jagdish patel

you have wrong option
correct answer is 9


solution:-
v=7;
so v is not =1,0 and also v%2 is not 0;
so (v-1)+3;
(7-1) + 3
6 + 3
= 9

Is This Answer Correct ?    3 Yes 8 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

To what does “event-driven” refer?

1015


Which coding certification is best?

982


What is the difference between *p++ and (*p)++ ?

1309


Explain the register storage classes in c++.

1163


Give 10 points of differences between C & C++.

1096


How do you declare a set in c++?

930


Explain what are accessor methods?

1079


Write some differences between an external iterator and an internal iterator?

980


What is the need of a destructor?

1092


What is the c++ programming language used for?

1009


Which bit wise operator is suitable for putting on a particular bit in a number?

1163


How do you define a class in c++?

1048


How compile and run c++ program in turbo c++?

1133


Why is polymorphism useful?

1034


What is oop in c++?

1047