Question: Consider the Scala definitions: object O { / / O 1 def f ( x: Int ) = { / / f 1 , x

Consider the Scala definitions:
object O {// O1
def f(x: Int)={// f1, x1
def g(x: Int)={// g1, x2
if (x ==0) x // x3, x4
else x + g(x -1)// x5, g2, x6
}
g(x)// g3, x7
}
def g(x: Int)= f(x *2)// g4, f2, x8
}
O.f(2)// O2, f3, x9
Each line of code has a comment giving unique numbers to each occurrence of an identifier. Which one of the following statements is false?
Options:
x3 is statically bound to x2.
g3 is statically bound to g4.
f2 is statically bound to f1.
x7 is statically bound to x1.
O2 is statically bound to O1.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!