Consider the following pseudo-code. Assume that the language has one global scope, one scope per function...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Consider the following pseudo-code. Assume that the language has one global scope, one scope per function and one scope for each braced code block. int x = 10; int third (int x) { print x; { int. x = 30; second(); } int second() { print x; 1 int first() { int x = 25; third (x); first(); 1. (4 pts) Draw the symbol tables in separation for all the scopes in this program. Assume that each table contains two columns: name and type. 2/3 2. (2 pts) If the language uses static scoping rules, what's the expected output from the print statement? Justify your answer by showing the hierarchy of the symbol tables at the print statement. 3. (2 pts) If the language uses dynamic scoping rules, what's the expected output from the print state- ment? Justify your answer by showing the hierarchy of the symbol tables at the print statement. Consider the following pseudo-code. Assume that the language has one global scope, one scope per function and one scope for each braced code block. int x = 10; int third (int x) { print x; { int. x = 30; second(); } int second() { print x; 1 int first() { int x = 25; third (x); first(); 1. (4 pts) Draw the symbol tables in separation for all the scopes in this program. Assume that each table contains two columns: name and type. 2/3 2. (2 pts) If the language uses static scoping rules, what's the expected output from the print statement? Justify your answer by showing the hierarchy of the symbol tables at the print statement. 3. (2 pts) If the language uses dynamic scoping rules, what's the expected output from the print state- ment? Justify your answer by showing the hierarchy of the symbol tables at the print statement.
Expert Answer:
Answer rating: 100% (QA)
Answer variable X X variable a f1 Symbol table Inner scope 1 b 33 c Global ... View the full answer
Related Book For
Computer Systems A Programmers Perspective
ISBN: 9781292101767
3rd Global Edition
Authors: Randal E. Bryant, David R. O'Hallaron
Posted Date:
Students also viewed these programming questions
-
Could you provide insights into the complex interplay between verbal and nonverbal communication channels, elucidating how nonverbal cues, including proxemics, kinesics, and haptics, complement and...
-
Write the business rules represented by the following ERD and convert this ERD to the relational schema. MAINTENANCE PK maint_no PK is_charged_for+PK maint_date maint_type maint_cost DAMAGE dam_no...
-
______________ is an approach to doing business that attempts to maximize an organization's competitiveness through the continual improvement of the quality of its products, services, people,...
-
What is the composition, in atom percent, of an alloy that contains 44.5 lbm of Ag, 83.7 lbm of Au, and 5.3 lbm of Cu?
-
The excess computation time required for repeated method calls in recursive programs is called _________________. a. Overload b. Backup c. Overhead d. Liability
-
Bradshaw Corp. manufactures radiation-shielding glass panels. Suppose the company is considering spending the following amounts on a new TQM program: The company expects the new program would save...
-
The contribution margin income statement of Krazy Kustard Donuts for August 2016 follows: Krazy Kustard sells four dozen plain donuts for every dozen custard-filled donuts. A dozen plain donuts sells...
-
(a) Explain the following methods of payment that could be used by a multinational corporation (MNC) to settle international transactions: Required: (i) Prepayment. (2 marks) (ii) Letters of credit...
-
The file Problem5_9.xlsx contains passing statistics for NFL teams during the 2017 season. Using formulas that do combine INDEX and MATCH in the same cell, return the desired statistics in the range...
-
Describe some of the commonly used theories for the inclusion of fringe benefits in the computation of economic damages.
-
The solution of the system X- 15 -y= NT 3 X = 10 612 23 25 is
-
Write an ad, based on a theory or approach to persuasion covered in this week. Your ad must have a headline, a sub-headline under the headline, at least one image, at least two paragraphs of copy,...
-
The City of Wonderland passed a living wage ordinance. Broadly speaking, the ordinance covered firms that had contracts with the City. However, for a variety of reasons, some firms were exempt from...
-
How did China's entry into the World Trade Organization affect jobs in the United States?
-
A three-phase generator rated 480 V and 400 kVA connected to a three-phase transformer rated 3.2 kV/480 V, 200 kVA, with reactance of 10% is used to serve a load over a line of 1 + j20 22. At the...
-
The marketing department of Jessi Corporation has submitted the following sales forecast for the upcoming fiscal year 1st 2nd Quarter 8,600 Quarter 10,600 Srd Quarter 12,600 4th Quarter Budgeted...
-
Consider the function f and its graph. a. Estimate the zeros of the area function b. Estimate the points (if any) at which A has a local maximum or minimum. c. Sketch a graph of A, for 0 x 10,...
-
An alternate rule for translating if statements into goto code is as follows: A. Rewrite the goto version of absdiff_se based on this alternate rule. B. Can you think of any reasons for choosing one...
-
For each of the following lines of assembly language, determine the appropriate instruction suffix based on the operands. (For example, mov can be rewritten as movb, movw, movl, or movq.) mov mov mov...
-
Estimate the average time (in ms) to access a sector on the following disk: Parameter Rotational rate Tavg seek Average number of sectors/track Value 12,000 RPM 5 ms 300
-
A concave mirror brings the sun's rays to a focus at a distance of \(30 \mathrm{~cm}\) from the mirror. If the mirror were submerged in a swimming pool, would the sun's rays be focused nearer to,...
-
A candle is placed in front of a converging lens. A well focused image of the flame is seen on a screen on the opposite side of the lens. If the candle is moved farther away from the lens, how must...
-
You are looking straight into the front of an aquarium. You see a fish off to your right. Is the fish actually in the direction you're looking, farther to the right, or farther to the left? Explain.
Study smarter with the SolutionInn App