Question 9873 – Programming
February 13, 2024Question 9649 – Programming
February 13, 2024Question 9782 – Programming
Consider the following program
Program P2 var n: int: procedure W(var x: int) begin x=x+1; print x; end procedure D begin var n: int; n=3; W(n); End begin //beginP2 n=10; D; end
If the language has dynamic scoping and parameters are passed by reference, what will be printed by the program?
Correct Answer: D
Question 30 Explanation:
n=3
W(n)=W(3)
Procedure W(var x; int)
begin
x = x+1 = 3+1 = 4
Print x → Print x=4
end
W(n)=W(3)
Procedure W(var x; int)
begin
x = x+1 = 3+1 = 4
Print x → Print x=4
end
10
11
3
None of the above
Subscribe
Login
0 Comments