Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Consider the following pseudocode: procedure main() a : integer := 1 b : integer := 2 procedure middle() b : integer := a procedure inner()
- Consider the following pseudocode:
- procedure main()
- a : integer := 1
- b : integer := 2
- procedure middle()
- b : integer := a
- procedure inner()
- print a, b
- a : integer := 3
- --body of middle
- inner()
- print a, b
- --body of main
- middle()
- print a, b
What does the above program print (or will the compiler identify static semantic errors), under the following assumptions:
- names must be declared before use, but the scope of a name is the entire block in which it is declared.
- names can be declared in any order and their scope is the entire block in
which they are declared.
- names must be declared before use and the scope of a name extends from its declaration through the end of the block.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started