9 10 11 12 13 14 15 16 17 18 19 20 x:integer procedure setx (n:integer) x :=n end procedure printx() print (x) end procedure first() setx (1) printx() end procedure second() end x:integer setx (2) printx() 21 22 setx (0) 23 first() printx() 24 second() printx() What does this program print if the language uses static scoping? What does it print with dynamic scoping? Why?

Systems Architecture
7th Edition
ISBN:9781305080195
Author:Stephen D. Burd
Publisher:Stephen D. Burd
Chapter10: Application Development
Section: Chapter Questions
Problem 6VE
icon
Related questions
Question
1 x:integer
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
procedure setx (n:integer)
x :=n
end
procedure printx()
print (x)
end
procedure first()
setx (1)
printx()
end
procedure second()
end
x:integer
setx (2)
printx()
setx (0)
first () printx()
second() printx()
What does this program print if the language uses static scoping? What does it print with
dynamic scoping? Why?
Transcribed Image Text:1 x:integer 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 procedure setx (n:integer) x :=n end procedure printx() print (x) end procedure first() setx (1) printx() end procedure second() end x:integer setx (2) printx() setx (0) first () printx() second() printx() What does this program print if the language uses static scoping? What does it print with dynamic scoping? Why?
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Topological Sort
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Systems Architecture
Systems Architecture
Computer Science
ISBN:
9781305080195
Author:
Stephen D. Burd
Publisher:
Cengage Learning