Evaluate the following:
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);




1) 10


2) 11


3) 1

Answer Posted / vinay

11 because it resrve every value in stack untill it become
1 then add all values.

Is This Answer Correct ?    3 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

the 'sizeof' operator reported a larger size than the calculated size for a structure type. What could be the reason?

554


we need to calculating INCOME TAX for the person. The INCOME TAX is as follows:- First $10000/- of income : 4% tax Next $10000/- of income : 8% tax Next $10000/- of income : 11.5% tax above $10, 00,00/- : 15% tax What is the Solution of this Question ?

796


List the difference between a While & Do While loops?

623


What is the purpose of sprintf() function?

587


Was 2000 a leap year?

616






Tell me about low level programming languages.

631


What is the concatenation operator?

598


How does #define work?

638


Explain how do you search data in a data file using random access method?

684


What does == mean in texting?

653


What language is windows 1.0 written?

563


What is atoi and atof in c?

606


Are the variables argc and argv are always local to main?

560


write a program which the o/p should b in such a way that s triangle if I/p is 3,a Square/rectangle if I/P=4,a pentagon if I/P=5 and so on...forget about the I/P which is less than 3

1630


What is the best organizational structure?

630