i) Activation Record:
ii) name of the procedure calls from B
B calls C
static chain is a chain of static links that connects certain activation record instances.
The static chain from an activation record instance connects it to all of its static ancestors.
B is called from ( B -> E -> D -> A -> Main ).
(24) (2 marks) Consider the following skeletal program, written in a lan- guage with static scope. procedure Main; proc...
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...
(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...
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,...
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...
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...
1) Consider the following Java program: 1 public class HelloWorld { 2 // My first program! 3 public static void main(String[] args) { 4 System.out.println("Hello, World!"); 5 } 6 } What is on line 1? a. a variable declaration b. a statement c. a method (subroutine) definition d. a comment e. a class definition 2) Which one of the following does NOT describe an array? a. It can be used in a for-each loop. b. It has a numbered sequence...
Some java questions: 18. Consider the following class definitions public class TestAB public static void main (String args) A bl new B() в ь2 -new B() ; b1.х, А.у, Ь2.х, в.у); System.out.printf ("%d, Sd, %d, d\n", class A public int x = 2; public static int y = 4; public A () ( X=y- class Bextends A public int x = 32; public static int y = 45; public B ( x ++y What is the result of attempting to...
This is for a Unix class. Please help me out. I am attaching a skeletal code of the program below, it just needs ti be filled in. Below is a skeletal code of the program. Fork a child process and then use the parent for reading and the child for writing. This is just a way of sending and receiving messages asynchronously. /* ************************************************************* * Utility functions * ************************************************************** */ static void usageError(const char * progName, const char *msg) {...
You need not run Python programs on a computer in solving the following problems. Place your answers into separate "text" files using the names indicated on each problem. Please create your text files using the same text editor that you use for your .py files. Answer submitted in another file format such as .doc, .pages, .rtf, or.pdf will lose least one point per problem! [1] 3 points Use file math.txt What is the precise output from the following code? bar...