aliensbrain
  • Home
  • Study
  • Quizzes
  • 🎤AI Practicefree
  • Notebooks
  • Community
  • Sign in
  • Computer Science (GATE Exam) 2009 - Previous Question Paper Solution
  • Consider the program below: ```c #include int fun(int n, ...
Multiple choice

Consider the program below:

#include 
int fun(int n, int *f_p) {
    int t, f;
    if (n <= 1) {
        *f_p = 1;
        return 1;
    }
    t = fun(n-1, f_p);
    f = t + *f_p;
    *f_p = t;
    return f;
}

int main() {
    int x = 15;
    printf("%d/n", fun(5, &x));
    return 0;
}

The value printed is

  1. 6

  2. 8

  3. 14

  4. 15

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

Keep practicing — related questions

  • Consider the C program shown below. #include < stdio.h > #define print(x) print f(” % d“, x) int x; void Q(...
  • What is the value printed by the following C program? #include int f(int * a, int n) { if (n <= 0) return 0...
  • What does the following program print? #include void f (int *p, int * g) { p = q; * p = 2; } int i = 0, j =...
  • Consider the C program shown below. \#include <stdio.h> \#define print(x) print f(”%d “, x) int x; void Q(i...
  • #include int main() { printf("%d %f",6/4,6/4); }
  • void myFunc (int x) { if (x > 0) myFunc(--x); printf(%d, , x); } int main() { myFunc(5); return 0; } What w...
  • Consider the following C-program: void foo(int n, int sum) { int k = 0, j = 0; if (n == 0) return; k = n % ...
  • void main() { int i=5; i+=i*=i-=i/i; printf("%d",i); }
Play the full quiz 🎤 Practise this topic out loud
Advertisement
© Aliensbrain | all rights reserved
  • About
  • Contact
  • Terms and Condition
  • Privacy Policy