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 / rajesh
b
| Is This Answer Correct ? | 8 Yes | 1 No |
Post New Answer View All Answers
How do I download c++?
What is a linked list in c++?
Reads in the size of a square from the screen; 2. Prints a hollow square of that size out of “-“, “|” and blanks on screen; 3. Prints the same hollow square onto a text file. Your program should work for squares of all side sizes between 1 and 20. --- │ │ │ │ │ │ ---
Can a constructor return a value?
What is the use of map in c++?
What is the difference between a template and a macro?
How do I start a c++ project?
Is swift faster than c++?
Can you help me with this one? Make a program that when a user inputed a Product Name, it will display its price, and when the user inputed the quantity of the inputed product, it will show its total price. The output must be like this: Product Name: Price: Quantity: Total Price: ..this is the list of products to be inputed: Cellphone - 1500 Washing Machine - 5200 Television - 6000 Refrigirator - 8000 Oven - 2000 Computer - 11000 thanks..:D
List down the guideline that should be followed while using friend function.
True or false, if you keep incrementing a variable, it will become negative a) True b) False c) It depends
How do you show the declaration of a virtual constructor?
Is ca high or low level language?
What are the vectors in c++?
Differences between private, protected and public and give examples.