edited by
818 views
1 votes
1 votes

edited by

1 Answer

0 votes
0 votes

The answer is 214.

It is said that the program is using dynamic scoping (not dynamic programming -_-).

When the first time function f1() is called, it returns 26.

f2() when called returns 51.

f3() when called returns 100. Why? Because the program is using the dynamic scoping so it will depend on the value of x in the main() function.

Again when f1() is called, it returns 27, because of static storage.

So the total sum would be - 10 + 26 + 51 + 100 + 27 = 214.

I hope I didn't miss any important point here.

Related questions

2 votes
2 votes
1 answer
1
Sumaiya23 asked Jan 29, 2018
2,130 views
The number of balance parenthesis possible with 5-pairs of parenthesis _________. [ Assume ( ) and (( )) is balance parenthesis but not ) ( ]
0 votes
0 votes
0 answers
2
Shamim Ahmed asked Nov 26, 2018
394 views
Which of the following procedure is suitable to find longest path from given vertex to any other vertex in Directed Acyclic Graph?Answer: Dynamic Programming.Why Greedy A...