Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

GATE | GATE IT 2006 | Question 52

  • Last Updated : 28 Jun, 2021

The following function computes the value of mCn correctly for all legal values m and n (m≥1,n≥0 and m>n)

Attention reader! Don’t stop learning now.  Practice GATE exam well before the actual exam with the subject-wise and overall quizzes available in GATE Test Series Course.

Learn all GATE CS concepts with Free Live Classes on our youtube channel.




int func(int m, int n)
{
    if (E) return 1;
    else return(func(m -1, n) + func(m - 1, n - 1));
}

In the above function, which of the following is the correct expression for E?
(A) (n = = 0) || (m = = 1)
(B) (n = = 0) && (m = = 1)
(C) (n = = 0) || (m = = n)
(D) (n = = 0) && (m = = n)


Answer: (C)

Explanation: Make a recursion tree of the given function recursion.

Quiz of this Question

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!