aliensbrain
  • Home
  • Study
  • Quizzes
  • 🎤AI Practicefree
  • Notebooks
  • Community
  • Sign in
  • Computer Science (GATE Exam) 2013 - Previous Question Paper Solution
  • What is the return value of f(p, p) if the value of p is ...
Multiple choice

What is the return value of f(p, p) if the value of p is initialised to 5 before the call? Note that the first parameter is passed by reference, whereas the second parameter is passed by value.

int f(int &x, int c) {
  c = c  – 1;
  if (c == 0) return 1;
  x = x + 1;
  return f (x, c) * x;
}

  1. 3024

  2. 6561

  3. 55440

  4. 161051

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

Keep practicing — related questions

  • What is printed by the print statements in the program P1 assuming call by reference parameter passing? Pro...
  • int *p(void)
  • Consider the program below: #include int fun(int n, int *f_p) { int t, f; if (n <= 1) { *f_p = 1; return 1;...
  • Consider the following C function int f(int n) { static int i = 1; if (n >= 5) return n; n = n + i; i++; re...
  • void myFunc (int x) { if (x > 0) myFunc(--x); printf(%d, , x); } int main() { myFunc(5); return 0; } What w...
  • Consider the following C function: int f(int n) { static int r = 0; if (n <= 0) return 1; if (n > 3) { r = ...
  • Consider the following C function: int f(int n) { static int r = 0; if (n <= 0) return 1; if (n > 3) { r = ...
  • What will be the value of Point p after methods in a and b if the value before method call is (700,800). st...
Play the full quiz 🎤 Practise this topic out loud

Practice this topic

  • Programming Output Evaluation (1721 questions)
Advertisement
© Aliensbrain | all rights reserved
  • About
  • Contact
  • Terms and Condition
  • Privacy Policy