GATE Programming and Data Structures: Recursion – Previous Year Questions
28 GATE previous year questions on Recursion (Programming and Data Structures, Computer Science) with answers and explanations, from every paper.
28 questions worth 49 marks in all (7 1-mark, 21 2-mark). Asked between 2007 and 2026, so you can see how the topic has been tested over time.
- GATE 2007 CS Q42 – What is f(5)?
- GATE 2008 CS Q61 – Fill ?1, ?2 to print a newline-terminated input string in reverse order.
- GATE 2008 CS Q75 – Consider the C functions (assume N>n): What values do f1(8), f2(8) return?
- GATE 2009 CS Q18 – Consider the program below. What value is printed?
- GATE 2021 CS (CS2) Q33 – Find SomeFunction(15,255).
- GATE 2021 CS (CS2) Q59 – What does this program print?
- GATE 2015 CS (CS3) Q38 – How many calls to get, including the initial and base-case calls, occur for get(6)?
- GATE 2015 CS (CS2) Q21 – What does foo("ABCD EFGH") print?
- GATE 2015 CS (CS2) Q24 – Find fun(5).
- GATE 2010 CS Q45 – What does this C program print?
- GATE 2011 CS Q58 – Find foo(345,10).
- GATE 2011 CS Q59 – Find foo(513,2).
- GATE 2013 CS Q52 – p starts at five. Find f(p,p). The first parameter is passed by reference and the second by value.
- GATE 2012 CS Q26 – Which recurrence gives optimal Towers of Hanoi time for n disks?
- GATE 2016 CS (CS2) Q47 – What does this program print? max returns the larger argument.
- GATE 2014 CS (CS2) Q50 – Consider: double f(double x) if (abs(x*x - 3) < 0.01) return x; else return f(x/2 + 1.5/x); Give q to two decimals such that f(q) returns q.
- GATE 2014 CS (CS2) Q52 – Consider the C function: int f(int j) static int i = 50; int k; if (i == j) printf("something"); k = f(i); return 0; else return 0; Which is TRUE?
- GATE 2017 CS (CS1) Q45 – Consider the following two functions. The output printed when `fun1(5)` is called is
- GATE 2017 CS (CS1) Q46 – Consider the C functions `foo` and `bar` given below: Invocations of `foo(3)` and `bar(3)` will result in:
- GATE 2016 CS (CS1) Q45 – What will be the output of the following C program?
- GATE 2018 CS Q31 – Consider the following C program: The output of this program is .
- GATE 2018 CS Q55 – Consider the following program written in pseudo-code. Assume that `x` and `y` are integers. The number of times that the `print` statement is…
- GATE 2019 CS Q36 – Consider the following C function. Which one of the following will happen when the function `convert` is called with any positive integer n as…
- GATE 2026 CS (CS2) Q61 – Consider the following ANSI C function. The maximum possible value that can be returned from this function is . (answer in integer) Note: Ignore…
- GATE 2026 CS (CS1) Q61 – Consider the recursive functions represented by the following code segment: The smallest positive integer n for which `foo(n)` returns 5 is . (answer…
- GATE 2025 CS (CS1) Q61 – The value printed by the given C program is . (Answer in integer)
- GATE 2024 CS (CS1) Q19 – Consider the following C program: Assume that the input to the program from the command line is 1234 followed by a newline character. Which one of the…
- GATE 2020 CS Q56 – Consider the following C functions. The return value of fun2(5) is .