Consider the following program: In each case YOU MUST SHOW ALL OF YOUR WORK proc main...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Consider the following program: In each case YOU MUST SHOW ALL OF YOUR WORK proc main int X, Z; proc A: int a; proc B; int x, a; { x:= 2; a:= 8; call C; print x; } (end B) proc C; int z; {x = 4; z = 7; print a; } (end C) { x:= 3; z = 5; a:= 6; call B; print x;) (end A) proc D; int x, b; proc E; int x, Z; { x:= 5; z:= 11; call F; print x; } (end E) proc F; proc G; { print z; x:= 8; call A; print x; } (end G) { print x; call G; x:=7; } (end F) { x:= 12; call E; print x; } (end D) { x:= 1; z:= 9; call D; print x; } (end main) (a) (6pts) What is the program output assuming static scoping rules are employed? (b) (6pts) What is the corresponding output when dynamic scoping rules are employed? (c) (5pts) List all of the units (proc's) that proc C can call (assuming static scoping). (d) (4pts) Specify the referencing environment of proc F (assuming static scoping) That is, list the variables that are visible to proc F Consider the following program: In each case YOU MUST SHOW ALL OF YOUR WORK proc main int X, Z; proc A: int a; proc B; int x, a; { x:= 2; a:= 8; call C; print x; } (end B) proc C; int z; {x = 4; z = 7; print a; } (end C) { x:= 3; z = 5; a:= 6; call B; print x;) (end A) proc D; int x, b; proc E; int x, Z; { x:= 5; z:= 11; call F; print x; } (end E) proc F; proc G; { print z; x:= 8; call A; print x; } (end G) { print x; call G; x:=7; } (end F) { x:= 12; call E; print x; } (end D) { x:= 1; z:= 9; call D; print x; } (end main) (a) (6pts) What is the program output assuming static scoping rules are employed? (b) (6pts) What is the corresponding output when dynamic scoping rules are employed? (c) (5pts) List all of the units (proc's) that proc C can call (assuming static scoping). (d) (4pts) Specify the referencing environment of proc F (assuming static scoping) That is, list the variables that are visible to proc F
Expert Answer:
Answer rating: 100% (QA)
The provided image contains a text of a programming code structure with various procedure definitions and nested procedure calls This is a pseudocode representation rather than code specific to a prog... View the full answer
Related Book For
Posted Date:
Students also viewed these programming questions
-
The project information for the custom order project of the Air Control Company is presented here. Draw a project network for this project. Compute the early and late activity times and the slack...
-
The following additional information is available for the Dr. Ivan and Irene Incisor family from Chapters 1-5. Ivan's grandfather died and left a portfolio of municipal bonds. In 2012, they pay Ivan...
-
+9.33 x 10 C +91 Find the net force on 92. 0.180 m +4.22 x 10 C +92 0.230 m- -8.42 x 10 C 93 F = force exerted on q2 by 91 F3 = force exerted on 92 by 93 F = 10.9 N F3 = 6.04 N Remember: Forces...
-
Sun Company, a U.S. corporation, has an account payable of $200,000 denominated in Canadian dollars. If the direct exchange rate increases, will Sun experience a foreign currency transaction gain or...
-
A company is using a carrier to deliver goods to a major customer. The annual demand is $2,500,000, and the average transit time is 10 days. Another carrier promises to deliver in 7 days. What is the...
-
What is the role of the Auditing Practices Board in the UK regulatory framework? Discuss whether it has been successful in achieving its objectives.
-
Adriana Company had a net income of $130,000 and paid cash dividends of $26,000 for 20--. Overman Company had a net loss of $25,000 and distributed a 10% stock dividend with a market value of...
-
Identify an area of business and explain how you could use different forms of current and present financial data (From internet or example) to ascertain whether the department made a profit or a loss...
-
Grove Audio is considering the introduction of a new model of wireless speakers with the following price and cost characteristics. Required a. What number must Grove Audio sell annually to break...
-
1. NEED TO PUT IN GENERAL JOURNAL (WHAT ARE THE DEBIT AND CREDIT ENTRY? HOW TO JOURNALIZE IN GENERAL JOURNAL? WHAT ARE THE ENTRY FOR DEBIT AND CREDIT ACCOUNTS? HERE'S THE LIST OF ACCOUNT YOU CAN...
-
QUESTION TWO (20 MARKS) Consider a discrete random variable taking values 0, 1, 2, 3,... Find E(T) as a function of the survivor function. Hence find the mean of the random variable whose survivor...
-
QUESTION 5 (20 MARKS) The following is a report of a clinical trial to evaluate the efficiency of maintenance Chemotherapy for acute Leukemia. Patients were randomly allocated to group 1 and II....
-
Solve the predator prey model developed in (a) above and use the solution to show that in the absence of the predators, the prey grows exponentially and in the absence of the prey the predator...
-
and 10 B=0,+r cosa,+a, in cartesian and cylindrical coordinates Express the vector and find B=(-3,4,0) Two blocks of masses 10kg and 20kg are placed on the x-axis. The first mass is moved on the axis...
-
Using the Black-Scholes option pricing model, determine the following: a) the value of the call option; b) value of the put option. What is the value of the put option using the put-call parity?...
-
Solve the differential equation using an appropriate integrating factor. 1) y(2xy+1) dx-xdy=0 2) y(y-x) dx + x(y + x)dy=0
-
Evaluate the integral, if it exists. Jo y(y + 1) dy
-
Problems 104111 are based on material learned earlier in the course. The purpose of these problems is to keep the material fresh in your mind so that you are better prepared for the final exam....
-
In Problems 1968, solve each equation, if possible. 1 3 (w + 1) - 3 = 2 5 - 4) 2 15
-
In Problems 1328, use properties of logarithms to find the exact value of each expression. Do not use a calculator. e ln 8
-
Differentiate between live and dead centres of a lathe.
-
List the various lathe accessories.
-
Explain the working principal of a shaper.
Study smarter with the SolutionInn App