Skip to content

Beta · Data may be lost.Your data may be reset or lost.

GateBrew
← GATE CSE 2011
Questions

Q49

MCQ2 marks, −0.67AlgorithmsMedium

Consider the following recursive C function that takes two arguments.

unsigned int foo(unsigned int n, unsigned int r) {
    if (n>0) return ((n%r) + foo(n/r, r));
    else return 0;
}

What is the return value of the function foo\text{foo} when it is called as foo(513, 2)\text{foo(513, 2)}?

Sign in to save attempts.

Solutions and discussion are hidden while you attempt this question. They open once you check or show the answer.