Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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.

Consider the following pseudo-code. Assume that the language has one global scope, one scope per function and 

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.

Step by Step Solution

3.32 Rating (161 Votes )

There are 3 Steps involved in it

Step: 1

Answer variable X X variable a f1 Symbol table Inner scope 1 b 33 c Global ... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Computer Systems A Programmers Perspective

Authors: Randal E. Bryant, David R. O'Hallaron

3rd Global Edition

1292101768, 978-1292101767

More Books

Students also viewed these Programming questions