Question: 4) Consider the following pseudocode: procedure main() a : integer := 1 b : integer := 2 procedure middle() b : integer = a procedure
4) 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 inner() print a, b middle() print a, b Consider each of the following scoping rules. Indicate if the program will have static semantic answers. If it will not, what will the program print? Explain your answers a) C style declaration rules- names must be declared before use, and the scope of a name extends from its declaration through the end of the current block. b) C# style declaration rules- names must be declared before use, and the scope of a variable is the entire block in which it is declared. c) Modula-3 - names can be declared in any order at any time, and there scope is the entire block in which they are declared.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
