Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++, Static scoping, list variables, along with functions . PLC The following questions refer to the skeletal C++ program shown below. (a) Assume that static

C++, Static scoping, list variables, along with functions . PLC image text in transcribed
The following questions refer to the skeletal C++ program shown below. (a) Assume that static scoping is used. List all variables, along with the functions in which they are declared, that are visible at Line 1 in the program. (b) Repeat part (a), but list the variables that are visible at Line 2. (c) Repeat part (a), but list the variables that are visible at Line 3. (d) Repeat part (a) but list the variables that an- visible at Line 4. (e) Repeat part (a), but list the variables that are visible at Line 5. (f) Assume that dynamic scoping is used, and that main calls f1, which calls f2. (Assume that f1 calls f2 on Line 3.) List all variables, along with the functions in which they are declared, that are visible at Line 5 in the program. void f1(); void f2(); int a, b; int main(){int c, d, e; _//Line 1} void f1() {int b, c, e; if (-) {int b, d; _//Line 2} _//Line 3} void f2() {int a, c, e; if (...) {int b, e; _//Line 4} _//Line 5} A sample answer to one part of the problem might look like this: a (global), b (declared in if block in 1), c (declared in f1)

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

Professional Microsoft SQL Server 2014 Integration Services

Authors: Brian Knight, Devin Knight

1st Edition

1118850904, 9781118850909

More Books

Students also viewed these Databases questions