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
Are strings immutable in c++?
What is the difference between a template and a macro?
How can we check whether the contents of two structure variables are same or not?
You run a shell on unix system. How would you tell which shell are you running?
What is the meaning of c++?
Describe the setting up of my member functions to avoid overriding by the derived class?
Define private, protected and public access control.
Define a nested class.
What do you mean by enumerated data type?
Describe the advantages of operator overloading?
State the difference between pre and post increment/decrement operations.
Where is atoi defined?
Explain the auto storage classes in c++.
Which software is used for c++ programming?
What are virtual functions in c++?