in R Language by
What is the value of f (2) for the following R code?

▼ Show 1 Answer

0 votes
The answer to the above code snippet is 35. The value of “a” passed to the function is 2 and the value for “b” defined in the function f (a) is 3. So the output would be 3^3 + g (2). The function g is defined in the global environment and it takes the value of b as 4(due to lexical scoping in R) not 3 returning a value 2*4= 8 to the function f. The result will be 3^3+8= 35.
Learn More with Madanswer

Related questions

+2 votes
asked Jul 28, 2019 in R Language by Aarav2017