Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Goal: Names, Bindings and Scope 1. The scopes created by blocks, which could be nested in larger blocks are treated exactly those created by nested

image text in transcribed

Goal: Names, Bindings and Scope 1. The scopes created by blocks, which could be nested in larger blocks are treated exactly those created by nested subprograms. C based languages Program Main; start Main ) do not have nested subprograms but they do have nested blocks. Create two nested blocks and declare variables of the same name. Assign values to those variables and print their values before you enter the block in the block and after you exit the block. Try it in Java and write down the difference, if there is any var r,v,a: integer procedure AREA: start AREA) begin a3 *r*r; endend AREA) procedure VOL3D start VOL3D) var a,r: integer; procedure MYPRINT: start MYPRINT.) begin println ("Volume is",v) println ("Area is ", a) Define static, stack-dynamic, explicit-heap dynamic and implicit-heap dynamic variables. Then, please write example lines of codes in C to represent each variable, if possible 2. endend MYPRINT) begin a1 AREA v - 4/3*r*a; MYPRINT: endend VOL3D) 3. Examine the following program. Assume static scoping is used. List all the variables that are visible begin at points (1), (2), (3), and 4) (referencing environment) and specify where they are declared Write down what gets printed. If dynamic scoping is used what would get printed. Also give the end. l end Main h referencing environment for dynamic scoping as well a0: VOL3D

Step by Step Solution

There are 3 Steps involved in it

Step: 1

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

Beginning ASP.NET 2.0 And Databases

Authors: John Kauffman, Bradley Millington

1st Edition

0471781347, 978-0471781349

More Books

Students also viewed these Databases questions

Question

3. What are potential solutions?

Answered: 1 week ago

Question

Provide examples of KPIs in Human Capital Management.

Answered: 1 week ago

Question

What are OLAP Cubes?

Answered: 1 week ago