1. Home
  2. GATE CS
  3. Programming and Data Stru...

Filters

Found 1 Question

Set Default
Exams
Years
Subjects
Topics

List of top Programming and Data Structures Questions on Recursion and Recursive Functions asked in GATE CS

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 foo(n) returns 5 is ______.
Note: Ignore syntax errors (if any) in the function.
  • GATE CS - 2026
  • GATE CS
  • Programming and Data Structures
  • Recursion and Recursive Functions
contact us
terms & conditions
Privacy & Policy
© 2026 Patronum Web Private Limited