Login
Register
Dark Mode
Brightness
Ambient Glow – Questions list
Register
Profile
Edit Profile
Messages
My favorites
My Updates
Logout
Recent questions tagged recursion
9
9 votes
3
3 answers
279
279 views
GO Classes DPP | GATE CS | C Programming | Recursion Trace
What is the output of the following code?#include <stdio.h int fun(int n) { if (n <= 1) return n; return fun(n - 1) + fun(n - 3); } int main() { printf("%d", fun(5)); ret...
GO Classes
279
views
asked
Jun 8
Programming in C
goclasses
goclasses-cs-dpp
goclasses-cs-dpp-day-292
programming-in-c
c-programming
goclasses-c-programming-practice-questions
recursion
numerical-answers
+
–
8
8 votes
1
1 answer
239
239 views
GO Classes DPP | GATE CS | C Programming | Recursion
What is the output of the following code?#include <stdio.h int fun(int n) { if (n == 0) return 1; return n * fun(n - 2); } int main() { printf("%d", fun(6)); return 0; }
GO Classes
239
views
asked
Jun 6
Programming in C
goclasses
goclasses-cs-dpp
goclasses-cs-dpp-day-291
programming-in-c
c-programming
goclasses-c-programming-practice-questions
recursion
numerical-answers
+
–
8
8 votes
1
1 answer
208
208 views
GO Classes DPP | GATE CS | C Programming | Recursion
What is the output of the following code?#include <stdio.h int calc(int n) { if (n == 1) return 2; return n + calc(n - 1); } int main() { printf("%d", calc(4)); return 0;...
GO Classes
208
views
asked
Jun 6
Programming in C
goclasses
goclasses-cs-dpp
goclasses-cs-dpp-day-290
programming-in-c
c-programming
goclasses-c-programming-practice-questions
recursion
numerical-answers
+
–
2
2 votes
2
2 answers
188
188 views
UGC NET CSE | December 2025 | Part 2 | Question: 41
Which of the following is correct order of increasing time complexity of algorithmsTower of Hanoi with $n$ disk.Binary search given $n$ sorted numbers.Heap sort given $n$...
Shubham Sharma 2
188
views
asked
Apr 19
Algorithms
ugcnetcse-dec2025
time-complexity
algorithm-design
sorting
recursion
matrix
searching
+
–
2
2 votes
5
5 answers
955
955 views
GATE DA 2026 | Question: 29
A recursive function in Python is given.def mystery(n): if n <= 0: return 1 else: return mystery(n-1) + mystery(n-2)Now, consider the following function call:myster...
gatecse
955
views
asked
Feb 23
Programming in Python
gateda-2026
programming-in-python
recursion
two-marks
+
–
18
18 votes
5
5 answers
4.2k
4.2k views
GATE CSE 2026 | Set 2 | Question: 51
Consider the following ANSI-C function.int func(int start, int end){ int length=end+1-start; if((length<1)||(start<0)||(end<0)){ return(0); } if(length%3==0){ return(func...
gatecse
4.2k
views
asked
Feb 23
Programming in C
gatecse-2026-set2
programming-in-c
recursion
output
numerical-answers
two-marks
+
–
21
21 votes
2
2 answers
3.5k
3.5k views
GATE CSE 2026 | Set 1 | Question: 51
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)...
gatecse
3.5k
views
asked
Feb 23
Algorithms
gatecse-2026-set1
algorithms
recursion
numerical-answers
two-marks
+
–
1
1 vote
2
2 answers
527
527 views
Recursive function output
#include <stdio.h>int mystery(int n) { if (n == 0) { return 0; } else if (n % 2 == 0) { return mystery(n / 2); } else { return 1 + mystery(n...
Vishnu__
527
views
asked
Feb 4
Programming in C
programming-in-c
recursion
numerical-answers
+
–
0
0 votes
1
1 answer
346
346 views
Recurrence Relation Writing
A recurrence arises in the problem: Number of ways to tile a 3×n rectangle with 2×1 dominoes (dominoes can be placed vertically or horizontally). Let T(n) be this number...
vishnusainune
346
views
asked
Dec 30, 2025
Algorithms
algorithms
recurrence-relation
recursion
self-doubt
+
–
0
0 votes
1
1 answer
313
313 views
UGC NET CSE | August 2024 | Part 2 | Question: 6
Consider the following C code:#include<stdio.h int temp = 0; int fun(int x, int y) { int z; temp++; if (y==3) return(x*x*x); else { z=fun(x, y/3); return(z*z*z); } } int ...
Shubham Sharma 2
313
views
asked
Sep 9, 2025
Programming in C
ugcnetcse-aug2024
programming-in-c
recursion
+
–
0
0 votes
1
1 answer
389
389 views
UGC NET CSE | August 2024 | Part 2 | Question: 8
Consider the function in $C$ code:Cal(a,b) { if (b!=1) { if (a!=1) { printf("*"); Cal(a/2, b); } else { b=b-1; Cal(10,b); } }}How many times $*$ is going to be printed, i...
Shubham Sharma 2
389
views
asked
Sep 9, 2025
Programming in C
ugcnetcse-aug2024
programming-in-c
recursion
recurrence-relation
+
–
6
6 votes
4
4 answers
915
915 views
GO Classes DPP | C programming | Recursion | IIT KGP
Consider the following recursive C function.unsigned int f(unsigned int n) { if (n < 10) printf("%d",n); else { printf("%d", n%10); f(n/10); printf("%d", n%10); } }What d...
GO Classes
915
views
asked
Jun 28, 2025
Programming in C
goclasses
programming
recursion
goclasses-cs-dpp
goclasses-cs-dpp-day-29
goclasses-c-programming-practice-questions
+
–
5
5 votes
3
3 answers
579
579 views
GO Classes DPP | C programming | Recursion | IIT KGP
What string does the following program print?#include <stdio.h #include <string.h void strFunc2 (char A[], int n) { char t; if (n <= 1) return; t = A[0]; A[0] = A[n-1]; A...
GO Classes
579
views
asked
Jun 28, 2025
Programming in C
goclasses
programming
recursion
goclasses-cs-dpp
goclasses-cs-dpp-day-29
goclasses-c-programming-practice-questions
+
–
7
7 votes
2
2 answers
813
813 views
GO Classes DPP | C programming | Recursion | IIT KGP
Let the function g be defined as follows:int g ( int n ) { if (n < 2) return n; return g(n/2); }What is the value returned by the call $\mathrm{g}(142857)$ ?$0$ $1$ $2$ $...
GO Classes
813
views
asked
Jun 28, 2025
Programming in C
goclasses
programming
recursion
goclasses-cs-dpp
goclasses-cs-dpp-day-29
goclasses-c-programming-practice-questions
+
–
8
8 votes
4
4 answers
846
846 views
GO Classes DPP | C Programming | Program output
Consider the following recursive function definition:function FOO(n) if (n=0) then return 0 else if ( n = 1) then return 1 else if ( n = 2) then return 3 else return n + ...
GO Classes
846
views
asked
Jun 23, 2025
Programming in C
goclasses
programming
recursion
goclasses-cs-dpp
goclasses-cs-dpp-day-25
goclasses-c-programming-practice-questions
+
–
3
3 votes
4
4 answers
411
411 views
CMI CS 2025 | Part A | Question: 8
The next two questions pertain to the following code which takes a non-negative integer as input.function FOO(n) if (n=0) then return 0 else if (n=1) then return 1 else i...
Shubham Sharma 2
411
views
asked
Jun 20, 2025
Algorithms
cmi2025
algorithms
recursion
+
–
5
5 votes
4
4 answers
494
494 views
CMI CS 2025 | Part A | Question: 9
The next two questions pertain to the following code which takes a non-negative integer as input}.function FOO(n) if (n=0) then return 0 else if (n=1) then return 1 else ...
Shubham Sharma 2
494
views
asked
Jun 20, 2025
Algorithms
cmi2025
algorithms
recursion
time-complexity
+
–
2
2 votes
1
1 answer
502
502 views
TIFR CSE 2025 | Part B | Question: 1
What is the solution to the following recursion?$$\begin{array}{l}T(n)=T\left(\dfrac{n}{2}\right)+T\left(\dfrac{n}{3}\right)+T\left(\dfrac{n}{6}\right)+O(n), \\T(n)=5 \qu...
Shubham Sharma 2
502
views
asked
Jun 16, 2025
Algorithms
tifr2025
algorithms
time-complexity
recursion
+
–
1
1 vote
0
0 answers
474
474 views
ISI2025-MCS-PCB (Non-CS) | Question: 1
Consider the following function job(), which takes two positive integers $x$ and $y$, and returns another integer.int job(int x, int y) {if (x y) return x;else if (x y) ...
Shubham Sharma 2
474
views
asked
Jun 12, 2025
Algorithms
isi2025-mcs-pcb
algorithms
recursion
number-theory
programming
+
–
3
3 votes
4
4 answers
513
513 views
ISI2025-MCS-PCA | Question: 3
Suppose the function $f$ is defined by the following pseudocode. What will be printed when $f(5)$ is called?function f(x) { if (x 1) { print(x); f(x-2); print(x); } }$55...
Shubham Sharma 2
513
views
asked
Jun 9, 2025
Algorithms
isi2025-mcs-pca
algorithms
recursion
output
+
–
1
1 vote
2
2 answers
512
512 views
ISI2025-MCS-PCA | Question: 22
Let f(x) be defined as follows:function f(x){ count := 0; while (x 0) { x := floor(x/2); count := count + 1; } return count; }where floor(y) is defined as the largest in...
muskan001
512
views
asked
May 15, 2025
Programming in C
recursion
+
–
Page:
« prev
1
2
3
4
5
6
7
...
11
next »