Consider the following JavaScript program: 010 var X, y, z 020 030 function sub1( ) { 040 var a, y, zi 050 060 function sub2 ( ) { 070 var a, b, zi...
This question has been answered
Question

These are questions from a chapter I had issues with. It's java programming. Screen Shot 2021-02-08 at 11.38.42 AM.pngScreen Shot 2021-02-08 at 11.38.33 AM.pngScreen Shot 2021-02-08 at 11.38.33 AM.pngScreen Shot 2021-02-08 at 11.38.24 AM.pngScreen Shot 2021-02-08 at 11.38.24 AM.pngScreen Shot 2021-02-08 at 11.38.13 AM.png

Image transcriptions

4. Consider the following skeletal C program, and assume DYNAMIC scoping is used. 010 void fun1 (void) ; /* prototype */ 020 void fun2 (void) ; /* prototype */ 030 void fun3 (void) ; /* prototype */ 040 void main() 050 int a, b, Ci 060 / / BODY OF MAIN 070 080 void fun1 (void) { 090 int b, c, di 100 / / BODY OF FUN1 110 120 void fun2(void) { 130 int c, d, ei 140 / / BODY OF FUN2 150 } 160 void fun3 (void) { 170 int d, e, fi 180 / / BODY OF FUN3 190 } Assuming dynamic scoping and given the call sequences specified below, list all variables visible during the execution of the last function called, along with the line numbers where they are declared. a) main > fun1 > fun2 > fun3 b) main > fun1 > fun3 c) main > fun2 > fun3 > fun1 d) main > fun3 > fun1 e) main > fun1 > fun3 > fun2 f) main > fun3 > fun2 > fun1

3. Consider the following C program: 010 void fun(void) { 020 int a, b, ci 030 . . . 040 while ( . . .) { 050 int b, c, di 060 / / POSITION 1 070 while ( . . .) { 080 int c, d, ei 090 / / POSITION 2 100 110 7/ POSITION 3 120 130 7/ POSITION 4 140 a) List all variables visible at POSITION 1 (line 060) along with the line numbers where they are declared, assuming static scoping is used. b) List all variables visible at POSITION 2 (line 090) along with the line numbers where they are declared, assuming static scoping is used. c) List all variables visible at POSITION 3 (line 110) along with the line numbers where they are declared, assuming static scoping is used. d) List all variables visible at POSITION 4 (line 130) along with the line numbers where they are declared, assuming static scoping is used.

3. Consider the following C program: 010 void fun(void) { 020 int a, b, ci 030 . . . 040 while ( . . .) { 050 int b, c, di 060 / / POSITION 1 070 while ( . . .) { 080 int c, d, ei 090 / / POSITION 2 100 110 7/ POSITION 3 120 130 7/ POSITION 4 140 a) List all variables visible at POSITION 1 (line 060) along with the line numbers where they are declared, assuming static scoping is used. b) List all variables visible at POSITION 2 (line 090) along with the line numbers where they are declared, assuming static scoping is used. c) List all variables visible at POSITION 3 (line 110) along with the line numbers where they are declared, assuming static scoping is used. d) List all variables visible at POSITION 4 (line 130) along with the line numbers where they are declared, assuming static scoping is used.

2. Consider the following Python program: 010 x = 1i 020 y = 3; 030 Z = 5; 040 def sub1() : 050 a = 7: 060 y = 9: 070 = 11; 080 # BODY OF SUB1 090 def sub2 ( ) : 100 global xi 110 = 13 : 120 = 15; 130 W = 17; 140 # BODY OF SUB2 150 def sub3 ( ) : 160 nonlocal ai 170 19; 180 : 21; 190 Z = 23: 200 # BODY OF SUB3 a) List all variables visible at BODY OF SUB1 (line 080) along with the line numbers where they are declared, assuming static scoping is used. b) List all variables visible at BODY OF SUB2 (line 140) along with the line numbers where they are declared, assuming static scoping is used. c) List all variables visible at BODY OF SUB3 (line 200) along with the line numbers where they are declared, assuming static scoping is used.

2. Consider the following Python program: 010 x = 1i 020 y = 3; 030 Z = 5; 040 def sub1() : 050 a = 7: 060 y = 9: 070 = 11; 080 # BODY OF SUB1 090 def sub2 ( ) : 100 global xi 110 = 13 : 120 = 15; 130 W = 17; 140 # BODY OF SUB2 150 def sub3 ( ) : 160 nonlocal ai 170 19; 180 : 21; 190 Z = 23: 200 # BODY OF SUB3 a) List all variables visible at BODY OF SUB1 (line 080) along with the line numbers where they are declared, assuming static scoping is used. b) List all variables visible at BODY OF SUB2 (line 140) along with the line numbers where they are declared, assuming static scoping is used. c) List all variables visible at BODY OF SUB3 (line 200) along with the line numbers where they are declared, assuming static scoping is used.

1. Consider the following JavaScript program: 010 var X, y, z 020 030 function sub1( ) { 040 var a, y, zi 050 060 function sub2 ( ) { 070 var a, b, zi 080 / / BODY OF SUB2 090 } / / end sub2 100 110 / / BODY OF SUB1 120 130 } / / end sub1 140 150 function sub3( ) { 160 var a, x, wi 170 / / BODY OF SUB3 180 } / / end sub3 a) List all variables visible at BODY OF SUB1 (line 110) along with the line numbers where they are declared, assuming static scoping is used. b) List all variables visible at BODY OF SUB2 (line 080) along with the line numbers where they are declared, assuming static scoping is used. c) List all variables visible at BODY OF SUB3 (line 170) along with the line numbers where they are declared, assuming static scoping is used.

