Evaluate the following:
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);
1) 10
2) 11
3) 1
Answer Posted / harish
11
| Is This Answer Correct ? | 10 Yes | 2 No |
Post New Answer View All Answers
What is the method to save data in stack data structure type?
What is difference between %d and %i in c?
What will be the outcome of the following conditional statement if the value of variable s is 10?
When is a “switch” statement preferable over an “if” statement?
Why is not a pointer null after calling free? How unsafe is it to use (assign, compare) a pointer value after it is been freed?
Explain do array subscripts always start with zero?
Can include files be nested?
Explain how are portions of a program disabled in demo versions?
Is it better to use a pointer to navigate an array of values, or is it better to use a subscripted array name?
How can you restore a redirected standard stream?
What are the 5 types of organizational structures?
application areas a 'c' a) operating system b) graphics, interpreter, assembler c) program evalution, communication softwares d) all the above
Difference between malloc() and calloc() function?
while initialization of array why we use a[][2] why not a[2][]...?
Can we assign integer value to char in c?