GATE CS 2017 (Forenoon) — Question 35

Programming in CFunctions, Parameter Passing, Scope Rules, RecursionMCQ2 marks · −2/3 if wrongMedium

Consider the following two functions:
c
1void fun1 (int n) {
2    if (n == 0) return;
3    printf ("%d", n);
4    fun2 (n - 2);
5    printf ("%d", n);
6}
7void fun2 (int n) {
8    if (n == 0) return;
9    printf ("%d", n);
10    fun1(++n);
11    printf ("%d", n);
12}
13
The output printed when fun1 (5) is called is
  1. A
    53423122233445
  2. B
    53423120112233
  3. C
    53423122132435
  4. D
    53423120213243
Practise the full 2017-FN paper
Challenge a friend: WhatsApp Telegram
From RENYXERAPractise this subject in the exam simulatorTimed, GATE-style tests with analytics that find your weak topics.
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