Question:medium

Consider the following C program:

Show Hint

Trace function calls carefully by evaluating inner functions first.
Updated On: Jan 30, 2026
Show Solution

Correct Answer: 46

Solution and Explanation

The function \(g(x)\) increases its input by \(10\). Whenever \(f(n)\) is evaluated, the value \(2n\) is first passed to \(g\), producing \(2n + 10\).

This result is again used as an input to \(g\), so the expression being added to the total becomes:

\(g(f(n)) = (2n + 10) + 10 = 2n + 20\)

For \(n = 1\), the value added is \(2(1) + 20 = 22\). For \(n = 2\), the value added is \(2(2) + 20 = 24\).

Adding these contributions gives:

\(22 + 24 = 46\)

Was this answer helpful?
0