[6 points] Consider the following code written in a language with static scoping and nested subprograms....
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
[6 points] Consider the following code written in a language with static scoping and nested subprograms. Assume that a is called from main function and on the bottom of the stack there is the activation record instance for main. Additionally, activations records (AR) of all related subprograms are given. What are the offset pairs (in the form of (chain offset, local offset) ) of all the variables in lines designated by pos1 and pos2? function a() { int y,z; function b() { int y; function c() { int x; x = y + z; // posl } C(); } function d(int i) { int x; function e() { int x,y: d(5); x = y + i; // pos2 if (i>0) then b(); else e(); d(e); AR for a AR for d AR for e Local z Localy Dynamic link AR for b AR for c Local x Local y Local y Local x Param i Local x Dynamic link Dynamic link Static link Dynamic link Static link ynamic link Static link Static link Static link Return addr. Return addr. Return addr. Return addr. Return addr. Pos1 x: ( * ) y: ( • )z:( Pos2 x: ( : ) y: ( + )i: ( [6 points] Consider the following code written in a language with static scoping and nested subprograms. Assume that a is called from main function and on the bottom of the stack there is the activation record instance for main. Additionally, activations records (AR) of all related subprograms are given. What are the offset pairs (in the form of (chain offset, local offset) ) of all the variables in lines designated by pos1 and pos2? function a() { int y,z; function b() { int y; function c() { int x; x = y + z; // posl } C(); } function d(int i) { int x; function e() { int x,y: d(5); x = y + i; // pos2 if (i>0) then b(); else e(); d(e); AR for a AR for d AR for e Local z Localy Dynamic link AR for b AR for c Local x Local y Local y Local x Param i Local x Dynamic link Dynamic link Static link Dynamic link Static link ynamic link Static link Static link Static link Return addr. Return addr. Return addr. Return addr. Return addr. Pos1 x: ( * ) y: ( • )z:( Pos2 x: ( : ) y: ( + )i: (
Expert Answer:
Related Book For
Posted Date:
Students also viewed these programming questions
-
Consider the following code: For (i = 0; i < 20; i++) For (j = 0; j < 10; j++) A[i] = a [i] * j a. Give one example of the spatial locality in the code. b. Give one example of the temporal locality...
-
Consider the following code fragment in a high-level language: Assume that Q is an array of 32-byte records and the VAL field is in the first 4 bytes of each record. Using x86 code, we can compile...
-
If a translation of IFRS exists in a language with which you are familiar, assess the quality of the translation.
-
?Claim: A of adults would erase all of their personalinformation online if they could. A software firm survey of 511randomly selected adults showed that 36 ?% of them would erase allof their pe...
-
Compare the different types of transmission errors that can occur in wireless and wired networks. What additional role does mobility play?
-
Sales through department stores account for about one-third of the $170 billion world market for cosmetics. One of the major reasons perhaps the most important reasonfor department stores ability to...
-
Verify the vector identity \[\begin{equation*}abla^{2} \boldsymbol{v}=abla(abla \cdot \boldsymbol{v})-abla \times(abla \times \boldsymbol{v}) \tag{15.83}\end{equation*}\]
-
The consumption function captures one of the key relationships in economics that was first developed by John Maynard Keynes. It expresses consumption as a function of disposable income, where...
-
1.Give one reason why an investor may decide to exercise an in-the-money call option rather than sell it.
-
Find the output voltage vo(t) in the circuit of Fig. 8.94. t=0 10 512
-
What is the pH at 25 C of water saturated with CO 2 at a partial pressure of 1.20 atm? The Henry's law constant for CO 2 at 25 C is 3.1 102mol/L-atm. The CO 2 is an acidic oxide, reacting with H 2 O...
-
Compare and contrast the different approaches to rationality seen across the behavioural and experimental literatures. In comparison with standard economic assumptions about rational choice, what are...
-
Find two advertisements for sports products that compete directly with one another. For example, you may want to compare Nike running shoes with Reebok running shoes or King Cobra golf clubs with...
-
Develop advertisements for athletic shoes that reflect each of the core American values discussed in this chapter.
-
How do behavioural economists provide an alternative explanation for addictive behaviour? Illustrate with examples.
-
Find examples of how technology has influenced the sporting goods industry, a professional sports franchise, and the way spectators watch a sporting event. For each example indicate the technology...
-
How do mutational processes intersect with other biological phenomena such as genetic drift, gene flow, and natural selection in shaping the genetic landscape of populations ?
-
Explain the differences and similarities between fringe benefits and salary as forms of compensation.
-
Consider the following code segment, which removes all spaces and punctuation marks from a given phrase. The first statement performs a search to determine whether the phrase contains a space or...
-
In gambling circles, the combination of a 3 and 4 (in either order) is known as a natural seven. Add an additional text span to your stats.html page that keeps track of the number of natural sevens...
-
In what way is integrated-circuit manufacturing similar to photography?
-
Consider expansion of a function in terms of a series \(F_{n}(x)\) in the following form: \[f(x)=\sum_{n} A_{n} F_{n}(x)\] If the functions \(F_{n}\) are orthogonal then this property helps to unfold...
-
A concrete wall \(20 \mathrm{~cm}\) thick is initially at a temperature of \(20^{\circ} \mathrm{C}\), and is exposed to steam at pressure \(1 \mathrm{~atm}\) on both sides. Find the time for the...
-
Analyze the transient problem with the Dirichlet condition for a long cylinder and for a sphere. Derive expressions for the eigenfunctions, eigenconditions, and eigenvalues. Find the series...
Study smarter with the SolutionInn App