Programming
February 13, 2024Programming
February 13, 2024Programming
| Question 5 |
Consider the program below:
Program main;
var r:integer;
procedure two;
begin write (r) end;
procedure one;
var r:integer;
begin r:=5 two; end begin r:=2;
two; one; two;
end. What is printed by the above program if
(i) Static scoping is assumed for all variables;
(ii) Dynamic scoping is assumed for all variables.
Give reasons for your answer.
| Theory Explanation. |
Correct Answer: A
