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 / babita sharma
The answer would be
b.
11 Its teh recursive function.
| Is This Answer Correct ? | 2 Yes | 1 No |
Post New Answer View All Answers
Why use of template is better than a base class?
Where can I run c++ program?
how to access grid view row?
What are the two types of comments, and how do they differ?
If a header file is included twice by mistake in the program, will it give any error?
What is vector string in c++?
Is c++ pass by reference or value?
Explain the operation of overloading of an assignment operator.
What does floor mean in c++?
What is a stack? How it can be implemented?
Explain virtual class?
What is the sequence of destruction of local objects?
What is the purpose of extern storage specifier?
What is meant by const_cast?
What are associate containers?