Answer
--
all the best
.Show the stack with all activation record instances, including static and /dynamic chains, when execution reaches posi...
Show the stack with all activation record instances, including static and dynamic chains, when execution reaches position 1 in the following ske- letal program. Assume Bigsub is at level 1. procedure Bigsub is MySum : Float; procedure A is X : Integer; procedure B(Sum : Float) is Y, Z : Float begin -of B C(Z) end; -- of B begin -of A B (X)i end -- of A procedure C (Plums Float) is begin - of c end; -- of...
3. Show the stack with all activation record instances, including static and dynamic chains, when execution reaches position 1 in the following skeletal program. Assume Bigsub is at level 1 procedure Bigsub is procedure A (Flag procedure Bis Boolean) is A (false) end; -of B begin -- of A if flag then B; else C; end; -of A procedureCis procedure D is end; -of D end; -- of dC begin of Bigsub A(true); of Bigsub end; -- The calling sequence...
Show the stack with all activation record instances, including the dynamic chain, when execution reaches position 1 in the following skeletal program. This programuses the deep-access method to implement dynamic scoping.void fun1(){float a;}void fun2(){int b, c;}void fun3(){float d;<--------1}void main(){char e, f, g;}The calling sequence for this program for execution to reach fun3 ismain calls fun2fun2 calls fun1fun1 calls fun1fun1 calls fun3
Which of the following statements are true? A. Activation record instance is a concrete example of an activation record B. Activation record is a noncode part of a program C. A recursive program may have several activation record instances on the stack I think it is all of the above. What do you think?
Given the following Ada program: procedure Main is X, Y: Integer; procedure Sub1 is Y, Z: Integer; begin -- of Sub1 point 1 Sub2; end; -- of Sub1 procedure Sub2 is X: Integer; procedure sub3 (B: Integer) is W: Integer; begin -- of Sub3 point 2 end; -- of Sub3 begin -- of Sub2 point 3 Sub3 (X); end; -- of Sub2 begin -- of Main point 4 Sub1; end; -- of Main For each of the four marked points,...
(24) (2 marks) Consider the following skeletal program, written in a lan- guage with static scope. procedure Main; procedure A procedure B: procedure C begin C end C begin B end B procedure D procedure E begin E end E begin D end D begin A end A begin ain end Nain Imagine that the following procedure calls have taken place: Main calls A A calls D D calls E E calls B B calls C i. Drawthe run time...
(17) (1 mark) What is the static parent of a subprogram? (18) (1 mark) What is a formal parameter? (19) (3 marks) Consider the following program, written in a C-like lan- guage int x void f(int a) {а- а+2; х %3D х+1;} void main x 1 f(x); printf("x= d\n",x); What value ot xwill be printed by the main program under each of the tollowing conditions? Imagine that tformal parameter a of function fis being passed: i by value ii. by...
12. Consider C++ class. Which one of the following choices is NOT correct? A. Class instances can be static, stack dynamic, or heap dynamic. B. If static or stack dynamic, they are referenced directly with value variables. C. If stack dynamic, they are referenced through pointers. D. Stack dynamic instances of classes are always created by the elaboration of an object declaration. E. The lifetime of such a class instance ends when the end of the scope of its declaration...
C++ Carefully review Program 19-2 in your textbook, MathStack. This is a static stack, meaning that the size of the stack is set at the beginning of the program (see line 11): MathStack stack(5). I would like you to modify this program as follows: 1. Implement it as a dynamic stack (do not use a static stack as it is designed in the book). Use a linked list to implement this. There's code in the book. 2. Add functionality for...
help me answer the following questions please 1. Stack (LIFO) & its application 1. Stack overflow & underflow 2. Implementation: partially filled array & linked list 3. Applications: reverse string, backtracking Exercises: 1) Which of the following applications may use a stack? A. parentheses balancing program. B. Keeping track of local variables at run time. C. Syntax analyzer for a compiler. D. All of the above. 2) Consider the usual algorithm for determining whether a sequence of parentheses is balanced....