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

What is c++ coding?

1187


Explain rethrowing exceptions with an example?

1017


What is guard code in c++?

1159


How is computer programming useful in real life?

1052


Explain what data encapsulation is in c++?

1080


Write a program to add three numbers in C++ utilizing classes.

1104


Explain the volatile and mutable keywords.

1064


Is swift faster than c++?

1015


Which coding certification is best?

1010


How can you quickly find the number of elements stored in a static array?

1085


Do class method definitions?

1027


Describe delete operator?

1081


Describe protected access specifiers?

1205


What is a dangling pointer in c++?

1124


What is namespace std; and what is consists of?

1283