...
Question 9873 – Programming
February 13, 2024
Question 9649 – Programming
February 13, 2024
Question 9873 – Programming
February 13, 2024
Question 9649 – Programming
February 13, 2024

Question 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
A
10
B
11
C
3
D
None of the above
0 0 votes
Article Rating
Subscribe
Notify of
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x
error: Alert: Content selection is disabled!!