Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Consider the Ada program given below. You will be asked to determine which variables are visible in a number of dierent sit- uations. In each

Consider the Ada program given below. You will be asked to determine which variables are visible in a number of dierent sit- uations. In each case, identify each variable by its name and the line number of its declaration. 1 . procedure Main i s 2 . A, B, C : I n t e g e r ; 1 3 . procedure Sub1 i s 4 . D, E : I n t e g e r ; 5 . begin of Sub1 6 . . . . 7 . end; of Sub1 8 . procedure Sub2 i s 9 . C, D : I n t e g e r ; 1 0 . procedure Sub3 i s 1 1 . B, D, F: I n t e g e r ; 1 2 . begin of Sub3 1 3 . . . . 1 4 . end; of Sub3 1 5 . begin of Sub2 1 6 . . . . 1 7 . end; of Sub2 1 8 . begin of Main 1 9 . . . . 2 0 . end; of Main (a) Assuming that static scoping is used, say which variables are visible in the bodies of each of the procedures: Main, Sub1, Sub2 and Sub3. (b) Assuming that dynamic scoping is used and the calling sequence is Main calls Sub1; Sub1 calls Sub2; Sub2 calls Sub3, say which variables are visible in Sub3. (c) Assuming that dynamic scoping is used and the calling sequence is Main calls Sub2; Sub2 calls Sub3; Sub3 calls Sub1, say which variables are visible in Sub1. (d) Assuming that dynamic scoping is used and the calling sequence is Main calls Sub2; Sub2 calls Sub1, say which variables are visible in Sub1.

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

SQL Database Programming

Authors: Chris Fehily

1st Edition

1937842312, 978-1937842314

More Books

Students also viewed these Databases questions