I'm working on this problem and I got the answers :
Statically: 20, 16
Dynamically: 20, 100
is that correct?
Consider the program below (in a Pascal like language). What is the output of the language is statically scoped? What is the output if the language is dynamically scoped?
Program main;
x: integer;
procedure f1(z: integer)
begin
return z * x;
end
procedure f2(z: integer)
int x;
begin
x = 2;
return f1(z) * x;
end
begin /* main program */
x = 5;
print f1(4);
print f2(4);
end