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
How many characters are recognized by ANSI C++?
How a pointer differs from a reference?
Can we sort map in c++?
What are advantages of c++?
What language is a dll written in?
What is the use of "new" operator?
What is a singleton class c++?
Describe Trees using C++ with an example.
What is a lambda function c++?
How are virtual functions implemented in c++?
Write about the members that a derived class can add?
What are guid? Why does com need guids?
In inline " expression passed as argument are evalauated once " while in macro "in some cases expression passed as argument are evaluated more than once " --> i am not getting it plz help to make me understand....
When do we run a shell in the unix system?
Are vectors faster than arrays?