Gate Exam Programming Database

Consider the following C function:
int f(int n)
{
static int are = 0;
If (n < = 0) return 1;
If (n > 3)
{ r = n;
return f (n – 2) + 2;
}
return f(n – 1) + r;
}
What is the value of f(5)?

Read Solution (Total 4)

Gate Other Question

In housing society, half of familiars have a single child per family, while the
remaining half have two children per family. The probability that a child picked
at random has a sibling is _____.
In a survey, 3/16 of the people surveyed told that they preferred to use public
transport while commuting daily to office. 5/8 of the people surveyed told that they
preferred to use their own vehicles. The remaining 75 respondents said that they had no
clear preference. How many people preferred to use public transport?