Categories

Jul 28, 2019 in R Language

Q: What is the value of f (2) for the following R code?

1 Answer

Jul 28, 2019
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.
Click here to read more about Loan/Mortgage
Click here to read more about Insurance

Related questions

Madanswer
Jul 28, 2019 in R Language
Jul 28, 2019 in R Language
Jul 28, 2019 in R Language
...