Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Consider the following pseudocode. 1. procedure main() a: integer := 1 b: integer := 2 procedure middle ) b: integer := a procedure inner() print

image text in transcribed

Consider the following pseudocode. 1. 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 ) 14. print a, b print a, 13. Suppose this was code for a language with the declaration-order rules of C (but with nested subroutines)--that is, names must be declared before use, and the scope of a name extends from its declaration through the end of the block. At each print statement, indicate which declarations of a and b are in the referencing environment. What does the program print (or will the compiler identify static semantic errors)? Repeat the exercise for the declaration-order rules of C# (names must be declared before use, but the scope of a name is the entire block in which it is declared) and of Modula-3 (names can be declared in any order, and their scope is the entire block in which they are declared). (Hint: each of the three languages will produce different output; one of the languages will produce an error.) Consider the following pseudocode. 1. 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 ) 14. print a, b print a, 13. Suppose this was code for a language with the declaration-order rules of C (but with nested subroutines)--that is, names must be declared before use, and the scope of a name extends from its declaration through the end of the block. At each print statement, indicate which declarations of a and b are in the referencing environment. What does the program print (or will the compiler identify static semantic errors)? Repeat the exercise for the declaration-order rules of C# (names must be declared before use, but the scope of a name is the entire block in which it is declared) and of Modula-3 (names can be declared in any order, and their scope is the entire block in which they are declared). (Hint: each of the three languages will produce different output; one of the languages will produce an error.)

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

Microsoft Outlook 2023

Authors: James Holler

1st Edition

B0BP9P1VWJ, 979-8367217322

Students also viewed these Databases questions

Question

here) and other areas you consider relevant.

Answered: 1 week ago