GATE | GATE CS 1999 | Question 49
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
Recommended Posts:
- GATE | GATE CS 1999 | Question 40
- GATE | GATE CS 1999 | Question 24
- GATE | GATE CS 1999 | Question 23
- GATE | GATE CS 1999 | Question 20
- GATE | GATE CS 1999 | Question 18
- GATE | GATE CS 1999 | Question 17
- GATE | GATE CS 1999 | Question 16
- GATE | GATE CS 1999 | Question 15
- GATE | GATE CS 1999 | Question 22
- GATE | GATE CS 1999 | Question 25
- GATE | GATE CS 1999 | Question 39
- GATE | GATE CS 1999 | Question 38
- GATE | GATE CS 1999 | Question 37
- GATE | GATE CS 1999 | Question 35
- GATE | GATE CS 1999 | Question 34



