Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Consider the following skeletal Ada program: procedure Main is X : Integer, procedure Sub3; -- This is a declaration of Sub3 It allows Subl to

image text in transcribed

Consider the following skeletal Ada program: procedure Main is X : Integer, procedure Sub3; -- This is a declaration of Sub3 It allows Subl to call it procedure Subl is X : Integer; procedure Sub2 is begin -- of Sub2 end; -- of Sub2 begin -- of Subl end; -- of Subl begin -- of Sub3 end; -- of Sub3 procedure Sub3 is begin -- of main end; - of main Assume that the execution of this program is in the following unit order: Main calls Subl Sub1 calls Sub2 Sub2 calls Sub3 Assuming static scoping in the following, which declaration of X is the correct one for a reference to X in each of the following subprograms? [5 points] a. Subl (which declaration of X does Subl refer to?) b. Sub2 (which declaration of X does Sub2 refer to?) c. Sub3 (which declaration of X does Sub3 refer to?) Explain your answers. Repeat part a, but assume dynamic scoping. [5 points]

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

Programming The Perl DBI Database Programming With Perl

Authors: Tim Bunce, Alligator Descartes

1st Edition

1565926994, 978-1565926998

More Books

Students also viewed these Databases questions

Question

13. Identify the refusal of the return in Dances with Wolves.

Answered: 1 week ago

Question

Describe the job youd like to be doing five years from now.

Answered: 1 week ago

Question

So what disadvantages have you witnessed? (specific)

Answered: 1 week ago