Gate CS-2017-1 Question Paper With Solutions

Q. 49 Consider the following two functions

void fun1(int n){ 

     if(n == 0) return; 
     printf(“%d”, n); 
     fun2(n-2);
     printf(“%d”, n);  
}

void fun2(int n){ 

     if(n == 0) return; 
     printf(“%d”, n); 
     fun1(++n);
     printf(“%d”, n);  
}

The output printed when fun1 (5) is called is

(A) 53423122233445

(B) 53423120112233

(C) 53423122132435

(D) 53423120213243

Answer: (A)

Explanation:

Gate CS-2017-1 Question Paper With Solutions

Learn More:   Gate EC-2017-2 Question Paper With Solutions

LEAVE A REPLY

Please enter your comment!
Please enter your name here