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
What is c++ programming language?
What is an adaptor class or wrapper class in c++?
Is c++ primer good for beginners?
What is a virtual destructor? Explain the use of it?
Tell me what are static member functions?
Explain object slicing in c++?
What is general format for a prototype?
What are the various storage classes in C++?
What is a container class? What are the types of container classes in c++?
What is insertion sorting?
How did c++ start?
Explain the static member function.
How do I run c++?
Why c++ is not a pure oop language?
Implement stack operations with pointers with appropriate exception checks.