Skip to content

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

GateBrew
← GATE CSE 2026 Set 1
Questions

Q51

NAT2 marksAlgorithms

Consider the recursive functions represented by the following code segment:

int bar(int n) {
    if (n == 1) return 0;
    else return 1 + bar(n/2);
}
int foo(int n) {
    if (n == 1) return 1;
    else return 1 + foo(bar(n));
}

The smallest positive integer n for which f∘∘(n)\mathrm{f} \circ \circ(\mathrm{n}) returns 55 is ____\_\_\_\_. (answer in integer) Note: Ignore syntax errors (if any) in the function.

Sign in to save attempts.

The solution is hidden while you attempt this question. It opens once you check or show the answer.