Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

  1. Consider the following pseudocode:

  1. procedure main()
  2. a : integer := 1
  3. b : integer := 2

  1. procedure middle()
  2. b : integer := a

  1. procedure inner()
  2. print a, b

  1. a : integer := 3

  1. --body of middle
  2. inner()
  3. print a, b

  1. --body of main
  2. middle()
  3. print a, b

What does the above program print (or will the compiler identify static semantic errors), under the following assumptions:

  1. names must be declared before use, but the scope of a name is the entire block in which it is declared.
  2. names can be declared in any order and their scope is the entire block in

which they are declared.

  1. 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

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

Oracle Database 10g Insider Solutions

Authors: Arun R. Kumar, John Kanagaraj, Richard Stroupe

1st Edition

0672327910, 978-0672327919

More Books

Students also viewed these Databases questions

Question

=+ What is the nature of the contracts or agreements with unions?

Answered: 1 week ago

Question

=+What is the procedure for labor relations in the workplace?

Answered: 1 week ago

Question

=+ Are ballots compulsory?

Answered: 1 week ago