Question
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 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.26 Rating (132 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 ...Get Instant Access with AI-Powered Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started