Skip to content
Related Articles
Open in App
Not now

Related Articles

GATE | GATE CS 1999 | Question 49

Improve Article
Save Article
  • Last Updated : 23 Oct, 2017
Improve Article
Save Article

Consider the following C function definition.

int Trial (int a, int b, int c)
    if ((a >= b) && (c < b) return b;
    else if (a>=b) return Trial(a, c, b);
    else return Trial(b, a, c);

The function Trial:
(A) finds the maximum of a, b and c
(B) finds the minimum of a, b and c
(C) finds the middle number of a, b and c
(D) None of the above

Answer: (D)

Explanation: Trial (a,b,c) return the median element of the a, b and c,but not middle element of a , b and c. But if a = b = c, then infinite loop.
So, Option (D) is correct.

Quiz of this Question

My Personal Notes arrow_drop_up
Related Articles

Start Your Coding Journey Now!