26. Consider the following program written in a pseudo code for a black structured language with program Main( int a,b,c
Posted: Sat May 14, 2022 4:48 pm
26. Consider the following program written in a pseudo code for a black structured language with program Main( int a,b,c procedure Paint // i nested in Main int b procedure RO IR is nested in P intc CN.4; // body of print('R', a, b, c, x); if > then P(x - 1) else 50) 1 // end R procedure so // S is nested in P a=X: 1/ body of 5 b-X print('s', a, b, c, x); ).// ends b- x + 2; 1/ body of P print('P', a, b, c, x); RO); ) // end p a = 1; 1/ body of Main b = 1; C-1 P(1): print(", a, b, c); 11/ end Main If you trace the execution of this code, you will see that the recursive calls to the procedure the runtime stack in the following configuration: Main(), (:), R), P(), R), 50) 26.1. (6 pts) in the space below, show the output of this program when (using static scoping dynamic scoping rules Static Scoping Output: Dynamic Scoping Outpu 26.2. (10 pts) Draw this runtime stack (with the above six active procedures) in the space on the ne the formal parameters names and local variables names allocated for each procedure (activati in their correct order (names only, no values): (1) the dynamic links, represented by solid arros of the stack; and () the static links, represented by dashed arrows, on the left side of the stac only point to the correct AR, they need not point to an exact location in the AR. Make destination of each arrow is clearly drawn and not overlapping other arrows (intersection okay). Including the return address is optional