Assuming that the following code has been executed successfully, select the expressions which evaluate to True (Choose two.)
Assuming that the following code has been executed successfully, select the expressions which evaluate to True (Choose two.)
The function `f(x, y)` returns a function `g()` that calculates the quotient of `nom` and `denom`. Since the parameters `x` and `y` are set when calling `f`, `a` and `b` are indeed functions and not `None`. Moreover, `a` is a closure capturing `1` and `2` while `b` is a closure capturing `3` and `4`, meaning `a` and `b` are two different function instances, thus `a != b` is true. However, the statements `a() == 4` and `b() == 4` are incorrect because `a()` would return `0.5` (i.e., `1 / 2`) and `b()` would return `0.75` (i.e., `3 / 4`). Therefore, the correct answers are A and C.
A and C are correct
As tested
C is correct
A, C us correct