Compiler Design

1:

Given the following Pascal-like program segment 
Procedure A,
x, y : integer ;
Procedure B;
                 x, z : real ;
                           S1
end B;
Procedure C;
                  i : integer ;
                            S2
end C
end A;
The variables accessible in S1 and S2 are

A.

x of A, y, x of B and z in S1 and x of B, y and i in S2

B.

x of B, y and z in S1 and x of B, i and z in S2

C.

x of B, z and y in S1 and x of A, i and y in S2

D.

none of these

 

Answer : C

Explanation :

vishu said: (10:32am on Tuesday 15th January 2013)
in procedure c, how come x of B can have scope?i think option c is correct.
shristi said: (11:18am on Thursday 23rd May 2013)
i think c is right
Gargi said: (12:59pm on Saturday 28th May 2016)
i also think c is correct.

Write your comments here:


Report Error
 

Option: A

Explanation : Explanation will come here. Explanation will come here. Explanation will come here. Explanation will come here. Explanation will come here.