GATE CS 2020 (Forenoon) — Question 56

Programming in CFunctions, Parameter Passing, Scope Rules, RecursionNAT2 marksMedium

Consider the following C functions:
c
1int fun1(int n) {
2    static int i = 0;
3    if (n > 0) {
4        ++i;
5        fun1(n - 1);
6    }
7    return(i);
8}
9int fun2(int n) {
10    static int i = 0;
11    if (n > 0) {
12        i = i + fun1(n);
13        fun2(n - 1);
14    }
15    return(i);
16}
17
The return value of fun2(5) is ________.
Practise the full 2020-FN paper
Challenge a friend: WhatsApp Telegram
From RENYXERAFree All-India Mock — every SundayA full GATE CS paper, exactly 180 minutes, ranked across India with your GATE score.
Practise more on Functions, Parameter Passing, Scope Rules, RecursionTimed, in the real exam interface · free to start

A GATE question every morning

One real past-paper question every morning for your branch, answer hidden until you tap. Free on Telegram.

Join
Stuck? Ask in the student group