Answered by Expert Tutors

iscing elit. Nam lacin
s ante, dapibus a
, ultrices ac mag
ongue vel laoreet
ipsum dolor sit a

onec aliquet. Lo
sum dolor sit ame
consectetur adipi
icitur laoreet. N

Fusce dui lectus, con
sum dolor sit ame
, consectetur adi
icitur laoreet. N
consectetur adipi

usce dui lectus,
sum dolor sit ame
icitur laoreet. N
consectetur adipi

m risus ante, dapibus
sum dolor sit ame
consectetur adipi
icitur laoreet. N
, consectetur adi

icitur laoreet. Nam ri
sum dolor sit ame
icitur laoreet. N
, consectetur adi
consectetur adipi
s a molestie consequat, ultrices ac magna. Fusce dui lectus, congue vel laoreet ac, dict
consectetur adipiscing elit. Nam lacinia pulvinar tortor nec facilisis. Pellentesque dapibus efficitur laoreet. Nam risus ante, dapibus a m
consectetur
cing elit. N

gue vel laoreet ac, dictum vitae odio. Donec aliquet. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam lacinia pulvinar tortor
consectetur
cing elit. N
trices ac ma

pulvinar tortor nec facilisis. Pellentesque dapibus efficitur laoreet. Nam risus ante, dapibus a molestie consequat, ultrices ac magna. Fus
consectetur
cing elit. N

ac, dictum vitae odio. Donec aliquet. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam lacinia pulvinar tortor nec facilisis. P
consectetur
onec aliquet. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam lacinia pulvi
consectetur adipiscing elit. Nam lacinia pulvinar tortor nec facilisis. Pellentesque dapibus efficitur laoreet. Nam risus ante, dapibus a m
consectetur
cing elit. N

gue vel laoreet ac, dictum vitae odio. Donec aliquet. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam lacinia pulvinar tortor
consectetur
cing elit. N
trices ac ma

pulvinar tortor nec facilisis. Pellentesque dapibus efficitur laoreet. Nam risus ante, dapibus a molestie consequat, ultrices ac magna. Fus
consectetur
cing elit. N

ac, dictum vitae odio. Donec aliquet. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam lacinia pulvinar tortor nec facilisis. P
consectetur
s a molestie consequat, ultrices ac magna. Fusce dui lectus, congue vel laoreet ac, dict
iscing elit. Nam lacinia pulvinar tortor nec facilisis. Pellentesque dapibus efficitur laoreet. Nam risus ante, dapibus a molestie consequat,
m ri
itur
nec
ipsu
m ri
icitu

onec aliquet. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam lacinia pulvinar tortor nec facilisis. Pellentesque dapibus effici
m ri
itur
nec
ce dui le
pulv
nec
ec a

facilisis. Pellentesque dapibus efficitur laoreet. Nam risus ante, dapibus a molestie consequat, ultrices ac magna. Fusce dui lectus, congue
m ri
itur
nec
itur laor
, ult
ultri
ur la
s a molestie consequat, ultrices ac magna. Fusce dui lectus, congue vel laoreet ac, dict
iscing elit. Nam lacinia pulvinar tortor nec facilisis. Pellentesque dapibus efficitur laoreet. Nam risus ante, dapibus a molestie consequat,
m ri
itur
nec
ipsu
m ri
icitu

onec aliquet. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam lacinia pulvinar tortor nec facilisis. Pellentesque dapibus effici
m ri
itur
nec
ce dui le
pulv
nec
ec a

facilisis. Pellentesque dapibus efficitur laoreet. Nam risus ante, dapibus a molestie consequat, ultrices ac magna. Fusce dui lectus, congue
m ri
itur
nec
itur laor
, ult
ultri
ur la
nec facilisis. Pellentesque dapibus efficitur laoreet. Nam risus ante, dapibus a molestie
a molestie consequat, ultrices ac magna. Fusce dui lectus, congue vel laoreet ac, dictum vitae odio. Donec aliquet. Lorem ipsum dolor sit ame
ultrices a
cing elit. N

a molestie consequat, ultrices ac magna. Fusce dui lectus, congue vel laoreet ac, dictum vitae odio. Donec aliquet. Lorem ipsum dolor sit amet
ultrices a
cing elit. N
tesque dapib

ac, dictum vitae odio. Donec aliquet. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam lacinia pulvinar tortor nec facilisis. Pel
ultrices a
facilisis.

Step-by-step explanation

s ante, dapibus a molestie consequat, ultrices ac magna. Fusce dui lectus, congue vel laoreet ac, dictum vitae odio. Donec aliquet. Lorem ipsum dolor sit

lestie consequat, ultrices ac magna. Fusce dui lectus, congue vel laoreet ac, dictum vitae odio. Donec aliquet. Lorem ipsum dolor sit amet, consectetur adipiscing elit. N
The student who asked this found it Helpful
Overall rating 100%
Get unstuck

416,787 students got unstuck by Course
Hero in the last week

step by step solutions

Our Expert Tutors provide step by step solutions to help you excel in your courses