Similar questions 3 more →
Scope, Lifetime & Storage Classes

Answer & solution
Answer: D (no official key was published)
Step through it (11 steps)
1. Approach. The static r is one persistent shared object, not a fresh zero-initialized local for each recursive call. Record the single assignment r=5 before unwinding the recursion.
2. Derivation and interpretation. The static variable r is shared by all activations. In f(5), r becomes 5, and the return expression is f(3)+2. Calls f(3), f(2), and f(1) each recurse with n−1 and add the unchanged r=5. The base f(0)=1. Hence f(1)=6, f(2)=11, f(3)=16, and f(5)=18 (D). No smaller activation changes r, so operand evaluation order does not affect this particular call.